structural:expansion, structural:scholar_edition, stylistic:tone, information:filtering
Goryeo–Khitan War

Following the "Manbu Bridge Incident" of 942, Goryeo prepared itself for a conflict with the Khitan Empire: Jeongjong established a military reserve force of 300,000 soldiers called the "Resplendent Army" in 947, and Gwangjong built fortresses north of the Chongchon River, expanding toward the Yalu River. However an attempt to control the Yalu River basin in 984 failed due to conflict with the Jurchens. The Khitans considered Goryeo a potential threat and, with tensions rising, invaded in 993. The Jurchens warned Goryeo of the invasion twice. At first Goryeo did not believe the information but came around upon the second warning and took up a defensive strategy. The Koreans were defeated in their first encounter with the Khitans, but successfully halted their advance at Anyung-jin (in modern Anju, South Pyongan Province) at the Chongchon River. Negotiations began between the Goryeo commander, Sŏ Hŭi, and the Liao commander, Xiao Sunning. In conclusion, Goryeo entered a nominal tributary relationship with Liao, severing relations with Song, and Liao recognized Goryeo sovereignty to the land east of the Yalu River. Goryeo was left free to deal with the Jurchens south of the Yalu and in 994-996, Sŏ Hŭi led an army into the area and built forts. Afterward, Goryeo established the "Six Garrison Settlements East of the River" in its new territory. In 994, Goryeo proposed to Song a joint military attack on Liao, but was declined; previously, in 985, when Song had proposed a joint military attack on Liao, Goryeo had declined. For a time, Goryeo and Liao enjoyed an amicable relationship. In 996, Seongjong married a Liao princess.

As the Khitan Empire expanded and became more powerful, it demanded that Goryeo cede the Six Garrison Settlements, but Goryeo refused. In 1009, Kang Cho staged a coup d'état, assassinating Mokjong and installing Hyeonjong on the throne. Goryeo sent an envoy to the Khitans telling them that the previous king had died and a new king had ascended the throne. In the following year, some Jurchen tribesmen who had been in conflict with Goryeo fled to the Khitans and told them of the coup. Under the pretext of avenging Mokjong, Emperor Shengzong of Liao led an invasion of Goryeo with an army of 400,000 soldiers. Meanwhile, Goryeo tried to establish relations with Song but was ignored, as Song had agreed to the Chanyuan Treaty in 1005. Goryeo gathered a 300,000 strong army under Kang Cho. In the first battle, the Goryeo forces led by Yang Kyu won a victory against the Liao. The Liao decided to split up their forces with one part heading south. The Goryeo army under the leadership of Kang Cho lost the second battle and suffered heavy casualties. The army was dispersed and many commanders were captured or killed, including Kang Cho himself. Later, Pyongyang was successfully defended, but the Liao army marched toward Kaesong.

Hyeonjong, upon the advice of Kang Kam-ch'an, evacuated south to Naju. Shortly afterward, the Liao won a pitched battle outside Kaesong and sacked the city. He then sent Ha Gong-jin and Go Yeong-gi to sue for peace, with a promise that he would pay homage in person to the Liao emperor. The Khitans, who were sustaining attacks from previously surrendered districts and the regrouped Korean army which disrupted their supply lines, accepted and began their withdrawal. The Liao army became bogged down in the mountains during the winter and had to abandon much of their armour. The Khitans were ceaselessly attacked during their withdrawal; Yang Kyu rescued from over 10,000 to over 30,000 prisoners of war, but died in battle. According to the Goryeosa, due to continued attacks and heavy rain, the Khitan army was devastated and lost its weapons crossing the Yalu. They were attacked while crossing the Yalu River and many drowned. Afterward, Hyeonjong did not fulfill his promise to pay homage in person to the Liao emperor, and when demanded to cede the Six Garrison Settlements, he refused.

The Khitans built a bridge across the Yalu River in 1014 and attacked in 1015, 1016, and 1017: victory went to the Koreans in 1015, the Khitans in 1016, and the Koreans in 1017. Goryeo lost the Poju (Uiju) region. In 1018, Liao launched an invasion led by Xiao Paiya, the older brother of Xiao Sunning, with an army of 100,000 soldiers. The Liao army tried to head straight for Kaesong. Goryeo gathered an army of 208,000 under Kang Kam-ch'an and ambushed and Liao army, which suffered heavy casualties. The Goryeo commander Kang Kam-ch'an had dammed a large tributary of the Yalu River and released the water on the unsuspecting Khitan soldiers, who were then charged by 12,000 elite cavalry. The Liao army pushed on toward Kaesong under constant enemy harassment. After arriving within the vicinity of the well-defended capital, a contingent of 300 cavalry sent as scouts was annihilated, upon which the Liao army decided to withdraw. 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. During the retreat, 10,000 Liao army troops were annihilated by the Goryeo army under Kang Min-cheom of Goryeo. The retreating Liao army was intercepted by Kang Kam-ch'an in modern-day Kusong and suffered a major defeat, with only a few thousand soldiers escaping.

Shengzong intended to invade again and amassed another large expeditionary army in 1019 but faced internal opposition. In 1020, Goryeo sent tribute and Liao accepted, thus resuming nominal tributary relations. Shengzong did not demand that Hyeonjong pay homage in person or cede the Six Garrison Settlements. The only peace treaty stipulations formalized in 1022 were a "declaration of vassalage" and the release of a detained Liao envoy. A Liao envoy was sent in the same year to formally invest the Goryeo king and upon his death in 1031, his successor Wang Hŭm was also invested as king by the Liao. After 1022, Goryeo did not have diplomatic relations with the Song until 1070, with the exception of an isolated embassy in 1030. The sole embassy was probably related to the rebellion of Balhae people in the Liao dynasty. The rebellion was quickly defeated by the Khitans, who returned to enforce Goryeo's tributary obligations. Goryeo adopted the reign title of the Liao in the fourth month of 1022. The History of Liao claims that Hyeonjong "surrendered" and Shengzong "pardoned" him, but according to Hans Bielenstein, "horn of its dynastic language, this means no more than that the two states concluded peace as equal partners (formalized in 1022)". Bielenstein claims that Hyeonjong kept his reign title and maintained diplomatic relations with the Song dynasty.

Kaesong was rebuilt, grander than before, and, from 1033 to 1044, the Cheolli Jangseong, a wall stretching from the mouth of the Yalu River to the east coast of the Korean Peninsula, was built for defense against future invasions. Liao never invaded Goryeo again.