When the Qing dynasty invaded the Ming dynasty in 1644, Muslim Ming loyalists in Gansu led by Muslim leaders Milayin 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 Shichuan to the throne as the emperor. The Muslim Ming loyalists were supported by Hami's Sultan Sa'id Baba and his son Prince Turumtay.
When the Qing dynasty invaded the Ming dynasty in 1644, Muslim Ming loyalists in Gansu led by Muslim leaders Milayin and Ding Guodong launched a rebellion in 1646 against the Qing during the Milayin uprising with the aim of expelling the Qing and restoring the Ming Prince of Yanchang Zhu Shichuan to the throne as emperor.