During the Xinhai Revolution in 1911, the Qing governor fled from Dihua (Ürümqi). A band of Yunnanese led by Yang Zengxin quelled the rebellion and established himself as the provincial leader. President Yuan Shikai recognized Yang as governor. Yang was one of the few who supported Yuan's attempt to become emperor. During the National Protection War, he purged officers who sympathized with the Yunnan clique's leader Cai E. After Yuan's death, he recognized whichever government ruled in Beijing and maintained an isolationist and neutrality policy which kept Xinjiang away from the upheavals experienced in the rest of China.
In 1928, days after recognizing the Nationalist (KMT) government in Nanjing, Yang was assassinated by Fan Yaonan. He was succeeded by his protégé Jin Shuren who was originally from Gansu. Jin wholly mismanaged the province and alienated its Muslim majority. In 1931, Muslims rebelled against Jin. Gansu warlord Ma Zhongying of the Hui Ma clique invaded in support of the rebellion. Soon various other groups rebelled against Jin, often fighting against each other including the breakaway First East Turkestan Republic.
Jin was deposed by mutineers in 1933 and was succeeded by a Manchu, Sheng Shicai. Sheng was not a protégé of either Yang or Jin. He was initially an officer under Guo Songling and defected with Guo to the Guominjun. He was appointed by Nanjing to serve under Jin as late as 1930. The war continued unabated with Nanjing unable to resolve the conflict. Frustrated, Sheng turned to the Soviet Union in 1934. With Soviet support, Ma Hushan was defeated in 1937. Sheng turned Xinjiang into a Soviet protectorate and safe haven for the Chinese Communist Party.
With Nazi Germany's invasion of the Soviet Union in 1941, Sheng decided to rejoin the Kuomintang and expelled Soviet advisors and executed communists. Chiang Kai-shek couldn't trust Sheng, who tried renegotiating with Joseph Stalin, so he deposed him and installed direct rule in 1944. The new KMT administration then faced a rebellion that coalesced into the Second East Turkestan Republic.