After the
Tang dynasty collapsed, the Sixteen Prefectures became a site of contention between various ethnicities of North China, including
Han,
Khitan,
Jurchen, and
Mongol. In 938 AD, the prefectures were ceded to the
Khitans by
Shi Jingtang of the
Shatuo-led
Later Jin, who submitted to Khitan emperor
Yelü Deguang as the latter's "son-emperor" (despite the latter being almost 11 years younger) in exchange of military support in his rebellion against his estranged brother-in-law, Emperor
Li Conghou of
Later Tang. While Shi succeeded in overthrowing Later Tang, his shameless
treason not only fully exposed North China to Khitan invasions and
looting, but also doomed his own regime, which were invaded and destroyed by the Khitans nine years later when Yelü Deguang's
Liao dynasty defeated and exiled Shi's successor and nephew
Shi Chonggui in 947 AD. The Khitan's victory were however short-lived when Yelü Deguang grew tired of constant Chinese
insurgencies and decided to withdraw but died of illness on his way back, and the territories newly conquered by the Khitans were quickly recovered by the
Later Han. After the Later Han was overthrown by the
Later Zhou, Zhou second emperor
Chai Rong attempted to recapture the Sixteen Prefectures with a northern expedition in 959 AD, nearly succeeding until the campaign had to be abandoned due to Chai suddenly falling ill and died within a month. After Later Zhou general
Zhao Kuangyin usurped the throne from Chai Rong's 7-year-old son
Chai Zongxun with
a mutiny at Chenqiao and established the
Song dynasty in 960 AD, he chose to deal with other rival states in the south and west first instead of recovering the Sixteen Prefectures, despite that the Liao dynasty had already the been weakened by a decade of internal conflicts and political chaos. However, when his brother and successor
Zhao Guangyi finally decided to launch northern expeditions to recapture the Sixteen Prefectures in 979 AD, the Liao dynasty had recovered its strength and decisively defeated the Song dynasty twice in 979 AD and 986 AD. After the failure of a Liao invasion in 1003 AD, the
Chanyuan Treaty was signed in 1005 AD, which practically eliminated any possibilities for the Song dynasty to recapture the Sixteen Prefectures from the Khitans. In 1120s, two principal cities, Youzhou (also called Yanzhou, modern
Beijing) and Yunzhou (modern
Datong, Shanxi) were taken away from the Liao when the
Jurchen-led
Jin dynasty conquered the region. In 1123, the Jin ceded most of the territories except Yunzhou to the Song, but retook them in an invasion of Song territory in 1125. The Song dynasty then collapsed two years later in the
Jingkang incident in 1127, and the surviving royal court fled south of the
Huai River to establish a
rump state known as the
Southern Song dynasty. The loss of the Sixteen Prefectures again exposed the plains of Central China to northern threats when the
Mongol Empire rose in the 13th century. The Mongols, under
Ögedei Khan, would conquer the Jin dynasty in 1232, completing the conquest of all of
northern China. The Southern Song dynasty would be conquered by
Kublai Khan's
Yuan dynasty in 1279. In 1368,
Hongwu Emperor of the
Ming dynasty ordered general
Xu Da and
Chang Yuchun to call for the restoration of Han rule. They sent a Northern Expedition to
Zhongyuan, overthrowing the Yuan's rule in
China proper and establishing Ming. The Sixteen Prefectures were then restored to Han rule. ==Tang dynasty political geography==