The history of Sino-Korean relations dates back to prehistoric times, which has been marked by both periods of cooperation and antagonism. The Han dynasty conquered Gojoseon in the 2nd century and the established of the Four Commanderies of Han in the northern portion of the Korean Peninsula. The Korean kingdom of Goguryeo aided Sima Yi of Cao Wei led a successful campaign against his rival Gongsun Yuan. The alliance later broke down, starting the Goguryeo–Wei War, which ended in Cao Wei victory. Later, taking advantage of Wei weakness, Goguryeo eventually reconquered the former territories of Gojoseon. The Sui dynasty launched four unsuccessful campaigns in the 7th century to subdue Goguryeo; Sui's defeats in Korea contributed to the collapse of the dynasty. Goguryeo fought further wars with the Tang dynasty, which allied with the Korean kingdom of Silla. Tang and Silla eventually prevailed over Goguryeo, leading Tang to establish the Protectorate General to Pacify the East. Unified Silla and Tang fought a war subsequently, in which Silla prevailed. Silla fell to Goryeo in 935.
The Khitan-led Liao dynasty of China fought a war with Goryeo, in which Goryeo prevailed, gaining parts of the northern Korean peninsula from Liao in exchange for submitting tribute. The Song regarded Goryeo as a potential military ally and maintained friendly relations as equal partners. In 1115 the Jurchen founded the Jin dynasty, and in 1125 Jin annihilated Liao and started invasion of Song, leading Goryeo to declare itself to be a tributary state of Jin in 1126. During the 13th century, the Mongol Empire invaded China and defeated the Jin and Song dynasties; the Mongol-led Yuan dynasty invaded Korea from 1231 to 1259, with the Yuan prevailing. After Yuan rule began to destabilize, King Gongmin of Goryeo seized the opportunity to rebel and declared Goryeo's independence. Following the fall of the Yuan and the emergence of the Ming dynasty in 1368, a proposed attack against the Ming resulted in a coup d'état led by General Yi Sŏnggye that ended the Goryeo dynasty and the establishment of the Joseon; Ming gave up competing territorial claims while Joseon accepted tributary status.
The Ming had assisted Joseon during Toyotomi Hideyoshi's invasion of Korea, in which the Wanli Emperor sent a total of 221,500 troops. Joseon had also used Classical Chinese as a common script alongside Korean, and its central government was modelled after the Chinese system. The Later Jin dynasty and its successor Qing dynasty, which replaced the Ming, invaded Joseon twice, in 1627 and 1636, forcing Injo of Joseon into submission. Following the First Sino-Japanese War. the Qing dynasty lost tributary relations with Korea diplomatic relations between the Qing dynasty and the Korean Empire were established in 1899, but relations were halted in 1905 as a result of the Eulsa Treaty that made Korea a Japanese protectorate and which was then annexed by the Japan in 1910. Later, the Chinese government recognized the formation of the Provisional Government of the Republic of Korea in 1919. Following Japan's surrender, Korea was split into North Korea and South Korea. Bilateral diplomatic relations between South Korea and the Republic of China were established in 1948, making the ROC the first country to recognize the Republic of Korea as the sole legitimate government of Korea. The People's Republic of China, established in 1949, recognized only the Democratic People's Republic of Korea during the Cold War, and backed the country against South Korea during the Korean War. In the 1980s, relations between the PRC and South Korea warmed, and the two countries established diplomatic relations in 1992.
Han and Gojoseon According to Samguk yusa, Dangun Joseon was the first state that represented Korean cultural identity. Although controversial, a legend tells that in around 1100 BC a Chinese sage named Jizi (Gija) and his intellectuals fled from the Shang dynasty to avoid political turmoil and sought asylum in Gojoseon, and active cultural trades ensued after. The "Monograph on Geography" (Dili zhi 地理志) of the Book of Han (1st century AD) claims that Jizi had taught the people of Joseon agriculture, sericulture, and weaving, as well as proper ceremony.. Original text: 殷道衰,箕子去之朝鮮,教其民以禮義,田蠶織作 (Hanshu 漢書 [Book of Han], chapter 28.2, p. 1658 of the standard Zhonghua shuju edition). Jae-hoon Shim interprets the following sentence in that section of the Hanshu as claiming that Jizi also introduced the law of "Eight Prohibitions" (犯禁八條) in Joseon.. Original text: 樂浪朝鮮民犯禁八條:相殺以當時償殺;相傷以穀償;相盜者男沒入為其家奴,女子為婢,欲自贖者,人五十萬 (Hanshu 漢書 [Book of Han], chapter 28.2, p. 1658 of the standard Zhonghua shuju edition). The Records of Three Kingdoms (late 3rd century AD) and other later documents interpret these "Eight Prohibitions" as Jizi's teachings, but it is also possible that the Hanshu was describing the early phase of Lelang Commandery, and not Jizi's initiatives. The Records of Three Kingdoms (first published in the early fifth century) claims that the descendants of Jizi reigned as kings of Joseon for forty generations until they were overthrown by Wei Man, a man from the state of Yan, in 194 BC.. Record of Three Kingdoms (chapter 30, p. 848): 昔箕子既適朝鮮,作八條之教以教之,無門戶之閉而民不為盜。其後四十餘世,朝鮮侯準僭號稱王. The overthrowing of the kings of Joseon by Wei Man is also recorded in the Brief History of Wei (third century), which is cited in Sanguozhi, chapter 30, p. 850.
According to his commentary to the Shiji, Du Yu (first half of the 3rd century) states that the tomb of Jizi was located in Meng Prefecture of the State of Liang (modern-day Henan). This suggests that the story of Jizi's association with Joseon was not necessarily prevailing although the narrative seen in the Hanshu later became common.
As historian Jae-hoon Shim concludes, only during the Han dynasty (206 BC – 220 AD) did Jizi begin to be associated with Joseon, and only after the Han were his descendants identified as the Joseon royal family.. Jizi remains a controversial figure, due in part to the difficulty of verifying his existence. Only in the thirteenth century did Korean texts start to integrate Gija more fully into Korean history. The Samguk yusa (1281) explained that after being enfeoffed by King Wu of Zhou, Gija replaced Dangun's descendants as the ruler of Joseon, whereas Jewang Ungi (1287) identified Dangun and Gija as the first rulers of former and latter Joseon respectively.. Most premodern Korean historians after that accepted that Jizi had replaced another indigenous power (represented by Dangun) in Old Joseon. Nonetheless, the Jizi Mythology plays a defining role in explaining the pre-modern relationship between Korea and China.
In 194 BC, Wei Man, a Chinese general from Yan state, sought refugee along with Yan immigrants in Gojoseon following Qin's wars of unification that ended the centuries long Warring States period and established the first highly centralized, unified state in Chinese history. Wi Man was given a duty to guard borders in the Liaodong Peninsula by Gojoseon. Wei Man eventually became a leader of new immigrants and indigenous population as his Chinese refugee population introduced Chinese technology into Gojoseon while adopting Korean traditions and clothing. Eventually his growing popularity allowed him to usurp the throne of King Jun who fled south to Jin. The expanding military might and technological growth of Wiman Joseon soon threatened Han China, and the diplomatic relationship between the two countries deteriorated quickly. Wi Man's grandson, King Ugeo of Gojoseon, sparked conflict when he refused to let Gojoseon's southern neighboring state, Jin, send its ambassadors through Gojoseon's territory in order to reach the Han dynasty.
The Gojoseon–Han War occurred around 109 BC(2nd Century ADE). When Emperor Wu of Han sent an ambassador She He (涉何) to Wanggeom-seong to negotiate Jin's right of passage through Gojoseon. King Ugeo refused and had his son, Prince Wi Jang (長降) whose task was to escort the ambassador back home. However, when they got close to Han's borders, the ambassador assassinated Wi Jang (長降) and claimed to Emperor Wu that he had defeated Joseon in battle. Emperor Wu, unaware of this deception, made him the military commander of the Commandery of Liaodong. The outraged King Ugeo made a raid on Liaodong(province in Northeast China) and killed She He. Scholars also hypothesize that the initiation of war may also have been because the Han dynasty was concerned that Gojoseon would ally with the Xiongnu against the Han.
As a result, the Han dynasty launched a two-pronged attack, one by land and one by sea, against Gojoseon which totaled to at least 50,000 soldiers. The two forces attacking Gojoseon were unable to coordinate well with each other and the majority of the 50,000 strong force was destroyed. When Emperor Wu received news of these defeats, he wished to reestablish peaceful relations between Han and Gojoseon which King Ugeo agreed to. King Ugeo sent his son and a gift of 5,000 horses to the Han court to pay tribute and bring about peaceful negotiations. However, when the prince and his escort of 10,000 soldiers reached the Yalu River, Han General Xun Zhi reasoned that they should lay down arms. The prince suspected that Xun Zhi was planning on murdering him and so went back to Wanggeom-seong, resuming the war.
The second Han invasion of Gojoseon fared much better, and by 108 BC Wanggeom fell to Han forces after a months long siege with most of the Gojoseon leadership either surrendering to the Han or killed. Han took over the Gojoseon lands and established Four Commanderies of Han in the western part of former Gojoseon.Jae-eun Kang, The Land of Scholars: Two Thousand Years of Korean Confucianism, Homa & Sekey Books, 2006, pp. 28–31
The Han dynasty's ultimate victory resulted in the defeat of Gojoseon and the establishment of the Four Commanderies of Han. Chinese now found control over its northeast frontier and northern Korea, which resulted in provoked unity among the local tribes and indigenous population, and the establishment of Goguryeo on the Korea Peninsula, which took advantage of Chinese conflict with the Xiongnu to expand into Liaodong. Goguryeo eventually reconquered the former territories of Gojoseon(those territories being the province of Liaodong in Northeastern China), then proceeded to keep expanding in all directions.
Cao Wei and Goguryeo In 238, Sima Yi of Cao Wei led a successful campaign against his rival Gongsun Yuan, with the aid of Goguryeo. This led to the Chinese recapture of Liaodong as well as establishing great contacts with Korean kingdoms. By 242, the alliance between Cao Wei and Goguryeo broke down when Dongcheon of Goguryeo initiated a raid into Wei territory. In response, the Goguryeo–Wei War erupted in 244, and the Cao Wei launched two successful campaigns against Goguryeo. During the first campaign, Chinese General Guanqiu Jian led 10,000 infantry and cavalry into Goguryeo and was met by King Doncheon's army of 20,000 at the Battle of Liangkou. Sources differ on the details of the battle itself. Korean sources such as the Samguk sagi claiming that Goguryeo initially won the first two of the three battles at Liangkou and inflicting 6,000 Chinese losses before the Cao Wei counterattacked and inflicted 18,000 Korean losses. Meanwhile, Chinese sources claim that the Korean forces repeatedly lost the engagements before being routed. Regardless of the details, all sources agree that the Cao Wei decisively triumphed over Goguryeo forces by the end of the first campaign,