Seongjong of Goryeo

Seongjong of Goryeo (15 January 961 – 29 November 997) (r. 981–997) was the sixth ruler of the medieval Korean kingdom of Goryeo.
Reign.
Seongjong was born on 15 January 961, the second son of Daejong, and a grandson of King Taejo (the founder of the Goryeo Dynasty). He ascended the throne after his cousin and also his brother-in-law King Gyeongjong died in 981.
After he ascended the throne, Seongjong was at first content not to interfere with the provincial lords, and to appease the Silla aristocracy. Seongjong married a woman of the Silla royal clan. 
In 982, Seongjong adopted the suggestions in a memorial written by Confucian scholar Choe Seung-ro (최승로; 崔承老) and began to create a Confucian-style government. Choe Seung-ro suggested that Seongjong would be able to complete the reforms of King Gwangjong, the fourth King of Goryeo, which he had inherited from Taejo of Goryeo. Taejo had emphasized the Confucian “Classic of History (書經),” which stated that the ideal Emperor should understand the suffering of farmers and directly experience their toil. Seongjong followed this principle and established a policy by which district officials were appointed by the central government, and all privately owned weapons were collected to be recast into agricultural tools.
Seongjong set out to establish the Goryeo state as a centralized Confucian monarchy. In 983, he established the system of twelve mok, the administrative divisions which prevailed for most of the rest of the Goryeo period, and sent learned men to each of the mok to oversee local education, as a means of integrating the country aristocracy into the new bureaucratic system. Talented sons of the country aristocrats were educated so that they could pass the civil service examinations and be appointed to official government posts in the capital.
In September, 995 (the 14th year of Seongjong‘s reign), the nation was divided into ten provinces for the first time.
The First Goryeo-Khitan War.
In late August 993, Goryeo intelligence sources along the frontier learned of an impending Khitan invasion. Seongjong quickly mobilized the military and divided his forces into three army groups to take up defensive positions in the northwest. Advanced units of the Goryeo army marched northwestward from their headquarters near modern Anju on the south bank of the Cheongcheon River. The seriousness of the situation compelled Seongjong to travel from the capital to Pyongyang to personally direct operations.
That October, a massive Khitan army said to number nearly 800,000 men (in fact 60,000 men) under the command of General Xiao Sunning swarmed out of Liao from the Naewon-song Fortress and surged across the Yalu River into Goryeo. Waves of Khitan warriors swept across the river and fanned out over the countryside.
In bloody back-and-forth warfare, the fierce resistance of Goryeo soldiers at first slowed, then considerably hampered the Khitan advance at the city of Pongsan-gun. But Goryeo's army never surrendered. It stood firm against frontal attacks, broke to retreat and lay ambushes, and launched flanking attacks against the Khitan. Goryeo warriors finally halted Xiao Sunning's army at the Cheongcheon River. In the face of such quick and determined resistance, the Khitan decided that further attempts to conquer the entire peninsula would be far too costly, and sought instead to negotiate a settlement with Goryeo.
Without a hint of contrition or humility, the Khitan General Xiao Sunning demanded the surrender of the former territory of Balhae to Emperor Shengzong. He asked that Goryeo sever its relations with Song dynasty and, in the boldest demand of all, that Seongjong accept vassal status under the Liao emperor and pay a set annual tribute to the Liao state. Instead of and rejecting General Xiao's demands outright, the royal court at Kaesong began a heated debate about the Khitan ultimatum. Government officials believed that acceding to General Xiao would prevent further Khitan incursions and urged the court to appease the Liao emperor. Many of the senior military commanders who had recently faced the Khitan army on the battlefield opposed accepting General Xiao’s terms, including Official Seo Hui, commander of an army group north of Anju. While the bureaucrats argued in Kaesong, General Xiao launched a sudden attack across the Cheongcheon River, directly on the Goryeo army headquarters in Anju. The Khitan assault was quickly repulsed, but it agitated the royal court to a state of near panic.
In an effort to calm the court nobility, minister Seo Hui volunteered to negotiate directly with General Xiao. Both parties knew that a key factor influencing the negotiations was the heavy pressure being exerted on the Liao state by Song dynasty. In face-to-face talks with his Khitan counterpart, minister Seo bluntly told General Xiao that the Khitan had no basis for claims to former Balhae territory. Since the Goryeo dynasty was, without question, successor to the former Goguryeo kingdom, that land rightfully belonged under Goryeo's domain. In a cleverly veiled threat, Seo Hui reminded General Xiao that the Liaodong Peninsula had also once been under the dominion of Goguryeo and that the Manchurian territories, including the Khitan capital at Liaoyang, should properly belong to Goryeo. In a remarkable conclusion, minister Seo obtained Khitan consent to allow the region up to the Yalu River to be incorporated into Goryeo territory. General Xiao and the Khitan army not only returned to Liao without having achieved their goals, but the invasion ended with the Khitan giving up territory along the southern Yalu River to Seongjong. Seo Hui's brilliant diplomatic maneuver underscored his correct understanding of both the contemporary international situation and Goryeo's position in the region.
The Khitan withdrew and ceded territory to the east of the Yalu River when Goryeo agreed to end its alliance with Song Dynasty. However, Goryeo continued to communicate with Song, having strengthened its position by building fortress in the newly gained northern territories.
The Goryeo-Khitan Wars continued with the second and third campaigns until 1018.
Death.
He died of disease in November 997 and was succeeded by his nephew, Mokjong.