The Hani have a legend that tells of their ancestors as nomads from a faraway northern river plain who gradually migrated south. Some Chinese sources consider that the Hani might have migrated south from the present Yunnan-Sichuan border area. During the Sui and Tang dynasties, the Chinese referred to the Hani as wu man, a general term for other southern peoples. In the eighth century A.D. they were called heni and were part of Yunnan's Nanzhao Kingdom. During the Mongol Yuan dynasty the people of the area were referred to as hezi, and the Henilu Administrative District was established. In the Ming dynasty, the Chinese changed the name of this district to Henifu and established a hereditary system ( tusi ) of local Hani leaders. During this period Chinese military colonizers came to the region, influencing the Hani and other local groups. In the Qing dynasty, a system of rotating Chinese officials replaced the tusi system. From the turn of the century on, the area was not at peace. The Hani, along with the Yi, demonstrated against the Qing government by participating in the Taiping Rebellion. In 1917, a woman named Lu Meibei led an uprising against the hereditary local leaders. Between 1895 and 1935 the Hani resisted French incursion into the region, and during World War II they resisted the Japanese. In 1947 the Chinese Communist party formed a working group in the area and carried out guerrilla warfare. In 1950 the Chinese Communist party declared the area "liberated" and made it part of the People's Republic of China.