In 1227, the capital of Western Xia was overrun by the Mongols, who devastated its buildings and written records: all was burnt to the ground except its monastery. The last emperor was killed and tens of thousands of civilians massacred. However, many Tangut families joined the Mongol Empire. Some of them led Mongol armies, e.g. Cha'an, into the conquest of China. After the Yuan dynasty (1271–1368) was established, the Tangut troops were incorporated into the Mongol army in their subsequent military conquests in central and southern China. The Tangut were considered Semu under the Yuan class system, thus separating them from the North Chinese. As late as the Ming dynasty (1368–1644), there was evidence of small Tangut communities in Anhui and Henan provinces. The people including members of the royal clan emigrated to western Sichuan, northern Tibet, even possibly northeast India, in some instances becoming local rulers.