Jahangir Khoja
The Qing implemented two different policies for Dzungaria and the Tarim Basin. Han Chinese were encouraged by the Qing to permanently settle and colonize Dzungaria while permanent Han settlers were banned from the Tarim with only Han merchants and Han Green Standard Army soldiers stationed in rotating garrisons allowed in the Tarim Basin. The ban was lifted in the 1820s after the invasion of Jahangir Khoja and Han Chinese were allowed to permanently settle in the Tarim. During the weakening of the Qing dynasty in the mid-19th century, both Chinese Muslims (Hui) and Uyghurs rebelled in Xinjiang cities, following on-going Chinese Muslim Rebellions in Gansu and Shaanxi provinces further east. In 1865, Yaqub Beg, a warlord from the neighbouring Khanate of Kokand, entered Xinjiang via Kashgar and conquered nearly all of Xinjiang over the next six years. At the [[Battle of Ürümqi (1870)]] Yaqub Beg's Turkic forces, allied with a Han Chinese militia, attacked and besieged Chinese Muslim forces in Ürümqi. In 1871, the [[Russian Empire]] took advantage of the chaotic situation and seized the rich [[Ili River]] valley, including [[Yining City|Gulja]]. At the end of this period, forces loyal to the Qing held onto only a few strongholds, including [[Tacheng]]. Yaqub Beg's rule lasted until the Qing general [[Zuo Zongtang]] (also known as General Tso) [[Qing reconquest of Xinjiang|reconquered the region]] between 1876 and 1878. In 1881, the Qing recovered the Gulja region through diplomatic negotiations, via the [[Treaty of Saint Petersburg (1881)]]. The Qing dynasty established Xinjiang ("new frontier") as a province in 1884, formally applying to it the political systems of the [[China proper]] and dropping the old names of Zhunbu (準部, Dzungar region) and Huijiang, "Muslimland."