<P> The Han dynasty, which followed the short - lived Qin in 206 BC, initially restored some local autonomy . Liu Bang, the founding emperor of the Han dynasty, recognized a number of regional kingdoms including Yan, ruled by Zang Tu, who had joined the revolt that overthrew the Qin, seized the City of Ji and sided with Liu Bang in the war with Xiang Yu for supremacy . But Zang rebelled and was executed, and Liu granted the kingdom to his childhood friend Lu Wan . Later, Liu became mistrustful of Lu, and the latter fled the City of Ji to join the Xiongnu tribes of the steppes . Liu Bang's eighth son took control of Yan, which was subsequently ruled by lineal princes of the imperial family, from the City of Ji, then known as Yan Commandery (燕 郡), and the Principality of Guangyang (广 阳 国 / 廣 陽 國). In the early Western Han, the four counties of Guangyang Principality had 20,740 households and an estimated population of 70,685 . </P> <P> In 106 BC, under Emperor Wu, the country was reorganized into 13 prefectural - provinces (zhou 州), and the City of Ji served as the prefectural capital for Youzhou (幽 州). The tomb of Liu Jian, the Prince of Guangyang who ruled Youzhou from 73 to 45 BC was discovered in Fengtai District in 1974 and has been preserved in the Dabaotai Western Han Dynasty Mausoleum . In 1999, another royal tomb was found in Laoshan in Shijingshan District but the prince formerly buried there has not been identified . </P> <P> During the early Eastern Han dynasty in 57 AD, the five counties of Guangyang Commandery had 44,550 households and an estimated 280,600 residents . By population density, Guangyang ranked in the top 20 among the 105 commanderies nationally . In the late Eastern Han, the Yellow Turban Rebellion erupted in Hebei in 184 AD and briefly seized Youzhou . The court relied on regional militaries to put down the rebellion and Youzhou was controlled successively by warlords Liu Yu, Gongsun Zan, Yuan Shao and Cao Cao . In 194 AD, Yuan Shao captured Ji from Gongsun Zan with the help of Wuhuan and Xianbei allies from the steppes . Cao Cao defeated Yuan Shao in 200 AD and the Wuhuan in 207 AD to pacify the north . </P> <P> During the Three Kingdoms period, the Kingdom of Wei founded by Cao Cao's son, Cao Pi, controlled ten of the Han dynasty's prefectures including Youzhou and its capital Ji . The Wei court instituted offices in Youzhou to manage relations with the Wuhuan and Xianbei . To help sustain the troops garrisoned in Youzhou, the governor in 250 AD built the Lilingyan, an irrigation system that greatly improved agricultural output in the plains around Ji . </P>

During the era of the ming dynasty the capital of china was moved to beijing from