Second Goryeo–Khitan WarKaesong, North Korea
When King Seongjong died in 997, the Liao dynasty invested his successor Wang Song as king of Goryeo (King Mokjong, r. 997-1009). In 1009, he was assassinated by the forces of the general Gang Jo. Using it as a pretext, the Liao attacked Goryeo in the next Year. They lost the first battle but won the second one, and Gang Jo was captured and killed. The Liao occupied and burnt the Goryeo capital Kaesong, but the Goryeo king had already escaped to Naju. The Liao troops withdrew then afterward Goryeo promised to reaffirm its tributary relationship with the Liao dynasty. Unable to establish a foothold and to avoid a counterattack by the regrouped Groyeo armies, the Liao forces withdrew. Afterward, the Goryeo king sued for peace, but the Liao emperor demanded that he come in person and also cede key border areas; the Goryeo court refused the demands, resulting in a decade of hostility between the two nations, during which both sides fortified their borders in preparation of war. Liao attacked Goryeo in 1015, 1016, and 1017, but the results were indecisive.