In the sixth year of Emperor Wu of the Western Han Dynasty (AD 135), Wuyu County (now Xuanwei) was established. In the Eastern Han Dynasty, Wuyu County entered Hanyang County (now Weining, Guizhou Shuicheng). On the historical stage of the Three Kingdoms, Wei Shuwu and the Three Kingdoms are in a pivotal position. Today, Xuanwei, a county-level city, has become the territory of Shu Han. At that time, Shu Han once again established Wuyu County in this area and rebuilt Ningdu (now Qujing). In August of the sixth year of West Taishi (270), it was divided into four counties, namely Jianning, Yunnan, Yongchang and Xinggu, and was changed to Ningzhou, which was subordinate to Xuanwei City at the county level. During the Southern and Northern Dynasties, great changes took place in the county-level organizational system and ownership of Xuanwei City. After Emperor Wendi established the Sui Dynasty, this area belonged to Nanning. In the Tang Dynasty, Nanning was changed to Langzhou, and Langzhou had a governor's office, which belonged to this area.
Xuanwei in the Song Dynasty, which is now the county level, belongs to Dali. In the 13th year of Yuan Shizu (1276), Dali Kingdom fell, and Yunnan Zhongshu Province was established. Road, state, county and Yizhou were placed under Qujing Road, and Shuicheng (now Zhanyi), Luoshan (now Fuyuan) and Liang Shi (now the northeast of Xuanwei) were under the state jurisdiction, while Shi Baoshan West (later moved to Dongying of Xuanwei River) was under the state jurisdiction. According to the Records of Xuanwei County, in the 14th year of Hongwu in Ming Dynasty (138 1), Fu Youde, a general of the Southern Army, was ordered to crusade against Wusha, and Xuanwei was appointed Wade in Xuanwei court to scare the town. In the Ming Dynasty, Qujing Road was changed to Qujing House, Zhanyi House was placed under Qujing House, and Xuanwei belonged to it. At the end of the Ming Dynasty, Yizhou ordered cola water, while Tuzhizhou still lived in Hedong.
Finally, in A.D. 1727, when Yong Zhengdi was in power, Xuanwei House was established in the name of Xuanwei Pass. It can be seen that the establishment of Xuanwei Mansion began in A.D. 1727 and has a history of nearly 300 years. 19 12, Xuanwei prefecture was changed to Xuanwei county. From 65438 to 0970, Xuanwei County belonged to Qujing area. 1February 1994 18, xuanwei county was abolished and Xuanwei city (county-level city) was established. 1May 6, 997, Qujing area was abolished, and Qujing City was established at the prefecture level, and Xuanwei City at the county level was Qujing City in Yunnan Province. By the end of 20 18, Xuanwei was a county-level city with a total area of 6,069.88 square kilometers and a total population of about1530,000, making it one of the most populous counties (county-level cities) in Yunnan Province.