You was first created in 106 BC as a province-sized prefecture during the Western Han Dynasty to administer a large swath of the dynasty's northern frontier that stretched from modern-day Shanxi Province in the west and Shandong Province in the south, through northeastern Hebei Province, southern Liaoning Province and southern Inner Mongolia to Korea. The prefectural capital was the City of Ji in modern Beijing. This prefecture continued to be centered in northern Hebei through the Three Kingdoms and Western Jin Dynasty.