Third conflict in the Goryeo – Khitan War The Third Goryeo – Khitan War was an 11th - century conflict between the kingdom of Goryeo and Khitan forces near what is now the border between China and North Korea . The Goryeo - Khitan Wars began in 993 with the first campaign and continued with the second campaign . Background . In 993 , Khitans under General Xiao Sunning invaded Korea , but retreated after truce negotiations with minister Seo Hui of Goryeo , establishing friendly relations between the two nations . In 1004 , Khitans invaded China . Chinese forces were terribly defeated , and the Chinese were forced to pay tribute to the Liao emperor . However , the tension between Goryeo and Liao created another war . In 1009 , General Gang Jo of Goryeo led a coup against King Mokjong , killing the king and establishing military rule . In 1010 , the alliance was broken and Liao attacked Korea for General Gang ' s treason . Also , Khitans claimed six garrison settlements east of the Yalu River , which Goryeo claimed as its territory in truce negotiations during 993 . The Koreans fought fiercely but were defeated . However , the Goryeo king managed to retain his claim on the six garrison settlements . The Khitans retreated from the peninsula , with no great prize for the war , but they did not give up their hope of gaining the six garrison settlements and making Goryeo pay tribute . However , beginning in the summer of 1018 , the Khitans constructed a bridge across the Yalu River . The Invasion and Battle of Kwiju . In December of 1018 , 100 , 000 Khitan soldiers under the command of General Xiao Baiya crossed the bridge into Goryeo territory , but were met by an ambush of Goryeo soldiers . King Hyeonjong had heard the news of invasion , and ordered his troops into battle against the Khitan invaders . General Gang Gam - chan , who did not have any military experience since he was a government official , became a commander of the Goryeo army of about 208 , 000 men ( the Khitans still had advantages , even outnumbered 2 to 1 , since Khitan troops were mostly mounted while the Koreans were not ) , and marched toward Yalu River . Near the Garrison Settlement of Heunghwajin , there was a small stream . General Gang ordered the stream blocked until the Khitans began to cross it , and when the Khitans were mid - way across , he ordered that the dam be destroyed so that the water would drown much of the Khitan army . The damage was great , but the Khitans did not abandon their campaign in spite of the challenges represented by defenders and by winter conditions in the northwest . They pushed through to approach Kaesong , the capital , but were defeated by a force led by General Gang Gam Chan . The Goryeo forces led a massive attack that all but annihilated the Khitan army . Barely a few thousand of the Liao troops survived the bitter defeat at Kusong . Many more were captured after surrendering along the river banks . Four years later , Koryo and the Liao dynasty reached a negotiated peace agreement and established normal relations . The Khitan never again invaded Goryeo . The surrendered Khitan troops were divided up among the provinces of Goryeo and settled in isolated and guarded communities . These prisoners were valued for their skill in hunting , butchering , skinning , and leather tanning . Over the next few centuries , they evolved into the Baekjeong class , who came to form the lowest caste of the Korean people . Aftermath . This was the last invasion of Goryeo by the Khitan , as the two reached a peace agreement four years thereafter . Both the Liao Dynasty and Goryeo enjoyed a time of peace , and their cultures were at their height . However , as the balance of power on the Liao - Goryeo border shifted , the Jurchens , who lived around the border between the two nations , began to expand their power . Finally , in 1115 , Jurchen chief Wányán Āgǔdǎ founded the Jin Dynasty in Manchuria , and began to attack the Khitans . In 1125 , Jurchen troops captured the Liao king with help from the Chinese , who encouraged the Jurchens in the hope of gaining territories they lost to the Khitans before . Most Khitans fled to Turkestan , where they established the Kingdom of Western Liao ( Kara - Khitai ) . Many of them were forced to surrender to the Jurchens .