The rulers of Qing dynasty (1644-1911) were Manchu. They themselves were a minority in China. During the early Qing dynasty (Emperor Kangxi, Yongzheng, Qianlong three dynasties), the state power was very prosperous.
The Qing rulers worshiped Buddhism and respected Taoism. In fact, when the Qing government came into the central plain of China, it took policies basing on Confucianism. With regard to the attitude towards Islam, it was more about prevention than trust.
The main policy of Qing rulers towards Islam and Muslims was suppress and with pacification as supplement. In the early Qing dynasty, it was mainly placatory, accompanied by restrictions. In the later period, it was mainly to crack down and suppress.
The Qing dynasty had a development process for the legislative policy of the Islam. After the Qing rulers entered the Shanhaiguan Pass, the Huang Taiji and Emperor Shunzhi adopted the policy of " temper justice with mercy" to the minority nationalities. This policy went on to become the basic principle of Qing dynasty dealing with ethnic issues.
The regime established in the early Qing dynasty was very unstable, and the main political action was to eliminate the rebellion in the central plains. In the fifth year of Shunzhi (1648), the Hui people in Gansu province rebelled against the Qing dynasty under the leadership of Milayin and Ding Guodong. After fierce fighting and negotiations, a peace agreement was achieved in 1649. Milayan and Ding nominally pledged alleigance to the Qing and were given ranks as members of the Qing military.
After the Qing army entered the Shanhaiguan Pass, the Islam rebellious activities from all over the country left a bad impression on the rulers. But as these protests were soon subsided, the Hui ethnic group did not pose too much threat to the Qing regime.
As a result, Emperor Kangxi was more moderate in his treatment of Hui and Islam, and he continued to reuse Hui generals to clear the rebellion and stabilize his regime. Emperor Kangxi did not believe that Islam was "bothersome".
Emperor Yongzheng inherited the principles and policies to the frontier ethnic group and took the same attitudes towards both Hui and Han people.
But at this time, among the Qing ministers, there was a prejudice against the Hui people. These ministers framed up the Hui people saying that Hui people attempted to overthrow the Qing government, hoping that the government can ban their religious beliefs.
Emperor Yongzheng not only refuted these, but also dealt with similar false accusations. Yongzheng also wrote the book of "the great sense of consciousness", elaborating the national equality, and also reflected his basic attitude towards the Hui nationality from the side.
Although both Emperor Kangxi and Yongzheng's attitude and policies towards the Hui minority and the policy were generous and tolerant, due to the special habits of Islam, many Qing government officials were biased and discriminated against the Hui people. In the private sector, this bias continued. In addition, the uprising staged by Hui people in the early Qing created a bad impression on the rulers. All these laid a foreshadowing for the later Qing dynasty’s severe punishment to the Muslims.
In the middle and later period of Qing dynasty, the Qing government began to prohibit and crack down on the "conspiratorial" activities in the name of religion.
In 1649, the Qing government achieved an agreement with Milayan and Ding Guodong and gave them high official rank. However, when other Ming loyalists in southern China made a resurgence and the Qing were forced to withdraw their forces from Gansu to fight them, Milayan and Ding once again took up arms and rebelled against the Qing. The Qing government was thoroughly provoked. Then Muslim Ming loyalists were crushed by the Qing with 100,000 of them, including Milayin, Ding Guodong, and Turumtay killed in battle.
From 1755–1757, the Qianlong Emperor was at war with the Zunghar Khanate in the northwest and finally conquered Dzungaria.
In 1781 and 1784, Hui and Salar followers of the Jahriya attempted uprisings in Gansu due to the disagreements between the adherents of Khafiya and Jahriya, two forms of Sufism as well as perceived mismanagement, corruption, and anti-Muslim attitudes of the Qing officials. But the Qing government suppressed them easily and promptly with the help of the Khafiya.
During 1820-1828, Kashgaria was able to be free of Qing's control because of the invasion by Jahangir Khoja who had invaded from Kokand. But the oases of Kashgar and Yarkand were recaptured by the Qing in 1828.
In the first half of the 19th century, the descendants of Khoja who were not willing to fail successively launched many revolts. The last of the Khoja revolts was in 1857 under Wali Khan, a self-indulgent debaucher, and the murderer of the famous German explorer, Adolf Schlagintweit. It is said that he was extremely cruel. He killed so many innocent Muslims that four or six minarets were built from the skulls of the victims (kala minara). His reign of tyranny made the local Muslims hate the Khoja instead of the Qing government. In 1759, the Qing army, with the strong support and cooperation of the people of all ethnic groups in Xinjiang, quelled the rebellion.
During the mid-nineteenth century, the Muslims revolted against the Qing dynasty, most notably in the Dungan revolt (1862–1877) and the Panthay rebellion 1856-1873) in Yunnan. One million people died in the Panthay rebellion, and several million died in the Dungan revolt.
During 1855-1873, the Panthay Rebellion took place in the southwestern province of Yunnan. For the most part of the war, the Muslims were led by Du Wenxiu (1823–1872), a Muslim from a family of Han Chinese origin which had converted to Islam. Du Wenxiu raised the banner of his revolt in the name of driving the Manchus out of China and establishing unity between Han and Hui. The insurgents took the city of Dali and declared the new nation of Pingnan Guo, meaning “the Pacified Southern Nation”. But the revolt ended in failure and Du Wenxiu committed suicide by taking poison on the way to the surrender of the Qing.
In 1862, the Dungan revolt broke out by the Hui from the provinces of Shaanxi, Gansu, Ningxia and Xinjiang. It lasted from 1862 to 1877. The most famous Muslim leader was Bai Yanhu. In 1864, general Zuo Zongtang in Qing government led the Qing army to suppress the revolt. Many Muslims like Ma Zhan'ao, Ma Anliang, Dong Fuxiang, Ma Qianling, and Ma Julung defected to the Qing dynasty side, and helped the Qing general Zuo Zongtang exterminate the Muslim rebels. These Muslim generals belonged to the Khafiya sect, and they helped Qing massacre Jahariyya rebels. General Zuo moved the Han around Hezhou out of the area and relocated them as a reward for the Muslims there helping Qing kill other Muslim rebels. Bai Yanhu failed in the revolt and finally fled to Russia. The failure of the revolt led to the flight of many Dungan people into Imperial Russia.
However, Muslims in other parts of China proper like in the east and southern provinces who did not revolt, were not affected at all by the rebellion, and experienced no genocide, nor did they seek to revolt. It was reported that Muslim villages in Henan province, which was next to Shaanxi, were totally unaffected and relations between Han and Hui continued normally. The Hui Muslim population of Beijing was unaffected by the Muslim rebels during the Dungan revolt.