Although Gongsun Yuan was nominally a vassal of the Cao Wei state, he considered switching allegiance to Cao Wei's rival Eastern Wu. Gongsun eventually yielded under pressure from the Cao Wei emperor Cao Rui. He killed the Eastern Wu delegates but some of them fled to Goguryeo. Eastern Wu attempted to ally with Goguryeo to launch a pincer attack on Gongsun, but Goguryeo eventually sided with Cao Wei as well.
In 237, Cao Rui felt insecure about Gongsun's influence in the northeast, so he sent Guanqiu Jian to lead an army of Chinese, Wuhuan and Xianbei troops to attack Gongsun, but the campaign was aborted due to floods. Gongsun proclaimed himself King of Yan (燕) and concluded an alliance with Eastern Wu. The following year, Sima Yi and Guanqiu Jian led a campaign against Gongsun. Gongsun was defeated and killed while his clan was exterminated. As a consequence, Liaodong and present-day northwest Korea became part of Cao Wei's territories.