History of Sino–Korean relations
The history of Sino-Korean relations dates back to prehistoric times.

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. 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. 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.

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);lack of information means this date might not be 100% accurate. 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.

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, 
which finally ended with the sacking of the Goguryeo capital and resettlement of many of its inhabitants. Goguryeo fared little better during the second campaign, which was largely marked by King Dongcheon desperately fleeing deeper into the Korean peninsula to evade Cao Wei forces. Although Goguryeo forces and their allied tribes were unable to defeat the Cao Wei in battle, Chinese forces overextended themselves deep inside Korea, and finally decided to withdraw despite multiple victories over Goguryeo and their allies such as Okjeo.

So great was the defeat that Goguryeo faded from Chinese historical records for nearly half a century before it finally recovered its strength. According to the Korean source 15 years later Goguryeo defeated Wei at Yangmaenggok.

The history of Goguryeo in the latter half of the 3rd century was characterized by Goguryeo's attempts to consolidate nearby regions and restore stability as it dealt with rebellions and foreign invaders that resulted from Wei's victorious campaign against Goguryeo, including Wei again during 259 in which Goguryeo defeated Wei at Yangmaek, and the Sushen during 280 in which Goguryeo launched a counterattack on the Sushen and occupied their capital.

According to the Samguk Sagi, during the Wei invasion in 259, King Jungcheon assembled 5,000 of his elite cavalry and defeated the invading Wei army at a valley in Yangmaek, killing 8,000 enemies. Goguryeo's fortunes rose again during King Micheon's rule (300-331), when the king took advantage of the weakness in Wei's successor the Jin dynasty and wrestled the commanderies of Lelang and Daifang from central Chinese control. After more than seventy years of recovery, Goguryeo had finally transformed into a proper Korean Empire as it integrated various tribal communities of the Okjeo and Dongye.

In terms of historiography, the expeditions of the second campaign are significant for providing detailed information on the various Korean tribes and peoples of the Korean Peninsula and Manchuria, such as Goguryeo, Buyeo, Okjeo, Ye, and Yilou. The expedition, unprecedented in scale in those regions, brought first-hand knowledge about the topography, climate, population, language, manners, and customs of these areas to Chinese cognizance, and was duly recorded into the Weilüe by the contemporary historian Yu Huan. Though the original Weilüe is now lost, its contents were preserved in the Records of Three Kingdoms, where the reports from the Goguryeo expedition are included in the "Chapter on Eastern Barbarians" (東夷傳, Dongyi Zhuan) — considered the most important single source of information for the culture and society of early states and peoples on the Korean Peninsula.

The Xianbei-ruled Former Yan dynasty sacked the Goguryeo capital and made the king pay tribute. However, Goguryeo triumphed over the Xianbei decades later when Gwanggaeto the Great defeated Later Yan and conquered Liaodong and most of Manchuria.

Sui, Tang, Goguryeo and Balhae 
Sui dynasty launched four unsuccessful campaigns to subdue Goguryeo. The Emperor Yang of Sui wanted to establish a Sui-led order in East Asia after unifying China proper. Goguryeo opposed this and started to prepare for defense against Sui dynasty.  The Sui Dynasty's reunification of China for the first time in centuries was met with alarm in Goguryeo, and Pyeongwon of Goguryeo began preparations for a future war by augmenting military provisions and training more troops. Although Sui was far larger and stronger than Goguryeo, the Baekje-Silla Alliance which had previously driven Goguryeo from the Han Valley in the mid 6th century had fallen apart, and thus Goguryeo's southern border was secure. Initially, Goguryeo tried to appease Sui by offering tribute as Korean kingdoms had done under the Tributary system of China. However, Goguryeo continued insistence on an equal relationship with Sui, its reinstatement of the imperial title "Taewang" (Emperor in Korean) of the East and its continued raids into Sui territory greatly angered the Sui Court. Furthermore, Silla and Baekje, both under threat from Goguryeo, requested Sui assistance against Goguryeo as all three Korean kingdoms had desired to seize the others' territories to rule the peninsula, and attempted to curry Sui's favor to achieve these goals.

Goguryeo's expansion and its attempts to equalize the relationship conflicted with Sui China and increased tensions. In 598, Goguryeo made a preemptive attack on Liaoxi which led to the Battle of Linyuguan, but was beaten back by Sui forces. This caused Emperor Wen to launch a counterattack by land and sea that ended in disaster for Sui. As a result, the Sui launched a series of invasions that took place in the years 598, 612, 613, and 614.

Sui's most disastrous campaign against Goguryeo was in 612, in which Sui, according to the History of the Sui Dynasty, mobilized 30 division armies, about 1,133,800 combat troops. Pinned along Goguryeo's line of fortifications on the Liao River, a detachment of nine division armies, about 305,000 troops, bypassed the main defensive lines and headed towards the Goguryeo capital of Pyongyang to link up with Sui naval forces, who had reinforcements and supplies.

However, Goguryeo was able to defeat the Sui navy, thus when the Sui's nine division armies finally reached Pyongyang, they didn't have the supplies for a lengthy siege. Sui troops retreated, but General Eulji Mundeok led the Goguryeo troops to victory by luring the Sui into an ambush outside of Pyongyang. At the Battle of Salsu, Goguryeo soldiers released water from a dam, which split the Sui army and cut off their escape route. Of the original 305,000 soldiers of Sui's nine division armies, it is said that only 2,700 escaped to Sui China.

The 613 and 614 campaigns were aborted after launch—the 613 campaign was terminated when the Sui general Yang Xuangan rebelled against Emperor Yang, while the 614 campaign was terminated after Goguryeo offered a truce and returned Husi Zheng (斛斯政), a defecting Sui general who had fled to Goguryeo, Emperor Yang later had Husi executed. Emperor Yang planned another attack on Goguryeo in 615, but due to Sui's deteroriating internal state he was never able to launch it. Sui was weakened due to rebellions against Emperor Yang's rule and his failed attempts to conquer Goguryeo. They could not attack further because the provinces in the Sui heartland would not send logistical support.

Emperor Yang's disastrous defeats in Korea greatly contributed to the collapse of the Sui dynasty.

Goguryeo also engaged in many wars with the Tang dynasty, but it eventually lost as Silla took side with the Tang in the Goguryeo–Tang War. In the winter of 642, King Yeongnyu was apprehensive about Yeon Gaesomun, one of the great nobles of Goguryeo, and plotted with other officials to kill him. However, Yeon Gaesomun caught news of the plot and killed Yeongnyu and 100 officials, initiating a coup d'état. He proceeded to enthrone Yeongnyu's nephew, Go Jang, as King Bojang while wielding de facto control of Goguryeo himself as the generalissimo (). At the outset of his rule, Yeon Gaesomun took a brief conciliatory stance toward Tang China. For instance, he supported Taoism at the expense of Buddhism, and to this effect in 643, sent emissaries to the Tang court requesting Taoist sages, eight of whom were brought to Goguryeo. This gesture is considered by some historians as an effort to pacify Tang and buy time to prepare for the Tang invasion Yeon thought inevitable given his ambitions to annex Silla.

However, Yeon Gaesomun took an increasingly provocative stance against Silla Korea and Tang China. Soon, Goguryeo formed an alliance with Baekje and invaded Silla, Daeya-song (modern Hapchon) and around 40 border fortresses were conquered by the Goguryeo-Baekje alliance. Since the early 7th century, Silla had been forced on the defensive by both Baekje and Goguryeo, which had not yet formally allied but had both desired to erode Sillan power in the Han Valley. During the reign of King Jinpyeong of Silla, numerous fortresses were lost to both Goguryeo and the continuous attacks took a toll on Silla and its people. During Jinpyeong's reign, Silla made repeated requests beseeching Sui China to attack Goguryeo. Although these invasions were ultimately unsuccessful, in 643, once again under pressure from the Goguryeo–Baekje alliance, Jinpyeong's successor, Queen Seondeok of Silla, requested military aid from Tang. Although Taizong had initially dismissed Silla's offers to pay tribute and its requests for an alliance on account of Seondeok being a woman, he later accepted the offer due to Goguryeo's growing belligerence and hostile policy towards both Silla and Tang. In 644, Tang began preparations for a major campaign against Goguryeo.

In 645, Emperor Taizong, who had a personal ambition to defeat Goguryeo and was determined to succeed where Emperor Yang had failed, personally led an attack on Goguryeo. The Tang army captured a number of Goguryeo fortresses, including the important Yodong/Liaodong Fortress (遼東城, in modern Liaoyang, Liaoning). During his first campaign against Goguryeo, Taizong famously showed generously to the defeated inhabitants of numerous Goguryeo fortresses, refusing to permit his troops to loot downs and enslave inhabitants and when faced with protest from his commanders and soldiers, rewarded them with his own money. Ansi City (in modern Haicheng, Liaoning), which was the last fortress that would clear the Liaodong Peninsula of significant defensive works and was promptly put under siege. Initially, Taizong and his forces achieve great progress, when his numerically inferior force smashed a Goguryeo relief force at the Battle of Mount Jupil. Goguryeo's defeat at Mount Jupil had significant consequences, as Tang forces killed over 20,000 Goguryeo soldiers and captured another 36,800, which crippled Goguryeo's manpower reserves for the rest of the conflict. However, the capable defense put up by Ansi's commanding general (whose name is controversial but traditionally is believed to be Yang Manchun) stymied Tang forces and, in late fall, with winter fast approaching and his supplies running low, Tang forces under the command Prince Li Daozong attempted to build a rampart to seize the city in a last ditch effort, but was foiled when Goguryeo troops managed to seize control of it. Afterwards, Taizong decided to withdraw in the face of incoming Goguryeo reinforcements, deteriorating weather conditions and the difficult supply situation. The campaign was unsuccessful for the Tang Chinese, failing to capture Ansi Fortress after a protracted siege that lasted more than 60 days. Emperor Taizong invaded Goguryeo again in 647 and 648, but was defeated both times.

Emperor Taizong prepared another invasion in 649, but died in the summer, possibly due to an illness he contracted during his Korean campaigns. His son Emperor Gaozong continued his campaigns. Upon the suggestion of Kim Chunchu, the Silla–Tang alliance first conquered Baekje in 660 to break up the Goguryeo–Baekje alliance, and then turned its full attention to Goguryeo. However, Emperor Gaozong, too, was unable to defeat Goguryeo led by Yeon Gaesomun; one of Yeon Gaesomun's most notable victories came in 662 at the Battle of Sasu (蛇水), where he annihilated the Tang forces and killed the invading Nanman general Pang Xiaotai (龐孝泰) and all 13 of his sons. Therefore, while Yeon Gaesomun was alive, Tang could not defeat Goguryeo.

In the summer of 666, Yeon Gaesomun died of a natural cause and Goguryeo was thrown into chaos and weakened by a succession struggle among his sons and younger brother. He was initially succeeded as Dae Mangniji, the highest position newly made under the ruling period of Yeon Gaesomun, by his oldest son Yeon Namsaeng. As Yeon Namsaeng subsequently carried out a tour of Goguryeo territory, however, rumors began to spread both that Yeon Namsaeng was going to kill his younger brothers Yeon Namgeon and Yeon Namsan, whom he had left in charge at Pyongyang, and that Yeon Namgeon and Yeon Namsan were planning to rebel against Yeon Namsaeng. When Yeon Namsaeng subsequently sent officials close to him back to Pyongyang to try to spy on the situation, Yeon Namgeon arrested them and declared himself Dae Mangniji, attacking his brother. Yeon Namsaeng sent his son Cheon Heonseong (泉獻誠), as Yeon Namsaeng changed his family name from Yeon (淵) to Cheon (泉) observe naming taboo for Emperor Gaozu, to Tang to seek aid. Emperor Gaozong saw this as an opportunity and sent an army to attack and destroy Goguryeo. In the middle of Goguryeo's power struggles between Yeon Gaesomun's successors, his younger brother, Yeon Jeongto, defected to the Silla side.

In 667, the Chinese army crossed the Liao River and captured Shin/Xin Fortress (新城, in modern Fushun, Liaoning). The Tang forces thereafter fought off counterattacks by Yeon Namgeon, and joined forces with and received every possible assistance from the defector Yeon Namsaeng, although they were initially unable to cross the Yalu River due to resistance. In spring of 668, Li Ji turned his attention to Goguryeo's northern cities, capturing the important city of Buyeo (扶餘, in modern Nong'an, Jilin). In fall of 668, he crossed the Yalu River and put Pyongyang under siege in concert with the Silla army.

Yeon Namsan and Bojang surrendered, and while Yeon Namgeon continued to resist in the inner city, his general, the Buddhist monk Shin Seong (信誠) turned against him and surrendered the inner city to Tang forces. Yeon Namgeon tried to commit suicide, but was seized and treated. This was the end of Goguryeo, and Tang annexed Goguryeo into its territory, with Xue Rengui being put initially in charge of former Goguryeo territory as protector general. The violent dissension resulting from Yeon Gaesomun's death proved to be the primary reason for the Tang–Silla triumph, thanks to the division, defections, and widespread demoralization it caused. The alliance with Silla had also proved to be invaluable, thanks to the ability to attack Goguryeo from opposite directions, and both military and logistical aid from Silla. The Tang established the Andong Protectorate on former Goguryeo lands after the latter's fall.

However, there was much resistance to Tang rule (fanned by Silla, which was displeased that Tang did not give it Goguryeo or Baekje's territory), and in 669, following Emperor Gaozong's order, a part of the Goguryeo people were forced to move to the region between the Yangtze River and the Huai River, as well as the regions south of the Qinling Mountains and west of Chang'an, only leaving old and weak inhabitants in the original land. Some people entered the service of the Tang government, such as Go Sagye and his son Gao Xianzhi (Go Seonji in Korean), the famed general who commanded the Tang forces at the Battle of Talas.

Silla thus unified most of the Korean peninsula in 668, but the kingdom's reliance on China's Tang Dynasty had its price. Tang set up the Protectorate General to Pacify the East, governed by Xue Rengui, but faced increasing problems ruling the former inhabitants of Goguryeo, as well as Silla's resistance to Tang's remaining presence on the Korean Peninsula. Silla had to forcibly resist the imposition of Chinese rule over the entire peninsula, which lead to the Silla–Tang Wars, but their own strength did not extend beyond the Taedong River.

Later, Tang China considered Balhae as a tributary state, whereas Balhae strongly opposed such view. As the Emperor of China saw himself as the emperor of the entire civilized world, it was not possible for such an emperor to have equal diplomatic relations with any other regional powers, and as such all diplomatic relations in the region were construed by the Chinese as tributary regardless of the intention of those regions.

Liao, Jin, Song and Goryeo 

During this time North China was ruled by the Khitan-led Liao dynasty followed by the Jurchen-led Jin dynasty. Although Liao initially attempted to maintain friendly relations with Goryeo, the Liao's destruction of Goryeo's predecessor, Balhae, led to lingering resentments within the Korean court in Kaesong. As descendants of Goguryeo, the Balhae people and the Goryeo dynasties were related. Taejo of Goryeo, Goryeo's first King, felt a strong familial kinship with Balhae, calling it his "relative country" and "married country", and protected the Balhae refugees following the Liao Conquest of Balhae. This was in stark contrast to Later Silla, which had endured a hostile relationship with Balhae. Taejo displayed strong animosity toward the Khitans who had destroyed Balhae. The Liao dynasty sent 30 envoys with 50 camels as a gift in 942, but Taejo exiled the envoys to an island and starved the camels under a bridge, in what is known as the "Manbu Bridge Incident". Taejo proposed to Gaozu of Later Jin that they attack the Khitans in retribution for Balhae, according to the Zizhi Tongjian. Furthermore, in his Ten Injunctions to his descendants, he stated that the Khitans are "savage beasts" and should be guarded against. Khitan conquest of Balhae resulted in Goryeo's prolonged hostility towards the Khitan Empire.

As a result of the hostile relationship, the Liao invaded Goryeo and waged a series of wars from 993 to 1019. Goryeo triumphed over the Liao dynasty in early 11th century and gained parts of the northern Korean peninsula from Liao in exchange for submitting tribute. Following the Goryeo–Khitan War, a balance of power was established in East Asia between Goryeo, Liao, and Song. With its victory over Liao, Goryeo was confident in its military ability and no longer worried about a Khitan military threat. Fu Bi, a grand councilor of the Song dynasty, had a high estimate of Goryeo's military ability and said that Liao was afraid of Goryeo. Furthermore, regarding the attitude of the Koreans, he said: "Among the many tribes and peoples which, depending on their power of resistance, have been either assimilated or made tributary to the Khitan, the Koreans alone do not bow their heads." Song regarded Goryeo as a potential military ally and maintained friendly relations as equal partners. Meanwhile, Liao sought to build closer ties with Goryeo and prevent a Song–Goryeo military alliance by appealing to Goryeo's infatuation with Buddhism, and offered Liao Buddhist knowledge and artifacts to Goryeo. During the 11th century, Goryeo was viewed as "the state that could give either the Song or Liao military ascendancy". When imperial envoys, who represented the emperors of Liao and Song, went to Goryeo, they were received as peers, not suzerains. Goryeo's international reputation was greatly enhanced. Beginning in 1034, merchants from Song and envoys from various Jurchen tribes and the Tamna kingdom attended the annual Palgwanhoe in Kaesong, the largest national celebration in Goryeo; the Song merchants attended as representatives of China while the Jurchen and Tamna envoys attended as members of Goryeo's tianxia.

Goryeo had a complex relationship with the Jurchens, who would later go on to form the Jin dynasty (1115-1234). Jurchens in the Yalu River region were tributaries of Goryeo since the reign of Wang Geon, who called upon them during the wars of the Later Three Kingdoms period, but the Jurchens switched allegiance between Liao and Goryeo multiple times, taking advantage of the tension between the two nations; posing a potential threat to Goryeo's border security, the Jurchens offered tribute to the Goryeo court, expecting lavish gifts in return. 

The Jurchens north of Goryeo had traditionally rendered tribute to the Goryeo monarchs and called Goryeo their "parent country" considering past ties between Goguryeo and its Mohe subjects, but thanks to the defeat of Liao to the Koreans in 1019, the Wanyan tribe of the Heishui Mohe unified the Jurchen tribes and gained in might, taking advantage of the power vacuum.

At the peak of its power, Goryeo contested with the rising Wanyan tribes of which Goryeo considered them as barbaric vassals descending from the Mohe people that served their Goguryeo ancestors, in the state of total war over former territories of Goguryeo and Balhae. This was in sharp contrast with the more positive perceptions the Jurchens had of Goryeo. For example, the annals of King Yejong (r. 1105–1122) in the History of Goryeo report that Wanyan Wugunai's son Yingge (盈歌; 1053–1103) considered Goryeo as his "parent country" () because his clan's ancestor Hanpu had come from Goryeo. Although this could have been because of the Jurchens' desire for Goryeo aid against their rivals, as historians are unsure if Hanpu, the progenitor of the Jurchen Jin dynasty's royal family who was from Goryeo, was ethnically Silla, Goryeo, Balhae or Jurchen.

As the geopolitical situation began to shift in turbulence by the start of the 12th century, Goryeo unleashed two major military campaigns from 1104 to 1109 spearheaded by the ambitious King Yejong with vows of reclaiming former Goguryeo territories held by Jurchen tribes united under the progenitors of the Jin dynasty, Wanyan Wuyashu and Aguda, with the aims of also preventing potential aggressions from the Jurchen tribes. Led by prominent generals such as Yun Kwan and  Ch'ŏk Chun-gyŏng (), the well-trained Byeolmuban (別武班; "Special Warfare Army") of approximately 250,000 men initially succeeded in ravaging Jurchen territories and building the strategic "Nine Fortresses" (동북 9성, 東北九城) of which exact locations are still topics of debate. Following the invasion, numerous Jurchen tribes surrendered to the invading Korean forces but many stayed vigilant and resumed fierce resistance led by the Wanyan tribe, complicating the phase of the war. Despite the Koreans of Goryeo having proceeded to utilizing scorched earth tactics, the Jurchen tribes under the leadership of Wanyan Wuyashu achieved a pyrrhic victory as Goryeo considered securing the Nine Fortresses too costly albeit having the upper hand in the war. Contacted by the Jurchens of the Wanyan tribe that have tasted the bitterness as well of facing Korean forces in their homes for peace, Goryeo would eventually move on to reluctantly signing a peace agreement with the Wanyan tribe and later on cede the Nine Fortresses to Wuyashu, in return for tributes sent by the Jurchens, the full repatriation of Korean settlers, and the guarantee of nonaggression. Though the objective of reclaiming former ancestral lands failed, Goryeo managed to maintain peaceful relations with the Jin dynasty which progress in conquering the Liao and Northern Song dynasty respectively.

During the reign of Jurchen leader Wuyashu in 1103–1113, the border between the two nations was stabilized and Korean forces withdrew from Jurchen territories, acknowledging Jurchen control over the contested region.

In 1115 the Jurchen founded the Jin dynasty, and in 1125 Jin annihilated Liao, which was Goryeo's suzerain, and started invasion of Song. In response to the circumstantial changes, Goryeo declared itself to be a tributary state of Jin in 1126. After that, peace was maintained and Jin never actually did invade Goryeo. As a result, Goryeo paid tribute to the Jin to maintain friendly relations and trade.

Yuan and Goryeo 
During the 13th century, the Mongol Empire invaded China and defeated the Jin and Song dynasties. In 1271, Kublai Khan proclaimed the Yuan dynasty of China in the traditional Chinese style. During the period of 1231–1259, the Yuan dynasty invaded Korea. Goryeo endured six devastating invasions at tremendous cost to civilian lives throughout the Korean Peninsula, and numerous cultural artifacts such as the Tripitaka Koreana and the Hwangnyongsa. The hardships endured by the Goryeo people and the destruction of the country in the face of the invasions ultimately resulting in the capitulation of Goryeo and becoming a tributary state of the Yuan dynasty for 86 years until achieving its independence in 1356. As a stipulation of the peace treaty, the Mongols annexed the northern areas of Korean Peninsula after the invasions and incorporated them into their empire as Ssangseong Prefectures and Dongnyeong Prefectures.
Once the treaty was concluded and vassaldom established, intermarriage between the Koreans and Mongols was encouraged by the Mongol Empire. After the death of Wonjong in 1274, his successor Chungnyeol of Goryeo received Kublai's daughter Qutlugh-Kelmish as a wife, and his reign began a wholesale Mongolization of the Korean court that continued until the middle of the 14th century. On paper, the official protocol for Korea was that of a subordinate principality, and Korean rulers made lengthy stays at the Mongol Yuan court, both before and after their coronation. In addition, their Mongol wives, and even concubines, exerted great influence over Goryeo politics. For instance, Bayankhutag, Princess Gyeonghwa selected officials for posts within the Goryeo government. The Mongols and the Kingdom of Goryeo became linked via marriage and Goryeo became a quda (marriage alliance) state of the Yuan dynasty; monarchs of Goryeo during this period were effectively imperial sons in-law (khuregen). The effects of intermarriage on Mongol-Goryeo relations worked both ways: during the reign of Kublai Khan, King Chungnyeol of Goryeo married one of Kublai's daughters; later, a court lady from Korea called the Empress Gi became an empress through her marriage with Ukhaantu Khan, and her son, Biligtü Khan of the Northern Yuan dynasty, became a Mongol Khan. Furthermore, the kings of Goryeo held an important status within the Mongol imperial hierarchy, much like other important families of conquered or client states of the Mongol Empire (e.g. the Uyghurs, the Oirats, and Khongirad).

The Mongols extracted tribute from throughout their empire. From Goryeo, they received gold, silver, cloth, grain, ginseng, and falcons. The tribute payments were a burden on Goryeo and subjugated polities in the empire. As with all parts of the Mongol Empire, Goryeo provided palace women, eunuchs, Buddhist monks, and other personnel to the Mongols. Korean concubines were procured by the Khan. One of them was Empress Gi, who, through her political command and incorporation of Korean females and eunuchs in the court, spread Korean clothing, food, and lifestyle in the capital. It became prestigious to marry Korean women among members of the Yuan elite. The entry of Korean women into the Mongol court was reciprocated by the entry of Mongol princesses into the Korean court, beginning with the marriage of Chungnyeol of Goryeo and a daughter of Kublai Khan; in total, 9 princesses of the Yuan court married into the Goryeo royal family.

During Yuan rule, Korea was effectively forced to serve as a Mongol military base. Mongol ambitions on Japan resulted in two invasions of Japan. In both efforts, the Mongols directed Korean shipbuilding and militarization towards the amphibious assault of the Japanese coasts and pressed a large proportion of Korean naval and infantry forces into the service of Mongol military objectives. Korea supplied 770 fully manned ships and 5,000 soldiers in 1274 and 900 ships and 10,000 soldiers in 1281. Yuan officials and envoys took concubines and wives in Korea while they were stationed in Korea for the invasion of Japan. For a variety of reasons, both invasions failed.

As Yuan rule began to destabilize in China, King Gongmin of Goryeo seized the opportunity to rebel and declared Goryeo's independence after decades of Mongol rule. Furthermore, Gongmin regained Goryeo's northern territories and Goryeo would even briefly invade Liaodong after it regained its independence. The Yuan dynasty eventually fell in 1368.

Ming and Joseon 
Following the emergence of the Ming dynasty in 1368, when it overthrew the Mongol Yuan dynasty, the royal court in Goryeo split into two conflicting factions, one supporting the Ming and the other standing by the Yuan. In 1388, a Ming messenger came to Goryeo to demand that territories of the former Ssangseong Prefectures be handed over to Ming China. The tract of land was taken by Mongol forces during the invasion of Korea, but had been reclaimed by Goryeo in 1356 as the Yuan dynasty weakened. The act caused an uproar among the Goryeo court, and General Ch'oe Yŏng seized the chance to argue for an invasion of the Ming-controlled Liaodong Peninsula.

General Yi Seong-gye was chosen to lead the attack; he revolted, swept back to the capital Gaegyeong (present-day Kaesong) and initiated a coup d'état, overthrowing King U in favor of his son, Chang of Goryeo (1388). He later killed King U and his son after a failed restoration and forcibly placed a royal named Wang Yo on the throne (he became King Gongyang of Goryeo). In 1392, Yi eliminated Jeong Mong-ju, highly respected leader of a group loyal to Goryeo dynasty, and dethroned King Gongyang, exiling him to Wonju, and he ascended the throne himself. The Goryeo kingdom had come to an end after 474 years of rule.

In the beginning of his reign, Yi Seong-gye, now ruler of Korea, intended to continue to use of the name Goryeo for the country he ruled and simply change the royal line of descent to his own, thus maintaining the façade of continuing the 500-year-old Goryeo tradition. After numerous threats of mutiny from the drastically weakened but still influential Gwonmun nobles, who continued to swear allegiance to the remnants of the Goryeo and to the now-demoted Wang clan, the consensus in the reformed court was that a new dynastic title was needed to signify the change. In naming the new kingdom, Taejo contemplated two possibilities – "Hwaryeong" (his place of birth) and "Joseon". After much internal deliberation, as well as endorsement by the neighboring Ming dynasty's emperor, Taejo declared the name of the kingdom to be Joseon, a tribute to the ancient Korean state of Gojoseon. He also moved the capital to Hanseong (modern Seoul) from Gaegyeong (modern Kaesong).

Ming dynasty of China shared a close trade and diplomatic relationship with the Joseon dynasty of Korea. Both dynasties shared Confucian ideals in society. Joseon had been a member of the Ming's sinocentric East Asian regional order. Joseon was historically one of the most pro-China Korean dynasties, and the Ming Court traditionally treated Korea alongside Vietnam and Thailand as its most favored tributaries.

Ming China assisted Joseon Korea during Toyotomi Hideyoshi's invasion of Korea, in which the Wanli Emperor sent a total of 221,500 troops. For this, the Chinese Emperor of that time, the Wanli Emperor is remembered fondly by most Koreans of the modern era.

Joseon Korea, in an effort to repay the Ming Chinese assistance during Toyotomi Hideyoshi's invasion of Korea's sent 13,000 soldiers to aid the Ming against the Later Jin at the Battle of Sarhū where nearly two-thirds of the Joseon Expeditionary Force was killed.  Furthermore, Joseon Korea was invaded twice during the Ming-Qing Transition due to its loyalty to the Ming Government in Beijing.

As a result of Joseon's subjugation and Ming's destruction, Joseon created the Little China ideology, known as sojunghwa. According to Youngmin Kim, " it held that the Joseon embodied Chineseness authentically while other neighboring countries failed to do so in the face of the barbarian domination of the center of the civilized world." A set of standardized rites and unifying symbols were developed in Late Joseon Korea in order to maintain that sense of cultural identity. Joseon dynasty believed that the Qing dynasty was unworthy of succeeding the politico-cultural orthodoxy of "China". Instead, the Confucianist Joseon dynasty asserted itself as the legitimate heir to the Chinese civilization and termed itself "Little China". In 2010, scholar Brian Reynolds Myers stated in reference to the move that:
 Long after submitting to the Qing, the Joseon court and many Korean intellectuals kept using Ming reign periods, as when a scholar marked 1861 as "the 234th year of Chongzhen."

Qing, Joseon and Korean Empire 
Under Hong Taiji, the Later Jin dynasty and its successor Qing dynasty invaded Joseon twice, in 1627 and 1636. Following the 1636 invasion, the Qing claimed victory and forced Injo of Joseon into submission.Hong Taiji set up a platform in Samjeondo in the upper reach of the Han River. At the top of the platform he accepted King Injo's submission. King Injo kowtowed to Hong Taiji, who allegedly forced Injo to repeat the humiliating ritual many times. A monument in honor of the so-called excellent virtues of the Manchu Emperor was erected at Samjeondo, where the ceremony of submission had been conducted.

After securing Injo's submission, the Qing forced Joseon to sever its relations with the collapsing Ming dynasty, which eventually fell in 1644. Despite reestablishing economic relations by officially entering the imperial Chinese tributary system, Joseon leaders and intellectuals remained resentful of the Manchus, whom they regarded as barbarians, and  regarded the Ming dynasty as the center of the civilized world. Injo's successor, Hyojong of Joseon, after rising to the throne, began to reform and expand the military of Korea to avenge the fallen Ming dynasty; first he removed Kim Ja-jeom, who had corrupted politics and had greater power than the king himself. Then, he called Song Si-yeol () and Kim Sang-heon to his court, who supported war against the Qing dynasty. His military expansion was massive, and he also built several border fortresses along Yalu River where Joseon and Qing shared a border. When a band of Dutch sailors including Hendrick Hamel drifted on Jeju Island, Hyojong ordered them to build muskets for the army, providing muskets to the Koreans for the first time after the Seven Year War.

However, the Qing dynasty continued to thrive, expanding quickly into the west after successfully conquering the Ming in 1644. The campaign was unable to be put in action, since the Qing dynasty assimilated the massive Han army into their own. The Joseon military, although reformed and expanded, was no match against the combined Manchu and Han forces. Also, the Qing dynasty began to treat Joseon as its friend and closest ally.

The expanded military was first put into action in 1654, when the Qing dynasty called for help to fight against invading Russians. 150 Joseon musketeers, along with 3,000 Manchus, met the Russian army at the Battle of Hutong (Hanja : 好通), present-day Yilan, which was won by the Qing–Joseon allied forces. Four years later, in 1658, Hyojong sent troops once again to help Qing dynasty against Russia; 260 Joseon musketeers and cannoneers led by Shin Ryu joined the forces of Ninguta Military Governor Sarhuda, the joint force sailed down the Hurka and Sungari Rivers and met the Russian forces under command of an Amur Cossack, Onufrij Stepanov near the fall of the Sungari River into the Amur, killing 270 Russians and driving them out of Qing territory. The battles against Russia proved that Hyojong's reform had stabilized the Joseon army, although they were never put into action again. Despite the campaigns, Russia and Joseon remained on good terms. The Northern campaign is known as Naseon Jeongbeol (), or "Suppression of the Russians".

After enjoying two centuries of peace, Joseon Korea and Qing China were confronted with the rising European powers. Qing China's national strength gradually declined after its defeat in the First and Second Opium Wars. As such, China was forced to sign a series of concessions and "unequal treaties" with the Western powers. At the same time, the Meiji Restoration occurred in Japan and led to the rise of the Empire of Japan, which gradually expanded its military power. The Donghak Peasant Revolution of Korea in 1894 became a catalyst for the First Sino-Japanese War, which saw the defeat of the Qing military. As part of the terms in the post-war Treaty of Shimonoseki, China recognized the independence of Korea and ceased its tributary relations as well as Japan annexing the island of Taiwan. The Korean Empire established modern diplomatic relationship with Qing, but Korea was eventually annexed, against their will, by Japan under the Japan–Korea Treaty of 1910.

Republic of China and Provisional Government of the Republic of Korea 
The anti-Japanese March 1st Movement protests erupted in Korea in 1919, in which led to millions of Koreans peacefully protesting against Japanese rule. Although the protests were brutally suppressed by the Japanese Government, shortly afterwards, the Provisional Government of the Republic of Korea was established as a government in exile, based in Shanghai, with Syngman Rhee serving as its first president with its subsequent recognition by the Republic of China. During the Paris Peace Conference of 1919, many Korean nationalists became optimistic that U.S. President Woodrow Wilson's Thirteen Points that called for self-determination, right to sovereignty and freedom could apply to them and thus key nationalists Kim Kyu-Sik flocked to Paris to petition for Korea's right to self-determination. The Republic of China was a key ally of the Provisional Korean Government, and a leading advocate for the restoration of Korean independence. The Chinese invited the Korean delegation to the conference with both the hope that Korea could regain its independence but also in hopes that the Korean delegation would embarrass Japan internationally. Unfortunately, China was at this point far too weak to do anything besides support Korea diplomatically and politically, and all other nations did not have a vested interested in Korea, and thus the Korean delegation ended in failure. Despite this, many Korean politicians as well as independence activists worked in China to restore Korean sovereignty.

The Provisional Government received significant recognition and support by both the founder of the ROC, Sun Yat-sen and his successor, Chiang Kai-shek, both of whom led Kuomintang regime in China. The Provisional Government coordinated the armed resistance against the Japanese imperial army during the 1920s and 1930s, including the Battle of Fengwudong in June 1920, the Battle of Qingshanli in October 1920,  and Yoon Bong-Gil's assassination of Japanese officers in Shanghai in April 1932. The last action in particular greatly influenced Chiang, who began to take a more proactive approach to Korean independence. Chiang wrote in his diary that the Japanese invaders should "reflect [on their actions] and awaken themselves", and praised Yun's patriotic martyrdom as a great contribution to Korean independence.

China tried to promote the legitimacy of the Provisional Government of Korea (KPG), which was established by Korean exiles in China after the suppression of the March 1st Movement in Korea. The KPG was ideologically aligned with the Chinese government of the time, as independence leader Kim Gu had agreed to Chiang Kai-shek's suggestion to adopt the Chinese Three Principles of the People program in exchange for financial aid. At the same time, China supported the leftist independence leader Kim Won-bong and convinced the two Kims to form the unified Korean Liberation Army (KLA). Under the terms in which the KLA was allowed to operate in China, it became an auxiliary of China's National Revolutionary Army until 1945. Furthermore, Chiang even went as far as to establish a special class for Korean recruits at the Whampoa Military Academy, many of whom would support Chiang's Northern Expedition. China's National Military Council had also decided that "complete independence" for Korea was China's fundamental Korean policy; otherwise, the government in Chongqing tried to unify the warring Korean factions.

Following the outbreak of the Second Sino-Japanese War and the fall of Shanghai, the Korean Provisional Government relocated to Chongqing, where it formed the Korean Liberation Army (KLA) in 1941. Originally, the Republic of China placed the Korean Liberation Army under the supreme authority of the commander-in-chief of the Chinese Army. The regulation was repealed in 1944, after the Provisional Government had achieved had improved its financial standing and achieved greater importance in the eyes of the Chinese government. The hundreds-strong KLA engaged in guerrilla warfare actions against the Japanese throughout the Asian theater of war until Japanese surrender in 1945.

The Republic of China was one of the participants of the Cairo Conference, which resulted in the Cairo Declaration. One of the main purposes of the Cairo Declaration was to create an independent Korea, free from Japanese Colonial Rule and restoration of Formosa (Taiwan) and Manchuria to China. Initially, American negotiators were suspicious of Chinese intentions and potential territorial over Korea. American diplomat Stanley Hornbeck asked then Minister of Foreign Affairs T.V. Soong how China viewed Korea "geographically, historically and politically" to which Soong replied:

"[The] Chinese in no sense think of Korea as a part of, or a lost part, of an existing or a once having existed Chinese empire. Nor...do they so think of Indo-China."

Although Chiang wanted an immediate restoration of Korean independence, he ultimately had to compromise with President Franklin D. Roosevelt who wanted an international trusteeship. Despite this, in a show of gratitude, the Provisional Government of Korea issued a statement the day after the Cairo Declaration thanking both the Republic of China and the Cairo Conference for guaranteeing the restoration of Korean sovereignty. Historian Bae Kyoung-han from Silla University notes that it was because of Chiang and the ROC that Korean independence, which had been lost since 1910, was mentioned and supported by the Cairo Conference.

Although the Cairo Conference led to Allied support for Korean independence, it did not lead to recognition of the Korean Provisional Government. Chiang and Korean leaders like Syngman Rhee tried to influence the U.S. State Department to support Korean independence and recognize the KPG, but the Far Eastern Division was skeptical. Its argument was that the Korean people "were emasculated politically" after decades of Japanese rule, and showed too much disunity, preferring a condominium solution for Korea that involved the Soviets. China was adamantly opposed to Soviet influence in Korea after hearing about Soviet atrocities in Poland since its liberation. It should be emphasized that Chinese support for Korean independence was not entirely altruistic, as leading reasons behind Chinese support for Korean independence rested on the idea that a strong and independence Korea would prevent future Japanese aggression and also Chiang feared growing Soviet influence in Korea as the war drew to a close.

By the Cairo Conference, the US and China came to agree on Korean independence "in due course", with China still pressing for immediate recognition of the exile government and a tangible date for independence. After Soviet-American relations deteriorated, on August 10, 1945, the United States Department of War agreed that China should land troops in Pusan, Korea from which to prevent a Soviet takeover. However, this turnaround was too late to prevent the division of Korea, as the Red Army quickly occupied northern Korea that same month.

Cultural relations 

The Chinese character system, known as Hanja in Korean, was introduced into Korea through the spread of Buddhism during the Tang dynasty. Hanja was used as the sole means of writing Korean until Sejong the Great promoted the invention of Hangul during the 15th century.

Confucianism also became a fundamental part of Korean society, rising into prominence under the Goryeo dynasty and prospered under the Joseon dynasty. Examples included civil service examinations, known as gwageo, and educational institutions (Gukjagam and Sungkyunkwan), promoting the studies of Chinese classical texts.

The imperial examination system implemented by China was introduced into Korea, which was not only inseparable from the close exchanges and deepening commercial relations between the two countries, but also had an important relationship with the ruling class of Korea at that time. The reason why the imperial examination system became popular in Korea was because of the strong support and advocacy of the Korean government at the time. The imperial examination system is in line with the idea of the ruling class to manage the country, incorporates the idea of self-development in Korea, encourages more Korean scholars and intellectuals to safeguard the interests of the Korean ruling government, and has caused the pursuit of equality in Korean culture and academic excellence of booming thought.

The thought process made people, even generals, like to write something to express their ideas. That is why in that period, at beginning, the sijo is only to be written by yangban, who went through a long and difficult process of education, but in the later period, there were many anonymous sijos to come out. Instead of using Chinese words, they used their own language and made it with more mordane but with a deep heart-touched sijo. The adoption of the civil service examination system is first helpful for the emperor to regulate the country and pick up the talented people, but then it transits into the path that made people's minds free. No more could they only obey rules, but try to battle the constriction of a hard language, be creative, active, and likely to express themselves.

See also
PRC-North Korea relations
PRC-South Korea relations
ROC-South Korea relations

Notes

References 
 
 
 .
 .
 
 .
 .
 
 
 .
 
 
 
 . Originally published in the Bulletin of the Institute of China Border Area Studies 邊政研究所年報 16 (1985): pp. 67–94.

Further reading 
 
 
 
 
 Craig, J. Marshall. China, Korea & Japan at War, 1592–1598: Eyewitness Accounts (Routledge, 2020).
 
 
 
 Hannas, William C., and Huey-Meei Chang. "Japan and South Korea." in China's Quest for Foreign Technology: Beyond Espionage  ed by William C. Hannas and Didi Kirsten Tatlow | (2020). pp 149–166. 
 Jones, Catherine, and Sarah Teitt, eds/ China-north Korea Relations: Between Development and Security (Edward Elgar, 2020) 
 
 
 
 
 
 
 
 
 Xu, Beina, and Jayshree Bajoria. "The China-North Korea Relationship." Council on foreign relations 22 (2014). online

History