Dungan Revolt (1862–1877)

The Dungan Revolt (1862–1877), also known as the Tongzhi Hui Revolt (, Xiao'erjing: تُ‌جِ خُوِ لُوًا, Тунҗы Хуэй Луан) or Hui (Muslim) Minorities War, was a war fought in 19th-century western China, mostly during the reign of the Tongzhi Emperor (r. 1861–1875) of the Qing dynasty. The term sometimes includes the Panthay Rebellion in Yunnan, which occurred during the same period. However, this article refers specifically to two waves of uprising by various Chinese Muslims, mostly Hui people, in Shaanxi, Gansu and Ningxia provinces in the first wave, and then in Xinjiang in the second wave, between 1862 and 1877. The uprising was eventually suppressed by Qing forces led by Zuo Zongtang.

The conflict began with riots by the Hui and massacres of the Han Chinese, followed by the revenge massacres of the Hui by the Han. It resulted in massive demographic shifts in Northwest China, and led to a population loss of 21 million people from a combination of massacres, migration, famine, and corpse-transmitted plague. Due to the conflict, Gansu lost 74.5% (14.55 million) of its population, Shaanxi lost 44.6% (6.2 million) of its population, and Northern Xinjiang lost 72.6% (0.34 million) of its population. The population reduction of Hui in Shaanxi was particularly severe. According to research by modern historians, at least 4 million Hui were in Shaanxi before the revolt, but only 20,000 remained in the province afterwards, with most of the Hui either killed in massacres and reprisals by government and militia forces, or deported out of the province. For example, on one occasion where 700,000 to 800,000 Hui from Shaanxi were deported to Gansu, most were killed along the way from thirst, starvation, and massacres by the militia escorting them, with only a few thousand surviving. Large numbers of Han people were also relocated to Inner Mongolia after the war. Modern Ningxia and eastern Qinghai regions such as Xining, Hualong and Xunhua used to be a part of Gansu province before the 20th century.

Harsh punishments were meted out against Hui in Shaanxi by Manchus over communal disputes at this time since they regarded Hui as the aggressors. The Qing governor of Shaanxi put all the blame of the rebellion on the Shaanxi Hui and said the Gansu Hui were not to blame and were forced to join the rebellion and that they had good relations with Han unlike Shaanxi Hui who he accused of committing massacres so he told Gansu officials Shaanxi would not let deported Shaanxi Hui in Gansu back in. Officials in Shaanxi wanted military force to be used against Hui rebels while officials in Gansu wanted leniency for Hui rebels. Han Nian rebels worked with the Shaanxi Hui rebels until general Zuo Zongtang defeated the Nian in the province by 1868 and the Hui rebels in Shaanxi fled to Gansu in 1869. The Hunan Army was extensively infiltrated by the anti Qing, Han Gelaohui secret society, who started several mutinies during the Dungan Revolt, delaying crucial offensives. Zuo put down the mutinies and executed those involved. Hubei Gelaohui soldiers mutinied in Suide in Zuo Zongtang's army in 1867. The Han Gelaohui had infiltrated the Qing military in Xinjiang during the Dungan Revolt (1895–1896) and allegedly planned to help the Hui rebels before the Hui rebels were crushed.

The conflict initially erupted on the western bank of the Yellow River in Shaanxi, Gansu and Ningxia, excluding Xinjiang Province. A chaotic affair, it often involved diverse warring bands and military leaders with no common cause or a single specific goal. A common misconception is that the revolt was directed against the Qing dynasty, but evidence does not show that the rebels intended to overthrow the Qing government or attack the capital of Beijing. Instead it indicates that the rebels wished to exact revenge on personal enemies for injustices. In the aftermath of the conflict, mass emigration of the Dungan people from Ili to Imperial Russia ensued.

Nomenclature
In this article "Dungan people" refers to Hui people, who are a predominantly Muslim, Chinese-speaking ethnic group in China. They are sometimes called "Chinese Muslims" and should not be confused with the "Turkestanis" or "Turkic" people mentioned, who are Uyghurs, Kazakhs, Kyrgyzes, Tatars and Uzbeks amongst others.

Anachronisms
The ethnic group now known as Uyghur people was not known by that name before the 20th century. In prior times, the Uyghurs of the Tarim Basin were known as "Turki". Uyghur immigrants from the Tarim Basin to Ili were called "Taranchi". The modern name "Uyghur" was assigned to this ethnic group by the Soviet Union in 1921 at a conference in Tashkent, with the name "Uyghur" being derived from the old Uyghur Khaganate. As a result, sources from the period of the Dungan Revolt make no mention of Uyghurs.

Although "Hui" was (and can still be) a Chinese name broadly referring to Muslim people, the term refers specifically to the community of Chinese-speaking Muslims in China, who share many cultural similarities with the Han. Europeans commonly referred to these people as "Dungan" or "Tungan" during the Dungan Revolt.

The people referred to as "Andijanis" or "Kokandis" include the subjects of the Kokand Khanate—Uzbeks, Sarts, Southern Kyrgyzes, Ferghana Kipchaks and Tajiks. The Kokand army was predominantly formed from Uzbeks and the nomadic Kyrgyz and Kipchaks.

Background
The Dungan Revolt occurred partly because of ethnic antagonism and class warfare, not only because of religious strife (as is sometimes mistakenly assumed).

Chinese Muslims played a major role in resisting the early Qing dynasty in the wake of its victory over the Ming. For example, in 1646, Muslim Ming loyalists in Gansu led by Milayin and Ding Guodong organized a revolt in 1646, aiming to drive the Qing out and restore as emperor the Ming Prince of Yanchang, Zhu Shichuan. The Muslim Ming loyalists were supported by Sa'id Baba, the Sultan of Hami, and the Sultan's son Prince Turumtay. Additionally, Han Chinese and Tibetans joined the Muslim Ming loyalists in the revolt. After fierce fighting and negotiations, a peace agreement was formulated in 1649. Milayin and Ding nominally pledged allegiance to the Qing, and they were given ranks as members of the Qing military. However, when the Qing withdrew their forces from Gansu to fight resurgent Ming loyalists in southern China, Milayin and Ding once again took up arms and rebelled with the support of Turumtay against the Qing. They were ultimately crushed by the Qing and 100,000 of them—including Milayin, Ding Guodong, and Turumtay—were killed in battle. Additionally, the Confucian Hui Muslim scholar Ma Zhu (1640–1710) served with the southern Ming loyalists against the Qing.

During the Qianlong era (1735–1796), scholar Wei Shu commented on Jiang Tong's  essay Xironglun, stating that if the Muslims did not migrate, they would end up like the Five Hu, who overthrew the Western Jin and caused an ethnic conflict to break out between the Five Hu and the Han Chinese. During the Qianlong Emperor's reign, there were clashes between the Qing authorities and the Jahriyya Sufi sect, but not with the majority non-Sufi Sunnis or the Khafiyya Sufis.

Chinese Muslims had traveled to West Asia for many years prior to the Hui Minorities' War. In the 18th century several prominent Muslim clerics from Gansu studied in Mecca and Yemen under Naqshbandi Sufi teachers. Two different forms of Sufism were brought back to northwest China by two charismatic Hui sheikhs: Khufiyya, associated with Ma Laichi (1681–1766), and the more radical Jahriyya, founded by Ma Mingxin (1719?–1781). These coexisted with the more traditional, non-Sufi Sunni practices, centered around local mosques and known as gedimu (qadim, or ). The Khufiyya school and non-Sufi gedimu tradition—both tolerated by Qing authorities—were referred to as "Old Teaching", while Jahriyya, viewed by authorities as suspect, became known as the "New Teaching".

Disagreements between adherents of Khufiyya and Jahriya, as well as perceived mismanagement, corruption and the anti-Sufi attitudes of Qing officials, resulted in uprisings by Hui and Salar followers of the New Teaching in 1781 and 1783, but these were promptly suppressed. Hostilities between different groups of Sufis contributed to the violent atmosphere before the Dungan Revolt between 1862 and 1877.

In the Jahriyya revolt sectarian violence between two suborders of the Naqshbandi Sufis, the Jahriyya Sufi Muslims and their rivals, the Khafiyya Sufi Muslims, led to a Jahriyya Sufi Muslim revolt which the Qing dynasty in China crushed with the help of the Khafiyya Sufi Muslims.

Course of the revolt


As Taiping troops approached southeastern Shaanxi in the spring of 1862, the local Han Chinese, encouraged by the Qing government, formed Yong Ying militias to defend the region against the attackers. Afraid of the now-armed Han, the Muslims formed their own militia units as a response.

According to some historians, the Dungan Revolt began in 1862, not as a planned uprising but as a succession of local brawls and riots triggered by trivial causes. There were also rumors—false, as it turned out—spread that the Hui Muslims were aiding the Taiping Rebels. It was also said that the Hui Ma Hsiao-shih claimed that the Shaanxi Muslim revolt was connected to the Taiping.

Many Green Standard Army troops of the Imperial army were Hui. According to some historians, one of the incidents which led to the revolt was caused by a fight over the price of bamboo poles that a Han merchant was selling to a Hui. After this fight, Hui mobs attacked the Han and other Hui people who had not joined them in revolt. It was this seemingly trivial and unimportant dispute over bamboo poles that set off the full-scale revolt. However, according to historical records from the era, bamboo poles were bought in large quantities by the Hui to make spears as weaponry. Moreover, there had already been attacks on Han counties prior to the Shengshan bamboo incident. Historical records from the era show that prior to the conflict over the price of bamboo poles, there had already been plans among the Hui community to set up an Islamic State in the west of China. Organized through mosques and mullahs, the Hui people in Shaanxi started purchasing bamboo poles in large volumes. These poles were then used to make spears. Before the Shengshan bamboo incident, there had already been attacks on Han in Dali county and Weinan county. Fearing persecution, the Shaanxi Han populace fled the Hui or hid underground in cellars.

Given the low prestige of the Qing dynasty and its armies being occupied elsewhere, the revolt that began in the spring of 1862 in the Wei River valley spread rapidly throughout southeastern Shaanxi. By late June 1862, organized Muslim bands laid siege to Xi'an, which was not relieved by Qing general (sometimes written To-lung-a) until the fall of 1863. Dorongga was a Manchu bannerman in command of the army in Hunan. His forces defeated the Muslim rebels and completely destroyed their position in Shaanxi province, driving them out of the province to Gansu. Dorangga was later killed in action in March 1864 by Taiping rebels in Shaanxi.

The Governor-general of the region, En-lin, advised the Imperial government not to alienate Muslims. He officially made it clear that there was to be no mistreatment of or discrimination against Muslims, resulting in the implementation of a "policy of reconciliation". Muslim rebels tried to seize Lingzhou (present-day Lingwu) and Guyuan in several attacks as a result of false rumors spread by some Muslims that the government was going to kill all Muslims.

A vast number of Muslim refugees from Shaanxi fled to Gansu. Some of them formed the "Eighteen Great Battalions" in eastern Gansu, intending to fight their way back to their homes in Shaanxi. While the Hui rebels were preparing to attack Gansu and Shaanxi, Yaqub Beg, who had fled from Kokand Khanate in 1865 or 1866 after losing Tashkent to the Russians, declared himself ruler of Kashgar and soon managed to take complete control of Tarim Basin in Xinjiang. In 1867 the Qing government sent one of its most capable commanders, General Zuo Zongtang—who had been instrumental in putting down the Taiping Rebellion—to Shaanxi. Zuo's approach was to pacify the region by promoting agriculture, especially the growing of cotton and grain, as well as supporting orthodox Confucian education. Due to the region's extreme poverty, Zuo had to rely on financial support from outside Northwestern China.

Zuo Zongtang called on the government to "support the armies in the northwest with the resources of the southeast", and arranged the finances of his planned expedition to conquer Gansu by obtaining loans worth millions of taels from foreign banks in the southeastern provinces. The loans from the banks would be paid back by fees and taxes levied by Chinese authorities on goods imported through their ports. Zuo also arranged for massive amounts of supplies to be available before he would go on the offensive. Ten thousand of the old Hunan Army troops commanded by General Zeng Guofan, were dispatched by him under Gen. Liu Songshan to Shaanxi to help General Zuo, who had already raised a 55,000-man army in Hunan before he began the final push to reconquer Gansu from the Dungan rebels. They participated along with other regional armies (the Sichuan, Anhui and Henan Armies also joined the battle).



Zuo's forces consisted of the Hunan, Sichuan, Anhui and Henan Armies, along with thousands of cavalry. The Hunan soldiers were expert marksmen and excelled in battlefield maneuvers under the command of Gen. Liu Songshan. Western military drill was experimented with, but Zuo decided to abandon it. The troops practiced "twice a day for ten days" with their western made guns.

The Lanzhou Arsenal was established in 1872 by Zuo Zongtang during the revolt and staffed by Cantonese. The Cantonese officer in charge of the arsenal was Lai Ch'ang, who was skilled at artillery. The facility manufactured "steel rifle-barreled breechloaders" and provided munitions for artillery and guns. The Muslim Jahriyya leader Ma Hualong controlled a massive Muslim trading network with many traders, having control over trade routes to multiple cities over various kinds of terrain. He monopolized trade in the area and used his wealth to purchase guns. Zuo Zongtang became suspicious of Ma's intentions, thinking that he wanted to seize control over the whole of Mongolia. Liu Songshan died in combat during an offensive against the hundreds of rebel forts protected by difficult terrain. Liu Jintang, his nephew, took over his command whereupon a temporary lull in the offensive set in. After suppressing the revolt in Shaanxi and building up enough grain reserves to feed his army, Zuo attacked Ma Hualong. General Liu Jintang led the siege, bombarding the town over its walls with shells. The people of the town had to cannibalize dead bodies and eat grass roots to survive. Zuo's troops reached Ma's stronghold, Jinjibao in what was then north-eastern Gansu in September 1870, bringing Krupp siege guns with him. Zuo and Lai Ch'ang themselves directed the artillery fire against the city. Mines were also utilized. After a sixteen-month siege, Ma Hualong was forced to surrender in January 1871. Zuo sentenced Ma and over eighty of his officials to death by slicing. Thousands of Muslims were exiled to other parts of China.

Zuo's next target was Hezhou (now known as Linxia), the main center of the Hui people west of Lanzhou and a key point on the trade route between Gansu and Tibet. Hezhou was defended by the Hui forces of Ma Zhan'ao. As a pragmatic member of the Khafiya (Old Teaching) sect, he was ready to explore avenues for peaceful coexistence with the Qing government. When the revolt broke out, Ma Zhan'ao escorted Han Chinese to safety in Yixin, and did not attempt to conquer more territory during the revolt. After successfully repulsing Zuo Zongtang's initial assault in 1872 and inflicting heavy losses on Zuo's army, Ma Zhan'ao offered to surrender his stronghold to the Qing, and provide assistance to the dynasty for the duration of the war. He managed to preserve his Dungan community with his diplomatic skill. While Zuo Zongtang pacified other areas by exiling the local Muslims (with the policy of "washing off the Muslims"  approach that had been long advocated by some officials), in Hezhou, the non-Muslim Han were the ones Zuo chose to relocate as a reward for Ma Zhan'ao and his Muslim troops helping the Qing crush Muslim rebels. Hezhou (Linxia) remains heavily Muslim to this day, achieving the status of Linxia Hui Autonomous Prefecture under the PRC. Other Dungan generals including Ma Qianling and Ma Haiyan also defected to the Qing side along with Ma Zhan'ao. Ma's son Ma Anliang also defected, and their Dungan forces assisted Zuo Zongtang's Qing forces in crushing the rebel dungans. Dong Fuxiang also defected to the Qing. He was in no sense a fanatical Muslim or even interested in revolt, he merely gained support during the chaos and fought, just as many others did. He joined the Qing army of Zuo Zongtang in exchange for a Mandarinate. He acquired estates which were large.

Reinforced by the Dungan people of Hezhou, Zuo Zongtang planned to advance westward along the Hexi Corridor toward Xinjiang. However, he felt it necessary to first secure his left flank by taking Xining, which not only had a large Muslim community of its own, but also sheltered many of the refugees from Shaanxi. Xining fell after a three-month siege in late 1872. Its commander Ma Guiyuan was captured, and defenders were killed in the thousands. The Muslim population of Xining was spared but the Shaanxi refugees sheltering there were resettled to arable land in eastern and southern Gansu, which were isolated from other Muslim areas.



Despite repeated offers of amnesty, many Muslims continued to resist at Suzhou (Jiuquan), their last stronghold in the Hexi Corridor in west Gansu. The city was under the command of Ma Wenlu, who was originally from Xining. Many Hui people who had retreated from Shaanxi were also in the city. After securing his supply lines, Zuo Zongtang laid siege to Suzhou in September 1873 with 15,000 troops. The fortress could not withstand Zuo's siege guns and the city fell on October24. Zuo had 7,000 Hui people executed and resettled the rest in southern Gansu, to ensure that the entire Gansu Corridor from Lanzhou to Dunhuang would remain Hui-free, thereby preventing the possibility of future collusion between the Muslims of Gansu and Shaanxi and those of Xinjiang. Han and Hui loyal to the Qing seized the land of Hui rebels in Shaanxi, so the Shannxi Hui were resettled in Zhanjiachuan in Gansu.

The escape of Han people from Hezhou during the revolt was assisted by Ma Zhan'ao.

Confusion
The rebels were disorganized and without a common purpose. Some Han Chinese rebelled against the Qing state during the revolt, and rebel bands fought each other. The main Hui rebel leader, Ma Hualong, was even granted a military rank and title during the revolt by the Qing dynasty. Only later, when Zuo Zongtang launched his campaign to pacify the region, did he decide which rebels who surrendered were going to be executed, or spared.

The title Chaoqing in 1865 was granted by Mutushan, a Qing General to Ma Hualong after he officially submitted to the Qing but it was deemed as false by Zuo Zongtang.

Zuo Zongtang generally massacred New Teaching Jahriyya rebels, even if they surrendered, but spared Old Teaching Khafiya and Sunni Gedimu rebels. Ma Hualong belonged to the New Teaching school of thought, and Zuo executed him, while Hui generals belonging to the Old Teaching clique such as Ma Qianling, Ma Zhan'ao and Ma Anliang were granted amnesty and even promoted in the Qing military. Moreover, an army of Han Chinese rebels led by Dong Fuxiang surrendered and joined Zuo Zongtang. General Zuo accepted the surrender of Hui people belonging to the Old Teaching school, provided they surrendered large amounts of military equipment and supplies, and accepted relocation. He refused to accept the surrender of New Teaching Muslims who still believed in its tenets, since the Qing classified them as a dangerous heterodox cult, similar to the White Lotus Buddhists. Zuo said, "The only distinction is between the innocent and rebellious, there is none between Han and Hui".

The Qing authorities decreed that the Hui rebels who had taken part in violent attacks were merely heretics and not representative of the entire Hui population, just as the heretical White Lotus did not represent all Buddhists. Qing authorities decreed that there were two different Muslim sects, the "old" religion and "new" religion. The new were heretics and deviated from Islam in the same way that the White Lotus deviated from Buddhism and Daoism, and stated its intention to inform the Hui community that it was aware that the original Islamic religion was one united sect before the advent of new "heretics", saying they would separate Muslim rebels by which sect they belonged to.

Nature of the revolt
During the revolt, some Hui people fought for the Qing against the rebels from the beginning. A reward was bestowed upon Wang Dagui, a pro-Qing Muslim Hui leader who fought against Hui rebels. The relatives of Wang Dagui and Wang himself were then slaughtered by other anti-Qing Hui rebels In addition, the Hui Chinese rebel leaders never called for Jihad, and never claimed that they wanted to establish an Islamic state. This stood in contrast to the Xinjiang Turki Muslims who called for Jihad. Instead of overthrowing the government, the rebels wanted to exact revenge from local corrupt officials and others who had done them injustices.

When Ma Hualong originally negotiated with the Qing authorities in 1866, he agreed to a "surrender", giving up thousands of foreign weapons, spears, swords, and 26 cannons. Ma assumed a new name signifying loyalty to the Dynasty, Ma Chaoqing. Mutushan, the Manchu official, hoped that this would lead to other Muslims following his lead and surrendering, however, Ma Hualong's surrender had no effect and the revolt continued to spread. Even after Ma Hualong was sentenced to death, Zuo canceled the execution when Ma surrendered for the second time in 1871, surrendering all his weapons, such as cannons, gingalls, shotguns, and western weapons. Zuo also ordered him to convince other leaders to surrender. Zuo then discovered a hidden cache of 1,200 western weapons in Ma Hualong's headquarters in Jinjipao, and Ma failed to persuade the others to surrender. Thereafter Ma along with male members of his family and many of his officers were killed. Zuo then stated that he would accept the surrender of New Teaching Muslims who admitted that they were deceived, radicalized, and misled by its doctrines. Zuo excluded khalifas and mullas from the surrender.

Zuo Zongtang was made Governor general of Shaanxi and Gansu in 1866.

Ma Zhanao and his son Ma Anliang defected to the Qing during the Dungan rebellion. As noted in the previous sections, Zuo relocated Han Chinese from Hezhou as a reward for the Hui leader Ma Zhan'ao after he and his followers surrendered and joined the Qing to crush the rebels. Zuo also moved Shaanxi Muslim refugees from Hezhou, only allowing native Gansu Muslims to stay behind. Ma Zhanao and his Hui forces were then recruited into the Green Standard Army of the Qing military.

Hui Muslims in non-rebellious areas
Hui Muslims living in areas that did not take part in the revolt were completely unaffected by it, with no restrictions placed on them, nor did they try to join the rebels. Professor Hugh D. R. Baker stated in his book Hong Kong Images: People and Animals, that the Hui Muslim population of Beijing remained unaffected by the Muslim rebels during the Dungan Revolt. Elisabeth Allès wrote that the relationship between Hui Muslim and Han peoples continued normally in the Henan area, with no ramifications or interagency from the Muslim revolts of other areas. Allès wrote in the document Notes on some joking relationships between Hui and Han villages in Henan published by the French Center for Research on Contemporary China that "The major Muslim revolts in the middle of the nineteenth century which involved the Hui in Shaanxi, Gansu and Yunnan, as well as the Uyghurs in Xinjiang, do not seem to have had any direct effect on this region of the central plain." Hui Muslim officer and official Ma Xinyi served the Qing dynasty during the Dungan Revolt.

Since the Shaanxi Hui rebels, in general, were not joined by the Hui in Xi'an which remained under Qing government control, the Hui of Xi'an were spared from the war by the Qing government, and from the fighting and remained in Xi'an after the war. Xi'an's walls withstood a rebel siege for two year in 1870 and 1871 and did not fall.

During the Panthay Revolt, peace negotiations were held by Zhejiang and Sichuan Hui Muslims who were invited by the Qing to Yunnan in 1858 and they were not involved in the revolt. The Qing dynasty did not massacre Muslims who surrendered, the Muslim General Ma Rulong, who surrendered and join the Qing campaign to crush the rebel Muslims, was promoted, and among Yunnan's military officers serving the Qing, he was the strongest. The Qing armies left alone Muslims who did not revolt like in Yunnan's northeast prefecture of Zhaotong where there was a big Muslim population density after the war.

Hui loyalists and Han both took over the land of the Shaanxi Hui who moved to Gansu and were relocated by General Zuo Zongtang to Zhangjiachuan after the war ended.

Pre-revolt situation
By the 1860s, Xinjiang had been under Qing rule for a century. The area had been conquered in 1759 from the Dzungar Khanate whose core population, the Oirats, subsequently became the targets of genocide. However, as Xinjiang consisted mostly of semi-arid or desert lands, these were not attractive to potential Han settlers except some traders, so other people such as Uyghurs settled in the area. The whole of Xinjiang was divided into three administrative circuits:
 * The North-of-Tianshan Circuit, including the Ili basin and Dzungaria. This region roughly corresponds to the modern Ili Kazakh Autonomous Prefecture and included prefectures it controlled along with a few smaller adjacent prefectures.
 * The South-of-Tianshan Circuit . This included the "Eight cities" in turn comprising the "Four Western Cities" of Khotan, Yarkand, Yangihissar, Kashgar and the "Four Eastern Cities" (Ush, Aqsu, Kucha, Karashahr).
 * The Eastern Circuit, in eastern Xinjiang, centered around Urumqi.

Overall military command of all three circuits fell to the General of Ili, stationed in Huiyuan Cheng. He was also in charge of the civilian administration (directly in the North-of-Tianshan Circuit, and via local Muslim (Uyghur) begs in the South Circuit). However, the Eastern Circuit was subordinated in matters of civilian administration to Gansu Province.

In 1765 the Ush rebellion occurred in Ush Turfan. The rebellion was the result of severe misrule and exploitation by the Qing in the early years after the occupation of Xinjiang in 1759. After the conquest local Uyghur officials appointed by the Qing including ‘Abd Allah, the Hakim Beg of Ush Turfan, used their positions to extort money from the local Uyghur population. One of the Uyghur legends of the seven maidens comes from this rebellion of Uyghur girls resisting rape by Manchus. Manchus are explicitly blamed while Han Chinese are not mention by Uyghurs as the culprit in the legend. There is also another Uyghur legend about the seven maidens from the Qarakhanid wars against Buddhist kingdoms like Qocho that is unrelated to the one about Uyghur girls resisting Manchu rape.

As a result, in 1765 when Manchu official Sucheng commandeered 240 men to take official gifts to Peking, the enslaved porters and the townspeople revolted. The Uyghur collaborator ‘Abd Allah, Sucheng, the garrisoned Qing Manchu banner force and other Qing Manchu officials were slaughtered and the rebels took command of the Qing fortress. In response to the revolt, the Qing brought a large force to the city and besieged the rebels in their compound for several months until they surrendered. The Manchu officials then cruelly retaliated against the Uyghur rebels by executing over 2,000 men and exiling some 8,000 women.

During the Afaqi Khoja revolts there were multiple incursions by Afaqi khojas from Kokand into Kashgaria, similar to those of Jahangir Khoja in the 1820s and Wali Khan in 1857, meant that the government had increased troop levels in Xinjiang to some 50,000. Both Manchu and Han units were stationed in the province with the latter, mainly recruited in Shaanxi and Gansu, having a heavily Hui (Dungan) component. A large part of the Qing army in Xinjiang was based in the Nine Forts of the Ili Region, but there were also forts with Qing garrisons in most other cities of Xinjiang.

Maintaining this army involved much higher costs than the taxation of the local economy could sustainably provide, and required subsidies from the central government. Such support became unfeasible by the 1850-60s due to the costs of suppressing the Taiping and other rebellions in the Chinese heartland. The Qing authorities in Xinjiang responded by raising taxes, introducing new ones, and selling official posts to the highest bidders (e.g. that of governor of Yarkand to Rustam Beg of Khotan for 2,000 yambus, and that of Kucha to Sa'id Beg for 1,500 yambus). The new officeholders would then proceed to recoup their investment by fleecing their subject populations.

Increasing tax burdens and corruption only added to the discontent amongst the Xinjiang people, who had long suffered both from the maladministration of Qing officials and their local beg subordinates and from the destructive invasions of the khojas. Qing soldiers in Xinjiang, however, were still not paid on time or properly equipped.

With the start of the revolt in Gansu and Shaanxi in 1862, rumors spread among the Hui (Dungans) of Xinjiang that the Qing authorities were preparing a wholesale preemptive slaughter of the Hui people in Xinjiang, or in a particular community. Opinions as to the veracity of these rumors vary: while the Tongzhi Emperor described them as "absurd" in his edict of September25, 1864, Muslim historians generally believe that massacres were indeed planned, if not by the imperial government then by various local authorities. Thus it was the Dungans who usually revolted in most Xinjiang towns, although the local Turkic people—Taranchis, Kyrgyzs, and Kazakhs—would usually quickly join the fray.

Multi-centric revolt
The first spark of revolt in Xinjiang proved small enough for the Qing authorities to easily extinguish it. On March17, 1863, some 200 Dungans from the village of Sandaohe (a few miles west of Suiding), supposedly provoked by a rumor of a preemptive Dungan massacre, attacked Tarchi ( now part of Huocheng County), one of the Nine Forts of the Ili Basin. The rebels seized weapons from the fort's armory and killed the soldiers of its garrison, but were soon defeated by government troops from other forts and were themselves slaughtered.

Revolt broke out again the following year—this time, almost simultaneously in all three Circuits of Xinjiang—on a scale that made its suppression beyond the capability of the authorities.

On the night of June3–4, 1864, the Dungans of Kucha, one of the cities south of Tianshan, rose up and were soon joined by the local Turkic people. The Han fort, which, unlike many other Xinjiang locations, was inside the town rather than outside it, fell within a few days. Government buildings were burnt and some 1000 Hans and 150 Mongols killed. As neither the Dungan nor Turkic leaders of the revolt had sufficient authority over the entire community to become commonly recognized as a leader, the rebels instead choose a person who had not participated in the revolt, but was known for his spiritual role: Rashidin (Rashīdīn) Khoja, a dervish and the custodian of the grave of his ancestor of saintly fame, Arshad-al-Din (? – 1364 or 65). Over the next three years, he sent military expeditions east and west in an attempt to bring the entire Tarim Basin under his control; however, his expansion plans were frustrated by Yaqub Beg.

Only three weeks after the events in Kucha, revolt broke out in the Eastern Circuit. The Dungan soldiers of the Ürümqi garrison rebelled on June26, 1864, soon after learning about the Kucha revolt. The two Dungan leaders were Tuo Ming (a.k.a. Tuo Delin), a New Teaching ahong from Gansu, and Suo Huanzhang, an officer who also had close ties to Hui religious leaders. Large parts of the city were destroyed, the tea warehouses burned, and the Manchu fortress besieged. The Ürümqi rebels then advanced westward through what is today Changji Hui Autonomous Prefecture, taking the cities of Manas (also known then as Suilai) on July17 (the Manchu fort there fell on September16) and Wusu (Qur Qarausu) on September29.

On October3, 1864, the Manchu fortress of Ürümqi also fell to the joint forces of Ürümqi and Kuchean rebels. In a pattern that was to repeat in other Han forts throughout the region, the Manchu commander, Pingžui, preferred to explode his gunpowder, killing himself and his family, rather than surrender.

After they learned of the Qing authorities' plan to disarm or kill them, the Dungan soldiers in Yarkand in Kashgaria rose up in the early hours of July26, 1864. Their first attack on the Manchu fort (which was outside of the walled Muslim city) failed, but it still cost the lives of 2,000 Qing soldiers and their families. In the morning, the Dungan soldiers entered the Muslim city, where some 7,000 Hans were forcibly converted to become Muslims or massacred. The Dungans being numerically few compared to the local Turkic Muslims, they picked a somewhat neutral party—one Ghulam Husayn, a religious man from a Kabul noble family—as the puppet padishah.

By the early fall of 1864, the Dungans of the Ili Basin in the Northern Circuit also rose up, encouraged by the success of Ürümqi rebels at Wusu and Manas, and worried by the prospects of preemptive repressions by the local Manchu authorities. The General of Ili, Cangcing, hated by the local population as a corrupt oppressor, was sacked by the Qing government after the defeat of his troops by the rebels at Wusu. Attempts by Mingsioi, Cangcing's replacement, to negotiate with the Dungans proved in vain. On November10, 1864, the Dungans rose both in Ningyuan (the "Taranchi Kuldja"), the commercial center of the region, and Huiyuan (the "Manchu Kuldja"), its military and administrative headquarters. Kulja's Taranchis (Turkic-speaking farmers who later formed part of the Uyghur people) joined in the revolt. When the local Muslim Kazakhs and Kyrgyzs felt that the rebels had gained the upper hand, they joined them. Conversely, the Buddhist Kalmyks, and Xibes mostly remained loyal to the Qing government.

Ningyuan immediately fell to the Dungan and Turki rebels, but a strong government force at Huiyuan made the insurgents retreat after 12 days of heavy fighting in the streets of the city. The local Han Chinese, seeing the Manchus winning, joined forces with them. However, a counter-offensive by Qing forces failed. The imperial troops lost their artillery while Mingsioi barely escaped capture. With the fall of Wusu and Aksu, the Qing garrison, entrenched in the Huiyuan fortress was completely cut off from the rest of empire-controlled territory forcing Mingsioi to send his communications to Beijing via Russia.

While the Qing forces in Huiyuan successfully repelled the next attack of the rebels on 12December 1864, the revolt continued to spread through the northern part of the province (Dzungaria), where the Kazakhs were glad to take revenge on the Kalmyk people that had ruled the area in the past.



For Chinese New Year 1865, the Hui leaders of Tacheng (Chuguchak) invited the local Qing authorities and Kalmyk nobles to assemble in the Hui mosque, to swear a mutual oath of peace. However, once the Manchus and Kalmyks were in the mosque, the Hui rebels seized the city armory, and started killing the Manchus. After two days of fighting, the Muslims gained control of the town, while the Manchus were besieged in the fortress. Nevertheless, with the help of the Kalmyks the Manchus were able to retake the Tacheng area by the fall of 1865. This time, it was the Hui rebels who were locked up in the mosque. The fighting resulted in the destruction of Tacheng and the surviving residents fleeing the town.

Both the Qing government in Beijing and the beleaguered Kulja officials asked the Russians for assistance against the rebels via the Russian envoy in Beijing, and the Russian commander in Semirechye,  respectively. The Russians, however, were diplomatically non-committal. On the one hand, as Vlangali wrote to Saint Petersburg, a "complete refusal" would be bad for Russia's relations with Beijing; on the other, Russian generals in Central Asia generally felt that providing China with serious assistance against Xinjiang's Muslims would do nothing to improve Russia's problems with its own new Muslim subjects. Were the revolt to succeed and lead to the creation of a permanent Hui state, having been on the Qing side of the former conflict would offer Russia no benefit in its relations with that new neighbor. The decision was thus made in Saint Petersburg in 1865 to avoid offering any serious help to the Qing, beyond agreeing to train Chinese soldiers in Siberia—should they send any—and to sell some grain to the defenders of Kuldja on credit. The main priority of the Russian government remained guarding its border with China and preventing any possibility of the spread of the revolt into Russia's own domain.

Considering that offense is the best form of defense, Kolpakovsky suggested to his superiors in February 1865 that Russia should go beyond defending its border and move in force into Xinjiang's border area then seize the Chuguchak, Kuldja and Kashgar areas. These could then be colonized with Russian settlers—all to better protect the Romanov empire's other domains. The time was not ripe for such an adventure, however: as Foreign Minister Gorchakov noted, such a breach of neutrality would be not a good thing if China eventually recovered its rebel provinces.

Meanwhile, Qing forces in the Ili Valley did not fare well. In April 1865, the Huining (惠宁) fortress (today's, located between Yining and Huiyuan), fell to the rebels after a three-month siege. Its 8,000 Manchu, Xibe, and Solon defenders were massacred, and two survivors with their ears and noses cut off were sent to Huiyuan—the Qing's last stronghold in the valley—to tell the Governor-general the fate of Huining.

Most of the Huiyuan (Manchu Kulja) fell to the rebels on January8, 1866. The majority of the residents and garrison perished along with some 700 rebels. Mingsioi, still holding out in the Huiyuan fortress with the remainder of his troops, but having run out of food, sent a delegation to the rebels, bearing a gift of 40 sycees of silver and four boxes of green tea, and offered to surrender, provided the rebels guaranteed their lives and allowed them to keep their allegiance to the Qing government. Twelve Manchu officials with their families left the citadel along with the delegation. The Huis and Taranchis received them and allowed the refugees from Huiyuan to settle in Yining ("the Old Kuldja"). However, the rebels would not accept Mingsioi's conditions, requiring instead that he surrender immediately and recognize the authority of the rebels. Since Mingsioi had rejected the rebels' proposal, they immediately stormed the citadel. On March3, the rebels having broken into the citadel, Mingsioi assembled his family and staff in his mansion, and blew it up, dying under its ruins. This was the temporary end, for the time being, of Qing rule in the Ili Valley.

Yaqub Beg in Kashgaria
As noted by Muslim sources, the Qing authorities in Kashgar had all along intended to eliminate local Dungans, and managed to carry out their preemptive massacre in the summer of 1864. This weakening of the local Dungan contingent was possibly the reason why the initial revolt had not been as successful in this area as in the rest of the province. Although the Dungan rebels were able to seize Yangihissar, neither they nor the Kyrgyzs of Siddiq Beg could break into either the Manchu forts outside Yangihissar and Kashgar, nor into the walled Muslim city of Kashgar itself, which was held by Qutluq Beg, a local Muslim appointee of the Qing.

Unable to take control of the region on their own, the Dungans and Kyrgyzs turned for help to Kokand's ruler Alim Quli. Assistance arrived in early 1865 in both spiritual and material form. Spiritual aid came in the person of Buzurg Khoja (also known as Buzurg Khan), a member of the influential Afaqis family of khojas, whose religious authority could be expected to raise the rebellious spirit of the populace. He was heir to a long family tradition of starting mischief in Kashgaria, being a son of Jahangir Khoja and brother of Wali Khan Khoja. Material assistance—as well as the expected conduit of Kokandian influence in Kashgaria—consisted of Yaqub Beg, a young but already well known Kokandian military commander, with an entourage of a few dozen Kokandian soldiers, who became known in Kashgaria as Andijanis.

Although Siddiq Beg's Kyrgyzs had already taken the Muslim town of Kashgar by the time Buzurg Khoja and Yaqub Beg arrived, he had to allow the popular khoja to settle in the former governor's residence (the urda). Siddiq's attempts to assert his dominance were crushed by Yaqub Beg's and Buzurg's forces. The Kyrgyzs then had to accept Yaqub's authority.

With his small, but comparatively well trained and disciplined army consisting of local Dungans and Kashgarian Turkic people (Uighurs, in modern terms), their Kyrgyz allies, Yaqub's own Kokandians, as well as some 200 soldiers sent by the ruler of Badakhshan, Yaqub Beg was able not only to take the Manchu fortress and the Han Chinese town of Kashgar during 1865 (the Manchu commander in Kashgar, as usual, blowing himself up), but to defeat a much larger force sent by the Rashidin of Kucha, who sought domination of the Tarim Basin region for himself.

While Yaqub Beg asserted his authority over Kashgaria, the situation back home in Kokand changed radically. In May 1865, Alim Quli lost his life while defending Tashkent against the Russians. Many of his soldiers (primarily, of Kyrgyz and Kipchak background) deemed it advisable to flee to the comparative safety of Kashgaria. They appeared at the borders of Yaqub Beg's domain in early September 1865. Afghan warriors also assisted Yaqub Beg. Yaqub Beg's rule was unpopular among the natives with one of the local Kashgaris, a warrior and a chieftain's son, commenting: "During the Chinese rule there was everything; there is nothing now." There was also a falling-off in trade.

The local Uyghurs of Altishahr came to view Yaqub Beg as a Kokandi foreigner and his Kokandi associates behaved ruthlessly to the local Uyghurs, an anti Yaqub Beg poem was written by the Uyghur:

From Peking the Chinese came, like stars in the heaven.

The Andijanis rose and fled, like pigs in the forest.

They came in vain and left in vain, the Andijanis!

They went away scared and languidly, the Andijanis!

Every day they took a virgin, and

They went hunting for beauties.

They played with the dancing boys,

Which the Holy Law has forbidden.

Yaqub Beg's Kashgaria declares Jihad against the Dungans
Taranchi Turkic Muslims in Xinjiang initially cooperated with the Dungans (Hui people) when they rose in revolt, but later abandoned them after the Hui attempted to subject the entire region to their rule. The Taranchi massacred the Dungans at Kuldja and drove the rest through the Talk pass to the Ili Valley. The Hui people in Xinjiang where neither trusted by the Qing authorities nor the Turkestani Muslims.

Yaqub Beg's Kokandi Andijani Uzbek forces declared a Jihad against Dungan rebels under T'o Ming (Tuo Ming a.k.a. Daud Khalifa). Fighting broke out between Dungan and Kokandi Uzbek rebels in Xinjiang. Yaqub Beg enlisted Han militia under Xu Xuegong to fight against the Dungan troops under T'o Ming. T'o Ming's Dungan forces were defeated at the Battle of Urumqi (1870) as part of Yaqub Beg's plan to conquer Dzungaria and seize all Dungan territory. Poems were written about the victories of Yaqub Beg's forces over the Hans and the Dungans. Yakub Beg seized Aksu from Dungan forces and forced them north of the Tian Shan, committing massacres upon the Dungan people (Tunganis). Independent Han Chinese militia who were not affiliated with the Qing government joined both the Turkic forces under Yaqub Beg, and the Dungan rebels. In 1870, Yaqub Beg had 1,500 Han Chinese troops with his Turkic forces attacking Dungans in Ürümqi. The following year, the Han Chinese militia joined the Dungans in fighting against Turkic forces.

Foreign relations of Kashgaria Yaqub Beg
Russia and Britain signed several treaties with Yaqub Beg's regime in Kashgar with Yaqub seeking to secure British and Russian aid for his government.

Relations with Russia
Relations between Yaqub Beg and the Russian Empire alternated between fighting and peaceful diplomatic exchanges.

The Russians detested the native population of Kashgar because of their elite's close contacts with the Kokand Khans who had recently been expelled during the Russian conquest of Turkestan. This animosity would have ruined Yaqub Beg had he sought extensive aid from them as he had originally intended.

Ottoman and British support
The Ottoman Empire and the British Empire both recognized Yaqub Beg's state and supplied him with thousands of guns. British diplomats Robert Barkley Shaw and Thomas Douglas Forsyth to Kashgar in 1868 and 1870 respectively, aroused British interest for Ya'qub's regime and the British concluded a commercial treaty with the emir in 1874.

Qing reconquest of Xinjiang
The Qing decided to reconquer Xinjiang in the late 1870s. Zuo Zongtang, previously a general in the Xiang Army, was the commander in chief of all Qing troops participating in this counterinsurgency. His subordinates were the Han Chinese General Liu Jintang and Manchu Jin Shun. As Zuo Zongtang moved into Xinjiang to crush the Muslim rebels under Yaqub Beg, he was joined by Dungan (Hui) General Ma Anliang and General Dong Fuxiang. Qing forces entered Ürümqi unopposed. Yaqub's subordinates defected to the Qing or fled as his forces started to fall apart, and the oasis fell easily to the Qing troops. The mass retreat of the rebel army shrank their sphere of control smaller and smaller. Yaqub Beg lost more than 20,000 men either though desertion or at the hands of the enemy. In October 1877, after the death of Yaqub Beg, Jin Shun resumed his forward movement and encountered no serious opposition. General Zuo appeared before the walls of Aksu, the bulwark of Kashgaria on the east, and its commandant abandoned his post at the first onset. Qing army then advanced on Uqturpan, which also surrendered without a blow. Early in December, all Qing troops began their last attack against the capital city of the Kashgarian regime. The rebel troops were defeated and the residual troops started to withdraw to Yarkant, whence they fled to Russian territory. With the fall of Kashgaria Qing's reconquest of Xinjiang was completed. No further revolt was encountered, and the reestablished Qing authorities began the task of recovery and reorganization, including the establishment of the Xinjiang province in 1884.

The use of Muslims in the Qing armies against the revolt was noted by Yang Zengxin.

The third reason is that at the time that Turkic Muslims were waging revolt in the early years of the Guangxu reign, the ‘five elite divisions’ that governor general Liu Jintang led out of the Pass were all Dungan troops [Hui dui 回队]. Back then, Dungan military commanders such as Cui Wei and Hua Dacai were surrendered troops who had been redeployed. These are undoubtedly cases of pawns who went on to achieve great merit. When Cen Shuying was in charge of military affairs in Yunnan, the Muslim troops and generals that he used included many rebels, and it was because of them that the Muslim revolt in Yunnan was pacified. These are examples to show that Muslim troops can be used effectively even while Muslim uprisings are still in progress. What is more, since the establishment of the Republic, Dungan have demonstrated not the slightest hint of errant behaviour to suggest that they may prove to be unreliable.

Xiang Army and other Han Chinese male soldiers and sojourners bought Turki Musulman (Uyghur) girls as wives from their parents after Zuo Zongtang's reconquest of Xinjiang, and the Han and Uyghurs often relied on Hui intermediaries to translate and broker the marriages. A Han Chinese man with the surname Li bought a young Uyghur woman from two Uyghur men who kidnapped her in 1880. They were employed by the magistrate of Pichan. A Turpan Uyghur girl named Ruo-zang-le who was 12 was sold for 30 taels in 1889 in Qitai to a young Han Chinese Shanxi man named Liu yun. She became pregnant with his child in 1892. Han Chinese men viewed the toyluq they paid in silver for their Uyghur brides as a bride price. Uyghur Muslim women married Han Chinese men in Xinjiang in the late 19th and early 20th centuries. Han Chinese men, Hindu men, Armenian men, Jewish men and Russian men were married by Uyghur Muslim women who could not find husbands. Uyghur merchants would harass Hindu usurers by screaming at them asking them if they ate beef or hanging cow skins on their quarters. Uyghur men also rioted and attacked Hindus for marrying Uyghur women in 1907 in Poskam and Yarkand like Ditta Ram calling for their beheading and stoning as they engaged in anti-Hindu violence. Hindu Indian usurers engaging in a religious procession led to violence against them by Muslim Uyghurs.

Punishment
When the Qing forces under Zuo Zongtang put down the Dungan Revolt, the sons of Muslim Hui and Salar rebel leaders like Ma Benyuan (马本源) and Ma Guiyuan (马桂源) in Ningxia, Gansu and Qinghai were castrated by the Qing Imperial Household Department once they became 11 years old and were sent to work as eunuch slaves for Qing garrisons in Xinjiang and the wives of the rebel leaders were also enslaved. Among the Muslim boys were Ma Sanhe (马三和), Ma Qishizi (马七十子), Ma Shaqiang (马沙枪), Ma Suo (马锁), Ma Youzong (马由宗), Ma Feifei (马飞飞), Ma Wushijiu (马五十九), Ma Wushiliu (马五十六). Ma Jincheng, a son of the Hui Naqshbandi leader Ma Hualong was also castrated. The Imperial Household Department immediately castrated the 9 sons of Ma Guiyuan since they already reached age 12 and were enslave as eunuchs to Qing soldiers in Xinjiang. Ma Zhenyuan (马侦源), Ma Benyuan (马本源) and Ma Guiyuan's (马桂源) wives were all enslaved to soldiers and officials in provincial garrisons after the husbands were executed. Ma Yulong (马玉龙) was the father of the boys Ma Sanhe (马三和) and Ma Jibang (继邦). Ma Dingbang (马定邦) was the father of Ma Qishi (马七十), Ma Shaba (马沙把), Ma Suo (马锁) and Ma Youzong (马由宗). Ma Chenglong (马成龙) was the father of Ma Feifei (马飞). Their sons were all sentenced to castration. The Muslim rebels themselves were subjected to execution by lingchi (slow slicing) while their sons were castrated and their female relatives enslaved to soldiers and officials in provincial garrisons. The children of the Muslim rebels who were under ten included 6 year old Ga Liu (尕六), 8 year old Ga Quan (尕全) and Ma Xier (马希儿) who were imprisoned until they reached 11 and then castrated by the Imperial Household Department.

Yaqub Beg and his son Ishana's corpses were "burned to cinders" in full public view. This angered the population in Kashgar, but Qing troops quashed a rebellious plot by Hakim Khan. Surviving members of Yaqub Beg's family included his four sons, four grandchildren (two grandsons and two granddaughters), and four wives. They either died in prison in Lanzhou, Gansu or were killed by the Qing government. His sons Yima Kuli, K'ati Kuli, Maiti Kuli, and grandson Aisan Ahung were the only survivors alive in 1879. They were all underage children at that time. They were put on trial and sentenced to an agonizing death if they were found to be complicit in their father's rebellious "sedition". If they were innocent, they were to be sentenced to castration and servitude as eunuch slaves to the Qing troops. Afterwards, when they reached the age of 11 years, they would be handed over to the Imperial Household to be executed or castrated. In 1879, it was confirmed that the sentence of castration was carried out, Yaqub Beg's son and grandsons were castrated by the Chinese court in 1879 and turned into eunuchs to work in the Imperial Palace. Yaqub Beg's sons and grandsons who were captured were under 10 years old Aisin Ahongju (爱散阿洪俱), Kadihuli (卡底胡里) and 10 year old Imahuli (依玛胡里).

Memorials
On January25, 1891, a temple was constructed by Liu Jintang. He had been one of the generals participating in the counterinsurgency against the Dungan Revolt and at that time he was the Governor of Gansu. The temple was built in the capital of Gansu as a memorial to the victims who died during the Dungan Revolt in Kashgaria and Dzungaria. The victims numbered 24,838 and included officials, peasants, and members of all social classes and ethnic groups. It was named Chun Yi Ci. Another temple was already built in honor of the Xiang Army soldiers who fought during the revolt.

Flight of the Dungans to the Russian Empire
The failure of the revolt led to the immigration of some Hui people into Imperial Russia. According to Rimsky-Korsakoff (1992), three separate groups of the Hui people fled to the Russian Empire across the Tian Shan during the exceptionally severe winter of 1877/78:
 * The first group of some 1000 people originally from Turpan in Xinjiang and led by Ma Daren (马大人), also known as Ma Da-lao-ye (马大老爷) reached Osh in southern Kyrgyzstan.
 * The second group of 1130 people originally from Didaozhou (狄道州) in Gansu led by ahong A Yelaoren (阿爷老人), were settled in the spring of 1878 in the village of Yardyk some 15 km from Karakol in Eastern Kyrgyzstan.
 * The third group, originally from Shaanxi and led by Bai Yanhu (白彦虎; also spelt Bo Yanhu; 1829(?)-1882), one of the leaders of the revolt, were settled in the village of Karakunuz (now Masanchi), in the modern Zhambyl Province of Kazakhstan. Masanchi is located on the northern (Kazakh) side of the Chu River, 8 km north of the city of Tokmak in north-western Kyrgyzstan. This group numbered 3314 on arrival.

Another wave of immigration followed in the early 1880s. In accordance with the terms of the Treaty of Saint Petersburg signed in February 1881, which required the withdrawal of the Russian troops from the Upper Ili Basin (the Kulja area), the Hui and Taranchi (Uighur) people of the region were allowed to opt for moving to the Russian side of the border. Most people choose that option and according to Russian statistics, 4,682 Hui moved to the Russian Empire under the treaty. They migrated in many small groups between 1881 and 1883, settling in the village of Sokuluk some 30 km west of Bishkek, as well as at a number of points between the Chinese border and Sokuluk, in south-eastern Kazakhstan and northern Kyrgyzstan.

The descendants of these rebels and refugees still live in Kyrgyzstan and neighboring parts of Russia, Kazakhstan, Tajikistan and Uzbekistan. They still call themselves the Hui people (Huizu), but to the outsiders they are known as Dungan, which means Eastern Gansu in Chinese.

After the Sino-Soviet split, Soviet propaganda writers such as Rais Abdulkhakovich Tuzmukhamedov called the Dungan Revolt (1862–1877) a "national liberation movement" for their political purposes.

Increase in Hui military power
The revolt increased the power of Hui Generals and military men in the Qing Empire. Many Hui Generals who served in the campaign were promoted by the Emperor, including Ma Anliang, and Dong Fuxiang. This led Hui armies to fight again in the Dungan Revolt (1895-1896) against the rebels, and in the Boxer Rebellion against Christian Western Armies. The Muslim Gansu braves and Boxers, attacked and killed Chinese Christians in revenge for foreign attacks on Chinese, and were the fiercest attackers during the siege of the legations from 20 June to 14 August 1900.

Dungan rebels were known to avoid attacking Christians and people took refuge in Christian churches. Some, therefore, attribute the mass increase of Catholics and Protestant population along the west bank of yellow river in Gansu and Shanxi to people who sought refuge in churches.

Ma Fuxiang, Ma Qi, and Ma Bufang were descendants of the Hui military men from this era, and they became important and high ranking Generals in the Republic of China National Revolutionary Army.

These pro-Qing Hui warlords rose to power by their fighting against Muslim rebels. The sons of the defected Muslim warlords of the Dungan Revolt (1862–1877) helped the Qing crush the Muslim rebels in the Dungan Revolt (1895–1896).

Border dispute with Russia
After General Zuo Zongtang and his Xiang Army crushed the rebels, they demanded Russia return the city of Kuldja in Xinjiang, which they had occupied. Zuo was outspoken in calling for war against Russia and hoped to settle the matter by attacking Russian forces in Xinjiang. In 1878, tensions in the area increased. Zuo massed Qing troops toward the Russian occupied Kuldja. Chinese forces also fired on Russian expeditionary forces originating from Yart Vernaic, expelling them, which resulted in a Russian retreat.

The Russians were in a very bad diplomatic and military position vis-a-vis China. Russia feared the threat of military conflict, which forced them into diplomatic negotiations instead.

Wanyan Chonghou was dispatched to Russia to negotiate a treaty, but despite China being in the stronger negotiating position, the resulting Treaty of Livadia was highly unfavorable to China; it granted Russia a portion of Ili, extraterritorial rights, consulates, control over trade, and an indemnity. Thereafter a massive uproar by the Chinese literati ensued and they demanded the government mobilize armed forces against Russia. The government acted after this, giving important posts to officers from the Xiang Army. Charles Gordon became an advisor to the Chinese.

Russia refused to renegotiate unless Chonghou's life was spared. Not wanting to accept the Livadia treaty and not interested in renewed fighting, China had no choice but to comply. Zeng Jize became the new negotiator and despite the outrage caused by the original terms, the resulting Treaty of Saint Petersburg only differed slightly: China retained control over almost all of Ili, but the indemnity payment was higher.

Western explorers
Ney Elias traveled through the area of the revolts.

Hui Muslims during the 1911 Xinhai revolution
During the Dungan Revolt, the Hui Muslims of Xi'an city (in Shaanxi province) did not rebel against the Qing and refused to join the rebels while the Hui Muslims of Gansu revolted under General Ma Zhan'ao and his son Ma Anliang revolted before defecting and surrendering to the Qing.

The Hui Muslim community was divided in its support for the 1911 Xinhai Revolution. The Hui Muslims of Xi'an in Shaanxi supported the revolutionaries and the Hui Muslims of Gansu supported the Qing. The native Hui Muslims (Mohammedans) of Xi'an (Shaanxi province) joined the Han Chinese revolutionaries in slaughtering the entire 20,000 Manchu population of Xi'an city. The native Hui Muslims of Gansu province led by general Ma Anliang sided with the Qing and prepared to attack the anti-Qing revolutionaries of Xi'an city. Only some wealthy Manchus who were ransomed and Manchu females survived. Wealthy Han Chinese seized Manchu girls to become their slaves and poor Han Chinese troops seized young Manchu women to be their wives. Young pretty Manchu girls were also seized by Hui Muslims of Xi'an during the massacre and brought up as Muslims.