When the Qing dynasty invaded the Ming dynasty in 1644, Muslim Ming loyalists in Gansu led by Muslim leaders Milayin[1] and Ding Guodong led a revolt in 1646 against the Qing during the Milayin rebellion in order to drive the Qing out and restore the Ming Prince of Yanchang Zhu Sichuan to the throne as the emperor.[2] The Muslim Ming loyalists were supported by Hami's Sultan Sa'id Baba and his son Prince Turumtay.[3][4][5] The Muslim Ming loyalists were joined by Tibetans and Han Chinese in the revolt.[6] After fierce fighting, and negotiations, a peace agreement was agreed on in 1649, and Milayan and Ding nominally pledged alleigance to the Qing and were given ranks as members of the Qing military.[7] 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.[8] The Muslim Ming loyalists were then crushed by the Qing with 100,000 of them, including Milayin, Ding Guodong, and Turumtay killed in battle.