The Naxi are generally thought to have migrated to their present location from somewhere to the north in eastern Tibet, western Sichuan, or Qinghai Province around the beginning of the common era. Some scholars feel that the Naxi may originally have been related to the Qiang people now inhabiting northwestern Sichuan. Present-day Naxi society and culture have been greatly influenced by more that 1,000 years of continual contact with their regionally dominant neighbors, the Tibetan and Han (Chinese) peoples. During the sixth to twelfth centuries, the Naxi were a part of the powerful Nanzhao and Dali kingdoms centered around Erhai Lake, about 150 kilometers south of Lijiang. These kingdoms (in succession) maintained close but not always friendly relations with both Tibet and China, and at the height of its power in the latter years of the Chinese Tang dynasty (618-906), the Nanzhao controlled an area that covered much of western Yunnan, southern Sichuan, and into Burma and Tibet. In 1252, the Naxi were conquered by the Mongol armies of Kubilai Khan, the founder of the Chinese Yuan dynasty (1260-1368), and since that time they have been under the political hegemony of the Chinese state. During the Yuan and Ming (1368-1644) dynasties, Chinese rule over many of the ethnic groups in south and west China was exercized indirectly through the use of hereditary "native chiefs" ( tusi), appointed by the Chinese court. Among the Naxi there were two main chiefly lineages, the Mu lineage in Lijiang and the A lineage in Yongning. Military conflict between China and Tibet in the early eighteenth century led to the permanent replacement of the Mu chief by a regular Chinese magistrate in 1723. Members of the A lineage continued as native chiefs in Yongning until 1957. After their southern neighbors, the Bai, the Naxi are among the most highly Sinicized of Yunnan's ethnic minorities. This holds particularly for Naxi living in the town of Lijiang, for as far back as the Ming dynasty the Mu chiefs made a point of welcoming Han (Chinese) merchants, artisans, scholars, and religious specialists to the area. A similarly conciliatory policy towards Tibet is reflected in the region's several Tibetan lamaseries, most of which were heavily financed by the Mu family.