The Dungan Revolt (1895-96) was a rebellion of various Muslim ethnic groups in Qinghai and Gansu against the Qing Dynasty, that originated because of a violent dispute between two Sufi orders of the same sect.

Rival Sufi Naqshbandi orders fought against each other. They accused each other of various misdeeds, and filed a lawsuit against each other through the office of the Xining prefect. The Judge decided not to issue a ruling on which group was superior to the other in matters of all Islamic affairs, and urged them to behave. This led both Sufi sects to try to overthrow the government.

Ma Yonglin aroused crowds of Hui, Dongxiang, Baoan, and Salars to overthrow Qing in Xunhua, Qinghai. Brigadier General Tang Yanhe sent troops to destroy the rebels. Ma Dahan formed a pact with the fellow Dongxiang Ma Wanfu when rebelling against the Qing dynasty. They led their followers in Hezhou, Didao, and Xunhua to revolt. They formed a defence line between Guanghe, Sanjiaji, and Tiaoheyan.

Ma Wanfu's Wahhabi inspired Yihewani sect was considered the "new teaching" sect. The Yihewani encouraged the rebellion. Governor General Yang Changjun sent troops to crush the rebellion.

Dong Fuxiang was the Commander in Chief of Kashgaria (kashgar), and he received a telegram ordering that he and General Ma Pi-sheng relieve the districts in revolt by conducting forced marches. His loyalist Chinese Muslim troops led by Muslim officers like Ma Anliang, Ma Guoliang, Ma Fuxiang, and Ma Fulu crushed the revolt, reportedly cutting off the heads and ears of rebels. During this rebellion he again indulged in plundering his fellow Muslims. He received the rank of generalissimo.

Ma Anliang's Muslim cavalry defeated Muslim rebels at Oxheart Mountain, and relieved the siege of Hezhou on December 4. He led Hui cavalry troops to massacre Salar fighters who had agreed to negotiate at a banquet, and was promoted to General of Xinjiang, and Colonel of Hezhou for his service, once the revolt was crushed. The loyalist Muslim Generals led their troops to initiate wide spread slaughter of the rebel Muslims. They decapitated the heads of the rebels and removed their ears It was said that Ma Anliang's red cap was dyed with Muslim blood, and the offices of Ma Fuxiang and Ma Fulu were built from Muslim heads.

Ma Wanfu surrendered as the Chinese Muslim loyalist Generals Dong Fuxiang and Ma Anliang arrived to crush the rebel Muslims, and Ma Dahan was killed while fighting. On August 2, 1896, it was reported that the Qing Generals carried out large scale massacres of the rebels, in one Area 8,000 were killed and the females sold into slavery. This Dungan revolt took place during the same time China was fighting the First Sino-Japanese War.