The Turkic Muslim sedentary people of the Tarim Basin were originally ruled by the Chagatai Khanate while the nomadic Oirat Dzungar Buddhists in Dzungaria ruled over the Dzungar Khanate.
The Dzungar Oirats led by Sengge attacked the Chagatai Khanate during the reign of Abdullah Khan.
The Naqshbandi Sufi Khojas, descendants of the Prophet Muhammad, had replaced the Chagatayid Khans as the ruling authority of the Tarim Basin in the early 17th century. There was a struggle between two factions of Khojas, the Afaqi (White Mountain) faction and the Ishaqi (Black Mountain) faction. The Ishaqi defeated the Afaqi, which resulted in the Afaqi Khoja inviting the 5th Dalai Lama, the leader of the Tibetan Buddhists, to intervene on his behalf in 1677. The 5th Dalai Lama then called upon his Dzungar Buddhist followers in the Dzungar Khanate to act on this invitation. The Dzungar Khanate then conquered the Tarim Basin in 1680, setting up the Afaqi Khoja as their puppet ruler.
Khoja Afaq asked the 5th Dalai Lama when he fled to Lhasa to help his Afaqi faction take control of the Tarim Basin (Kashgaria). The Dzungar leader Galdan was then asked by the Dalai Lama to restore Khoja Afaq as ruler of Kashgaria. Khoja Afaq collaborated with Galdan's Dzungars when the Dzungars conquered the Tarim Basin from 1678-1680 and set up the Afaqi Khojas as puppet client rulers. The 5th Dalai Lama blessed Galdan's conquest of the Tarim Basin and Turfan Basin. The 5th Dalai Lama received war spoils which were seized from the Muslims from the Dzungar Khan Galdan, the Muslims were called "heretics" by them.
The Qarataghlik (Black Mountains) propagated anti-Afaq Khoja literature. For his action of inviting Dzungar invasion and rule, Afaq Khoja is viewed as a perfidious betrayer collaborator by some Uyghur nationalists while he and his grave was still honored and revered as a saint by other Uyghurs.
"We now come to the rise of the Zungars or Kalmuks, a Mongol race which then dwelt in Hi and the surrounding districts. Under Khan Haldan Bokosha, one of the outstanding figures of the period, their power stretched northwards to Siberia and southwards to Kucha, Karashahr and Kunya-Turfan; but Haldan rebelled against the Chinese and was decisively beaten.
His nephew and successor, Tse Wang Rabdan, ruled from Hami on the east to Khokand on the west, and, until his murder in 1727, was the most powerful of Zungarian rulers. The Torgut Mongols from fear of him fled to the banks of the Volga. Sir Henry Howorth gives an interesting account of the relations between Tse Wang and the Russians, from which it appears that Peter the Great, attracted by rumours of gold in Eastern Turkestan, despatched a body of 3000 men up the Irtish with Yarkand as their objective; but the Zungars assailed the column and forced it to retire.
To return to the Khoja family, its most celebrated member was Hidayat Ulla, known as Hazrat Apak or "His Highness the Presence," head of the Ak Taulins, who was regarded as a Prophet second only to Mohamed. Expelled from Kashgar he took refuge at Lhassa, where the Dalai Lama befriended him and advised him to seek the aid of the Zungars. In 1678 the latter seized Kashgar, which remained in their power for many years, and Hazrat Apak ruled as the deputy of the Khan, paying tribute equivalent to £62,000 per annum. In his old age the saint retired from the world to end his days among his disciples." - Sir Percy Sykes and Ella Sykes. Sykes, Ella and Percy Sykes. pages 270-271 Through deserts and oases of Central Asia. London. Macmillan and Co. Limited, 1920.
The Dzungar Khan Galdan launched his invasion of the Tarim Basin in 1680. The Dzungars had received submissions from Hami and Turfan, who sent soldiers to join the 120,000 strong Dzungar force in the invasion. The Dzungar Oirat army and its allies in the White Mountain sect then easily conquered the Tarim, defeating and killing the Chagatai Prince Bābak Sultān, the son of the Chagatai leader Ismā'il Khan. Kashgar and Yarkand fell to the Dzungars and they killed the Chagatai General Yiwazibo Beg. The Dzungars had deported to Ili the Chagatai royal family of Isma'il Khan after capturing them.
The Chagatai royal ʿAbdu r-Rashīd Khan II was selected as puppet ruler by Galdan, however, Āfāq Khoja soon caused trouble and the strife between Āfāq and ʿAbdu r-Rashīd led to Āfāq's second exile, and ʿAbdu r-Rashīd was also forced into exile in Ili after in Yarkand an outbreak of violence happened in 1682, and he was replaced by Muhammad Amin who was his younger brother. Qing China received tribute from Muhammad Amin via Turfan two times, in 1690s the Mughals received an embassy from him, and in 1691 Muhammad Amin asked for deliverance from the "Qirghiz infidels" (Dzungars) when the Khan Subhān Quli of Bukhara received his embassy, these were attempts by Muhammad Amin to ask these foreign countries (Qing China, Mughal India, and Bukhara) for assistance against the Dzungars to regain independence.
The Āfāqi Khoja White Mountain supporters rebelled and murdered Muhammad Amin in 1694 and seized power under Yahyā Khoja, son of Āfāq Khoja, but Āfāqi rule continued for only two years before revolts resulted in the murder of both son and father Khojas. Muhammad Mu'min, another younger brother of ʿAbdu r-Rashīd was made Khan in 1696 however the Kashghar begs and the Kyrgyz staged a revolt and seized Muhammad Mu'min during an assault on Yarkand, then the Dzungars were asked to intervene by the Yarkand begs, which resulted in the Dzungars defeating the Kyrgyz and putting a total termination to Chagatai rule by installing Mirzā 'Ālim Shāh Beg as ruler in Yarkand.
Since 1680 the Dzungars had ruled as suzerain masters over the Tarim, for 16 more years using the Chagatai as their puppet rulers. The Dzungars used a hostage arrangement to rule over the Tarim Basin, keeping as hostsges in Ili either the sons of the leaders like the Khojas and Khans or the leaders themselves. Although the Uighur's culture and religion was left alone, the Dzungars substantially exploited them economically.
The Uighurs were forced with multiple taxes by the Dzungars which were burdensome and set by a determined amount, and which they did not even have the ability to pay. They included water conservancy tax, draught animal tax, fruit tax, poll tax, land tax, tress and grass tax, gold and silver tax, and trade tax. Annually the Dzungars extracted a tax of 67,000 tangas of silver from the Kashgar people in Galdan Tseren's reign, a five percent tax was imposed on foreign traders and a ten percent tax imposed on Muslim merchants, people had to pay a fruit tax if they owned orchards and merchants had to pay a copper and silver tax. Annually the Dzungars extracted 100,000 silver tangas in tax from Yarkand and slapped livestock, stain, commerce, and a gold tax on them. The Dzungars extracted 700 taels of gold, and also extracted cotton, copper, and cloth, from the six regions of Keriya, Kashgar, Khotan, Kucha, Yarkand, and Aksu as stated by Russian topographer Yakoff Filisoff. The Dzungars extracted over 50% of the wheat harvests of Muslims according to Qi-yi-shi (Chun Yuan), 30-40% of the wheat harvests of Muslims according to the Xiyu tuzhi, which labelled the tax as "plunder" of the Muslims. The Dzungars also extorted extra taxes on cotton, silver, gold, and traded goods from the Muslims besides making them pay the official tax. "Wine, meat, and women" and "a parting gift" were forcibly extracted from the Uighurs daily by the Dzungars who went to physically gather the taxes from the Uighur Muslims, and if they dissatisfied with what they received, they would rape women, and loot and steal property and livestock. Gold necklaces, diamonds, pearls, and precious stones from India were extracted from the Uighurs under Dāniyāl Khoja by Tsewang Rabtan when his daughter was getting married.
67,000 patman (each patman is 4 piculs and 5 pecks) of grain 48,000 silver ounces were forced to be paid yearly by Kashgar to the Dzungars and cash was also paid by the rest of the cities to the Dzungars. Trade, milling, and distilling taxes, corvée labor,saffron, cotton, and grain were also extracted by the Dzungars from the Tarim Basin. Every harvest season, women and food had to be provided to Dzungars when they came to extract the taxes from them.
When the Dzungars levied the traditional nomadic Alban poll tax upon the Muslims of Altishahr, the Muslims viewed it as the payment of jizyah (a tax traditionally taken from non-Muslims by Muslim conquerors).
Uighurs known as tariyachin were enslaved and were involuntarily moved to Ili and other parts of Dzungaria to engage in agricultural work on farms by the Dzungars, and the Dzungars heavily punished Muslims who tried to run away, viewing the Uighurs as inferiors. The Dzungars forced Turkic Muslim farmers who became their prisoners to move from southern Xinjiang (Altishahr) to northern Xinjiang (Dzungaria) to work on farms in Ili so that the Dzungars could benefit from the food grown at the farms.
Labor of all sorts and high taxes were imposed on the Uighurs moved to Ili. The Uighur merchants (Boderge) played crucial roles in commerce as middlemen between foreigners and Dzungar nobility but even then the Dzungars viewed them as inferior and "as slaves". It was said by Qianlong, "During the heyday of the Dzungars, they [the Uighurs] were made to work like slaves, forced to abandon their former dwellings to come to Ili and made to rechannel the water to plant paddy. They served and paid taxes without daring to slacken. For years they have been harbouring hatred!"
It was mostly the Dzungar elite such as nobles, lamas, and officials who benefited from their looting of other peoples, eating well and being clothed well with spectacular temples being built, while the ordinary Dzungar herdsmen remained in poverty. It was a system of "racial and class oppression" by the Dzungars upon the common Uighurs, which led to Uighur opposition against Dzungar rule.
The Qing defeat of the Dzungars went hand in hand with the anti-Dzungar resistance of the ordinary Uighurs, "many of them, unable to bear their misery, which was like living in a sea of fire, fled but were not able to find a place to settle peacefully." The Uighurs carried out "acts of resistance" like hiding the goods which were collected as taxes or violently resisting the Dzungar Oirat tax collectors, but these incidents were infrequent and widespread anti-Dzungar opposition failed to materialize. Many opponents of Dzungar rule like Uighurs and some dissident Dzungars escaped and defected to Qing China during 1737-1754 and provided the Qing with intelligence on the Dzungars and voiced their grievances. ʿAbdu l-Lāh Tarkhān Beg and his Hami Uighurs defected and submitted to Qing China after the Qing inflicted a devastating defeat at the battle of Jao Modo on the Dzungar leader Galdan in September 1696.
The Uighur leader Emin Khoja (Amīn Khoja) of Turfan revolted against the Dzungars in 1720 while the Dzungars under Tsewang Rabtan were being attacked by the Qing, and then he also defected and submitted to the Qing. The Uighurs in Kashgar under Yūsuf and his older brother Jahān Khoja of Yarkand revolted in 1754 against the Dzungars, but Jahān was taken prisoner by the Dzungars after he was betrayed by the Uch-Turfan Uighur Xiboke Khoja and Aksu Uighur Ayyūb Khoja. Kashgar and Yarkand were assaulted by 7,000 Khotan Uighurs under Sādiq, the son of Jahān Khoja. The Uighurs supported the 1755 Qing assault against the Dzungars in Ili, which occurred at the same time as the Uighur revolts against the Dzungars. Uighurs like Emin Khoja, 'ʿAbdu l-Mu'min and Yūsuf Beg supported the Qing attack against Dawachi, the Dzungar Khan. The Uch-Turfan Uighur Beg Khojis (Huojisi) supported the Qing General Ban-di against in tricking Davachi and taking him prisoner. The Qing and Amin Khoja and his sons worked together to defeat the Dzungars under Amursana.
From the 17th century to the middle of the 18th century, between China proper and Transoxania, all the land was under the sway of the Dzungars. In Semirechye the Kyrgyz and Kazakahs were forcibly driven out by the Dzungars and the Kashgar Khanate was conquered. However, the Dzungar Empire was annihilated by Qing China from 1755-1758 in a formidable assault, ending the Central Asian states danger from the Dzungar menace.