During the Ming dynasty, Hui Generals and troops loyal to Ming fought against Mongols and Hui loyal to the Yuan Dynasty in the Ming conquest of Yunnan. Hui also fought for the emperor against aboriginal tribes in southern China during the Miao Rebellions. Many Hui soldiers of the Ming dynasty then settled in Yunnan and Hunan provinces.