Yanmen Commandery was an administrative subdivision (jùn) of the state of Zhao established c. 300BC and of northern imperial Chinese dynasties until AD758. It occupied lands in what is now Shanxi and Inner Mongolia. Its first seat was at Shanwu (near present-day Youyu, Shanxi); its later seats moved southeast to the more defensible sites at Yinguan (within present-day Shuozhou, Shanxi) and Guangwu (near present-day Daixian, Shanxi).
Yanmen Commandery was first established around 300BC during China's Warring States Period by the state of Zhao's King Yong, posthumously known as the Wuling ("Martial-&-Numinous") King. It covered territory in what is now northern Shanxi and southern Inner Mongolia. He created Yanmen Commandery along with its companion commanderies of Dai and Yunzhong to consolidate his conquests from invasions of the Loufan (t s Lóufán) and "forest nomads" or "barbarians" ( Línhú) in 306 and 304BC. He protected these new lands by raising earthen walls along their northern border, close to what is now Hohhot in Inner Mongolia. Garrisons and forts were also placed at strategic spots within the new territory, such as Yanmen Pass between the northern plains and the Hutuo Valley. In the mid-3rd centuryBC, the Yanmen governor Li Mu, relocated there under the command of Handan used these interior defenses and drills the commandery's citizens to minimalize casualties to good effect when he lured more than 100,000 Xiongnu horsemen into the heart of the commandery before defeating them with 160,000 chariots, cavalry, and archers.
Under the Qin, Yanmen was one of the commanderies which made up the principal divisions of the empire. Its seat was at Shanwu, south of present-day Youyu in Shanxi. Its territory ran from present-day Shanxi's Hequ, Wuzhai, and Ningwu Counties in the south to Inner Mongolia's Huangqi and Dai Lakes in the north; its eastern border was near Mount Heng. The Zhao wall was connected to those of the other former states as part of the Great Wall. This territory was divided into:
Under the Han, Yanmen Commandery maintained its seat at Shanwu. It was part of the realm of Dai, used as an appanage of the imperial kings and a title of rebels like Han Xin and Chen Xi. Han-era Yanmen included the Qin-era counties above, excluding Xincheng and Wangtao, with the addition of:
|Additional Han-era Counties|
During China's Three Kingdoms Period, Wei moved the commandery seat to Guangwu, southwest of present-day Daixian in Shanxi. The district is recorded as having 12,600 households around AD285.
During China's Northern and Southern Dynasties Period, Eastern Wei had the commandery seat at Daixian in what is now Shanxi. During the 540s, the district is recorded having 30,434 people living in 6,328 households.
Under the Tang, Yanmen Commandery was part of Hedong Circuit until it was abolished and replaced by Dai Prefecture in 618, although it was temporarily restored between 742 and 758. During the Tang, the name was retained as an honorary title: the generals Tian Chengsi, Tian Xu, Tian Ji'an, and Wang Zhixing were created "Prince" or "King of Yanmen" (Yànménwáng).