Sima Yi's Liaodong campaign occurred in 238 CE during the Three Kingdoms period of Chinese history. Sima Yi, a general of the state of Cao Wei, led a force of 40,000 troops to attack the kingdom of Yan led by warlord Gongsun Yuan, whose clan had ruled independently from the central government for three generations in the northeastern territory of Liaodong (present-day eastern Liaoning). After a siege that lasted three months, Gongsun Yuan's headquarters fell to Sima Yi with assistance from Goguryeo (one of the Three Kingdoms of Korea), and many who served the Yan Kingdom were massacred. In addition to eliminating Wei's rival in the northeast, the acquisition of Liaodong as a result of the successful campaign allowed Wei contact with the non-Han peoples of Manchuria, the Korean Peninsula, and the Japanese archipelago. On the other hand, the war and the subsequent centralisation policies lessened the Chinese grip on the territory, which permitted a number of non-Han states to form in the area in later centuries.

Background
Liaodong Commandery of You Province, part of present-day Northeast China, was situated at the northeastern fringe of Eastern Han Empire, surrounded by the Wuhuan and Xianbei nomads in the north and Goguryeo and Buyeo peoples in the east. Its capital was the city of Xiangping. In the autumn of 189, Gongsun Du, a native of Liaodong, was appointed as the Administrator of Liaodong (), and thus began the Gongsun family's rule in the region. Taking advantage of his distance from central China, Gongsun Du stayed away from the chaos which accompanied the effective end of Han rule, expanded his territories to include the commanderies of Lelang and Xuantu, and eventually proclaimed himself as Marquis of Liaodong (). His son Gongsun Kang, who succeeded him in 204, created the Daifang Commandery and maintained the autonomy of Liaodong by aligning himself with the warlord Cao Cao. Gongsun Kang died some time around the abdication of Emperor Xian of Han to Cao Pi, son of Cao Cao, and Gongsun Kang's brother Gongsun Gong became the new ruler of Liaodong. Gongsun Gong was described as incompetent and inept, and he was soon overthrown and imprisoned by Gongsun Kang's second son Gongsun Yuan in 228.

Soon after Gongsun Yuan came to power in Liaodong, China was, for the most part, split into three: Cao Wei in the north, Shu Han in the southwest, and Eastern Wu in the southeast. Of these, Liaodong's chief concern was its immediate neighbour Cao Wei, who had once contemplated an invasion of Liaodong in response to Gongsun Yuan's coup. In this situation, the Eastern Wu lord Sun Quan attempted to win Gongsun Yuan's allegiance in order to establish two fronts of attack against Cao Wei, and several embassies made their way from Wu to Liaodong by taking the difficult journey across the Yellow Sea. Cao Wei eventually got wind of the embassies and made one successful interception in Chengshan (), at the tip of the Shandong peninsula, but Gongsun Yuan had already sided with Sun Quan. Upon the confirmation of Gongsun Yuan's goodwill, an elated Sun Quan sent another embassy in 233 to bestow Gongsun Yuan the title of King of Yan () and various insignia to trade for warhorses. By then, however, Gongsun Yuan had changed his mind about allying himself with a distant state over the sea and making himself an enemy of a powerful neighbour. When the Wu embassy arrived, Gongsun Yuan seized the treasures, killed the leading ambassadors, and sent their heads and a portion of their goods to the Wei court to buy himself back to favour. Some of the envoys from Wu somehow escaped the carnage and found a potential ally to the east of Liaodong — the state of Goguryeo.

Goguryeo had been an enemy of the Gongsun clan since the time of Gongsun Du, especially after Gongsun Kang meddled with the succession after King Gogukcheon died. Although the Goguryeo pretender that Gongsun Kang supported was eventually defeated by Sansang of Goguryeo, Goguryeo had to move its capital to Hwando Mountain Fortress in modern-day Ji'an, Jillin on the Yalu River to better protect itself from Gongsun Kang. Thus when the Wu ambassadors came to Goguryeo for refuge, the reigning King Dongcheon was happy to assist these new enemies of Liaodong. The king sent 25 men to escort the envoys back to Wu along with a tribute of sable and falcon skins, which encouraged Sun Quan to send an official mission to Goguryeo to further the two states' relations. Cao Wei did not want to see Wu regain a diplomatic foothold in the north, and established its own connections with Goguryeo through the Inspector of You Province () Wang Xiong (). King Dongcheon presumably arrived at the same conclusion as Gongsun Yuan and switched his alignment from Wu to Wei — the Wu envoys to Goguryeo in 236 were executed and their heads sent to the new Inspector of You Province, Guanqiu Jian. By 238, Goguryeo had formally allied itself with Cao Wei against Gongsun Yuan.

Prelude
Although Gongsun Yuan was nominally a vassal of Cao Wei, his brief flirtation with Wu and brazen derogatory comments about Wei earned him a reputation as unreliable. From Wei's point of view, although the Xianbei insurrection by Kebineng had been put down recently, Liaodong's position as a buffer zone against barbarian invasions needed to be clarified.  Therefore, it was clearly unacceptable that its leader, Gongsun Yuan, was of questionable loyalty. In 237, Guanqiu Jian presented a plan to invade Liaodong to the Wei imperial court and put his plan into action. With troops of You Province as well as Wuhuan and Xianbei auxiliaries, Guanqiu Jian crossed the Liao River east into Gongsun Yuan's territory and clashed with his enemy in Liaosui (遼隧; near present-day Haicheng, Liaoning). There the Wei forces suffered a defeat, and were forced to retreat due to the floods caused by the summer monsoon season.

Having inflicted a disgrace on the imperial armies, Gongsun Yuan had gone too far to turn back. In a series of contradictory actions, Gongsun Yuan memorialised the Wei court in hope of getting a pardon on one hand, while formally declaring independence on the other by assuming the title King of Yan. He also assigned an era name for his reign, Shaohan (), meaning "Succeeding Han". This was problematic for his peace efforts for two reasons: first, proclaiming era names was a practice usually reserved for emperors, showing his intention to claim the imperial position; secondly, the era name itself implied that Wei's succession of the Han dynasty was somehow illegitimate. As king, he tried to entice the Xianbei into attacking Cao Wei by conferring the rank of chanyu to one of its chiefs, but the Xianbei had not recovered from the death of Kebineng: the chieftains were too preoccupied with internal disputes to launch a large-scale attack on Wei.

In 238, the Wei court summoned the Grand Commandant () Sima Yi for another campaign against Gongsun Yuan. Previously, Sima Yi had been tasked with defending Wei's western borders from Shu Han's Northern Expeditions led by the Shu chancellor Zhuge Liang, so when the latter died in 234, the government of Wei became able to afford sending Sima Yi to another frontier. In a court debate prior to the campaign, the Wei emperor Cao Rui decided that Sima Yi should lead 40,000 men for the invasion of Liaodong. Some counsellors thought the number was too many, but Cao Rui overruled them, saying: "In this expedition of 4,000 li, mobile troops must be employed, and we must exert our utmost. We should not mind the expense at all." The emperor then asked Sima Yi for his assessment on Gongsun Yuan's possible reactions and how long the campaign should take, Sima Yi responded as thus: 

When Sima Yi set out from the Wei capital Luoyang, Cao Rui personally saw him off at Luoyang's Ximing Gate (), where he ordered Sima Yi's brother Sima Fu and son Sima Shi, as well as other officials to attend the ceremony. Sima Yi, leading 40,000 infantry and cavalry, was accompanied by sub-commanders such as Niu Jin and Hu Zun (). He would later be joined by Guanqiu Jian's forces in You Province, which included the Xianbei auxiliary led by Mohuba (), ancestor of the Murong clan.

Having heard of the new preparations made against him, Gongsun Yuan desperately dispatched an envoy to the Wu court to apologise for his betrayal in 233 and begged for help from Sun Quan. At first, Sun Quan was ready to kill the messenger, but he was persuaded by Yang Dao () to make a display of force and possibly gain advantages if Sima Yi and Gongsun Yuan became deadlocked in war. Cao Rui became concerned about the Wu reinforcements, but the adviser Jiang Ji read through Sun Quan's intentions and cautioned Cao Rui that while Sun Quan would not risk a deep invasion, the Wu fleet would make a shallow incursion into Liaodong if Sima Yi did not defeat Gongsun Yuan quickly enough.

The campaign
The Wei army led by Sima Yi reached the banks of the Liao River by June 238. Gongsun Yuan responded by sending Bei Yan () and Yang Zuo () with the main Liaodong force to set camp at Liaosui, the site of Guanqiu Jian's defeat. There, the Liaodong encampment stretched some 20 li walled from north to south. The Wei generals wanted to attack Liaosui, but Sima Yi reasoned that attacking the encampment would only wear out the troops; on the other hand, since the bulk of the Liaodong army was at Liaosui, Gongsun Yuan's headquarters at Xiangping would be comparatively empty and the Wei armies could take it with ease. Thus Sima Yi sent Hu Zun to make a sortie to the southeast, planting flags and banners as if the main thrust of the Wei army was in that direction. Bei Yan and his men hastened to the south, where Hu Zun, having lured his enemy out, crossed the river and broke through Bei Yan's line. Meanwhile, Sima Yi secretly led the main Wei army across the Liao River to the north. After he made the crossing, he burned the bridges and boats, made a long barricade along the river, then headed toward Xiangping. Realising the feint, Bei Yan and his men hastily withdrew their troops during the night and headed north to intercept Sima Yi's army. Bei Yan caught up with Sima Yi in Mount Shou (), a mountain west of Xiangping, where he was ordered to fight to the death by Gongsun Yuan. Sima Yi achieved a great victory there, and proceeded to lay siege to Xiangping.

Along with the month of July came the summer monsoons, which impeded Guanqiu Jian's campaign a year ago. Rain poured constantly for more than a month so that ships could sail the length of the flooded Liao River from its mouth at the Liaodong Bay up to the walls of Xiangping. With the water several feet high on level ground, Sima Yi was determined to maintain the siege despite the clamours of his officers who proposed changing camps. Sima Yi executed Zhang Jing (), an officer who kept bringing up the issue, and the rest of the officers became silent. Because of the floods, the encirclement of Xiangping was by no means complete, and the defenders used the flood to their advantage to sail out to forage and pasture their animals. Sima Yi forbade his generals from pursuing the foragers and herders from Xiangping, saying: 

The officials back in the Wei imperial court in Luoyang were also concerned about the floods and proposed recalling Sima Yi. The Wei emperor Cao Rui, being completely certain in Sima Yi's abilities, turned the proposal down. Around this time, the Goguryeo king sent a noble (大加, taeka) and the Keeper of Records (主簿, jubu) of the Goguryeo court with several thousand men to aid Sima Yi.

When the rain stopped and the floodwater drained away, Sima Yi hastened to complete the encirclement of Xiangping. The siege of Xiangping carried on night and day, which utilised mining, hooked ladders, battering rams, and artificial mounds for siege towers and catapults to get higher vantage points. The speed at which the siege was tightened caught the defenders off guard. Since the defenders had been obtaining supplies with such ease during the flood, there apparently was not any real attempt to stockpile the goods inside Xiangping, and as a result famine and cannibalism broke out in the city. Many Liaodong generals, such as Yang Zuo, surrendered to Sima Yi during the siege.

On 3 September, a comet was seen in the skies of Xiangping and was interpreted as an omen of destruction by those in the Liaodong camp. A frightened Gongsun Yuan sent his Chancellor of State Wang Jian () and Imperial Counsellor Liu Fu () to negotiate the terms of surrender, where he promised to present himself bound to Sima Yi once the siege was lifted. Sima Yi, wary of Gongsun Yuan's double-crossing past, executed the two, explaining his actions in a message to Gongsun Yuan that he desired nothing less than an unconditional surrender and "these two men were dotards who must have failed to convey your intentions; I have already put them to death on your behalf. If you still have anything to say, then send a younger man of intelligence and precision." When Gongsun Yuan sent Wei Yan () for another round of talks, this time requesting he be allowed to send a hostage to the Wei court, Sima Yi dismissed the final messenger as a waste of time: "Now that you are not willing to come bound, you are determined to have death; there is no need of sending any hostage." Apparently, Sima Yi's previous suggestion of further negotiations was nothing more than an act of malice that gave false hope to Gongsun Yuan while prolonging the siege and placing further strain on the supplies within the city.

On 29 September, the famished Xiangping fell to the Wei army. Gongsun Yuan and his son Gongsun Xiu (), leading a few hundred horsemen, broke out of the encirclement and fled to the southeast. The main Wei army gave pursuit and killed both father and son on the Liang River (梁水; present-day Taizi River). Gongsun Yuan's head was cut off and sent to Luoyang for public display. A separate fleet, led by future Grand Administrators Liu Xin () and Xianyu Si (), had been sent to attack the Korean commanderies of Lelang and Daifang by sea, and in time, all of Gongsun Yuan's state of Liaodong was subjugated.

Aftermath
Entering the city, Sima Yi assembled all of those who had served in Gongsun Yuan's military and government under two banners. Everyone who had held office in Gongsun Yuan's rebel regime, 1,000 to 2,000 in number, were executed in a systematic purge. In addition, 7,000 people of age 14 and above who had served in Liaodong's army were put to death, their corpses heaped up to form a great mound meant to terrorise those who survived. After the massacre, he pardoned the survivors, posthumously rehabilitated Lun Zhi () and Jia Fan () — two of Gongsun Yuan's subordinates who opposed going to war with Wei — and freed the overthrown Gongsun Gong from jail. Finally, he dismissed the soldiers over 59 years of age from the Wei army on grounds of compassion, numbering over a thousand men, and marched back with the army.

As it was winter, many soldiers were suffering from the cold and wanted extra clothing to keep themselves warm. When someone pointed out that they had a surplus of ru () and suggested giving them out to the soldiers, Sima Yi refused and said that the rus were the property of the Wei government and should not be distributed without permission.

Although he had gained 40,000 households and some 300,000 people for the state of Wei from this expedition, Sima Yi did not encourage these frontier settlers to continue their livelihoods in the Chinese northeast and instead ordered that those families who wished to return to central China be allowed to do so. In April or May 239, a Wu fleet commanded by Sun Yi () and Yang Dao defeated the Wei defenders in southern Liaodong, prompting the Wei imperial court to evacuate the coastal population to Shandong, further accelerating the trend of depopulation in Liaodong. This happened around the same time as the Xianbei chieftain Mohuba was awarded merit for his participation in the campaign against Gongsun Yuan, and his people were allowed to settle in northern Liaodong. By the beginning of the Western Jin dynasty (265-316), the number of Chinese households fell to just 5,400. After the fall of Western Jin, control over Liaodong passed onto Former Yan (337-370), which was founded by Mohuba's descendants, and then to Goguryeo. For several centuries Liaodong would be out of Chinese hands, partly due to the lack of Chinese presence there as a result of the policies that Sima Yi and the Wei court adopted for Liaodong after the fall of the Gongsun.

In the meantime, the removal of the Yan kingdom cleared a barrier between central China and the peoples of the farther east. As early as 239, a mission from the Wa people of Japan under Queen Himiko reached the Wei court for the first time. Goguryeo soon found itself rid of a nuisance that was only to be replaced by a stronger neighbour, and by 242 the alliance between Goguryeo and Cao Wei ended when Goguryeo provoked Wei's wrath by raiding Chinese settlements in Liaodong and Xuantu commanderies. The Goguryeo–Wei Wars of 244 followed, and after two campaigns Cao Wei devastated Goguryeo to such an extent that Goguryeo would take nearly half a century to recover. Cao Wei's victory allowed the Chinese to re-established friendly contact with the Buyeo. These developments could only have happened after Sima Yi's conquest of Liaodong, which, in some sense, represented the first step in recovering Chinese influence in the farther east at the time.

In popular culture
The Liaodong campaign is featured as a playable stage in the seventh installment of Koei's Dynasty Warriors video game series in the newly introduced Jin Dynasty story line.

Notes

References
 Chen, Shou. Records of the Three Kingdoms (Sanguozhi).
 Fang, Achilles. The Chronicles of the Three Kingdoms (220-265): chapters 69-78 from the Tzǔ chih t'ung chien of Ssǔ-ma Kuang (1019-1086). Vol. I. edited by Glen W Baxter. Harvard-Yenching Institute 1952.
 Fang, Xuanling. Book of Jin (Jin Shu).
 Gardiner, K.H.J. "The Kung-sun Warlords of Liao-tung (189-238)". Papers on Far Eastern History 5 (Canberra, March 1972). 59-107.
 Gardiner, K.H.J. "The Kung-sun Warlords of Liao-tung (189-238) - Continued". Papers on Far Eastern History 6 (Canberra, September 1972). 141–201.
 Ikeuchi, Hiroshi. "A Study on Lo-lang and Tai-fang, Ancient Chinese prefectures in Korean Peninsula". Memoirs of the Research Department of the Toyo Bunko 5 (1930). 79–95.
 Pei, Songzhi. Annotations to Records of the Three Kingdoms (Sanguozhi zhu).
 Sima, Guang. Zizhi Tongjian.

238
Campaigns of the Three Kingdoms
Wars involving Goguryeo
Military history of Liaoning