This transition followed a time known as the Later Three Kingdoms, marked by conflict between the resurgent aristocracies of Goguryeo, Baekje, and the ruling Silla nobility.
[12] In 926, the Khitan-led Liao dynasty conquered Balhae, leading its last crown prince and the survivors to flee southward and seek refuge in Goryeo.
However, due to cold relations, Goryeo declined the gift, banished the envoy to an island, and had the camels die from starvation under a bridge.
However, in spite of the settlement, Goryeo continued to communicate with the Song,[25] having strengthened its defenses by building fortresses in the newly gained northern territories.
The Liao troops soldiered on and headed toward the capital, but were met with stiff resistance and constant attacks, and were forced to retreat back north.
[36] In the next year the Liao assembled another large army in order to launch another invasion but it became clear that neither side could gain a decisive victory.
[40] However according to Bielenstein, Goryeo maintained diplomatic relations with Song, Hyeonjong kept his own reign title, and the two states concluded peace as equals in 1022.