the Khitans. The Khitans saw this as their reason to attack Goryeo, and in 1010, Emperor Shengzong of Liao led a massive invasion with a contingent of 400,000 soldiers, commanding the troops himself. Suffering heavy casualties in five major engagements, the Khitans finally defeated the Goryeo army and executed their commander General Gang Jo. However, Gang urged King Hyeonjong to escape from the palace, not to surrender to the invading Liao troops. The King followed Gang's advice, and managed to escape from the burning capital. A Korean insurgency began to harass Khitan forces, which finally compelled Shengzong to withdraw his army. The Khitans won the war, but gained no benefit from it; rather spending precious resources in vain and reducing the national treasury. Thus another bloody war between the two nations was foreshadowed, and tensions would further lead to the Third Goryeo-Khitan War. Gang was later promoted to Prime Minister. In 1018, General Xiao Baiya, under orders of the Liao administration, led an expedition to Goryeo with a 100,000 man contingent. This time, many officials urged the king to commence peace negotiations, since the damage from the Second Goryeo-Khitan War had been so great, leaving Goryeo difficult to recover. However, Gang advised the king to declare war against the Liao, since the enemy contingent was much smaller than in previous invasions. He volunteered to be the acting deputy War minister for the duration of the war, at the age of seventy-one. He led about 208,000 men toward the Goryeo-Liao border. The first battle of the war was the Battle of Heunghwajin, which was a significant victory of Goryeo by blocking the stream and destroying the dam when Khitans were crossing the water. However, General Xiao did not give up the hope of capturing the capital Gaegyeong, and continued to march south. Later, Xiao realized that the mission was impossible to accomplish, and decided to retreat. General Gang knew that the Khitan army would withdraw from the war, and awaited them at the fortress of Gwiju, where he encountered the retreating Khitans in 1019. Discouraged and starving, the Khitans were defeated by the Goryeo army. Only General Xiao and few remaining survivors managed to escape from the devastating defeat. This battle is known as the Battle of Gwiju. General Gang returned to the capital and was welcomed as the military hero who saved the kingdom. After the war, Gang retired from