# History of the Song dynasty

Part of a series on the :
History of China :
Timeline
Dynasties
Historiography :
Prehistoric
Paleolithic
Neolithic (c. 8500 – c. 2000 BCE)
Yellow, Yangtze, and Liao civilization :
Ancient
Xia (c. 2070 – c. 1600 BCE)
Shang (c. 1600 – c. 1046 BCE)
Late Shang (c. 1250 – c. 1046 BCE)
Zhou (c. 1046 – c. 256 BCE)
Western Zhou (1046–771 BCE)
Eastern Zhou (771–256 BCE)
Spring and Autumn (c. 770 – c. 476 BCE)
Warring States (475–221 BCE) :
Imperial
Qin (221–207 BCE)
Han (206 BCE – 220 CE)
Chu–Han Contention (206–202 BCE)
Western Han (202 BCE – 9 CE)
Xin (9–23 CE)
Eastern Han (25–220 CE)
Three Kingdoms (220–280 CE)
Wei, Shu, and Wu
Jin (266–420)
Western Jin (266–316)
Eastern Jin (317–420)
Sixteen Kingdoms (304–439)
Northern and Southern dynasties (420–589)
Sui (581–618)
Tang (618–907)
Wu Zhou (690–705)
Five Dynasties and Ten Kingdoms (907–979)
Song (960–1279)
Northern Song (960–1127)
Southern Song (1127–1279)
Liao (916–1125)
Western Xia (1038–1227)
Jin (1115–1234)
Yuan (1271–1368)
Ming (1368–1644)
Qing (1644–1912) :
Modern
Republic of China (mainland, 1912–1949)
People's Republic of China (1949–present)
Republic of China (Taiwan, 1949–present) :
Related articles
Art history
Economic history
Education history
Legal history
LGBT history
Media history
Music history
Timeline
Military history
Naval history
History of religion in China
Christianity
Judaism
Islam
Science and technology history
Archaeology
Cartography
Discoveries
Inventions
Transport history
Women's history :
vte :
The Song dynasty (Chinese: 宋朝; pinyin: Sòng cháo; 960–1279) of China was an imperial dynasty that ruled most of China proper and southern China from the middle of the 10th century into the last quarter of the 13th century. The dynasty was established by Emperor Taizu of Song with his usurpation of the throne of Later Zhou, ending the Five Dynasties and Ten Kingdoms period.
The Song is considered a high point of classical Chinese innovation in science and technology, an era that featured prominent intellectual figures such as Shen Kuo and Su Song and the revolutionary use of gunpowder weapons. However, it was also a period of political and military turmoil, with opposing and often aggressive political factions formed at court that impeded political, social, and economic progress. The frontier management policies of the Chancellor Wang Anshi exacerbated hostile conditions along the Chinese-Vietnamese border. This sparked a border war with Vietnam's Lý dynasty, which was fought to a mutual draw and concluded with a peace treaty in 1082. To the northwest the Song Empire frequently fought battles with the Tangut-led Western Xia dynasty, as well as the Khitan-led Liao dynasty to the north.
The Song Empire suffered a disastrous military defeat at the hands of invading Jurchen-led Jin dynasty from the north in 1127 during the Jin–Song wars. Following the Jingkang Incident, the remnants of the Song court were forced to flee south from Kaifeng and establish a new capital at Hangzhou. The loss of northern territory and shifting of the capital marks the division of the dynasty into two distinct periods: the Northern Song (960–1127) and the Southern Song (1127–1279). The Southern Song developed a new navy to combat the Jin dynasty formed in the north. The Song dynasty was able to defeat further Jurchen invasions and even fought the Jin dynasty in an erstwhile alliance with the Mongols. However, the Mongol-led Yuan dynasty defeated the Song dynasty at the Battle of Yamen in 1279.

## Founding of the Song

The Later Zhou was the last of the Five Dynasties that had controlled northern China after the fall of the Tang dynasty in 907. Zhao Kuangyin, later known as Emperor Taizu (r. 960–976), usurped the throne and deposed the last Zhou ruler Guo Zongxun with the support of military commanders in 960, initiating the Song dynasty. Upon taking the throne, his first goal was the reunification of China after half a century of political division. This included the conquests of Nanping, Wu-Yue, Southern Han, Later Shu, and Southern Tang in the south as well as the Northern Han and the Sixteen Prefectures in the north. With capable military officers such as Pan Mei (d. 991), Liu Tingrang (929–987), Cao Bin (931–999) and Huyan Zan (d. 1000), the early Song military became the dominant force in China. Innovative military tactics, such as defending supply lines across floating pontoon bridges, led to success in battle such as the Song assault against the Southern Tang state while crossing the Yangzi River in 974. Using a mass of arrow fire from crossbowmen, Song forces were able to defeat the renowned war elephant corps of the Southern Han on 23 January 971, thus forcing the submission of Southern Han and terminating the first and last elephant corps that would make up a regular division within a Chinese army.
Consolidation in the south was completed in 978, with the conquest of Wu-Yue. Song military forces then turned north against the Northern Han, which fell to Song forces in 979. However, efforts to take the Sixteen Prefectures were unsuccessful and they were incorporated into the Liao state based in Manchuria to the immediate north instead. To the far northwest, the Tanguts had been in power over northern Shaanxi since 881, after the earlier Tang court appointed a Tangut chief as a military governor (jiedushi) over the region, a seat that became hereditary (forming the Xi-Xia dynasty). Although the Song state was evenly matched against the Liao dynasty, the Song gained significant military victories against the Western Xia (who would eventually fall to the Mongol conquest of Genghis Khan in 1227).
After political consolidation through military conquest, Emperor Taizu held a famous banquet inviting many of the high-ranking military officers that had served him in Song's various conquests. As his military officers drank wine and feasted with Taizu, he spoke to them about the potential of a military coup against him like those of Five Dynasties era. His military officers protested against this notion, and insisted that none were as qualified as him to lead the country. The passage of this account in the Song Shi follows as such:
   The emperor said, 'The life of man is short. Happiness is to have the wealth and means to enjoy life, and then to be able to leave the same prosperity to one's descendants. If you, my officers, will renounce your military authority, retire to the provinces, and choose there the best lands and the most delightful dwelling-places, there to pass the rest of your lives in pleasure and peace...would this not be better than to live a life of peril and uncertainty? So that no shadow of suspicion shall remain between prince and ministers, we will ally our families with marriages, and thus, ruler and subject linked in friendship and amity, we will enjoy tranquility'...The following day, the army commanders all offered their resignations, reporting (imaginary) maladies, and withdrew to the country districts, where the emperor, giving them splendid gifts, appointed them to high official positions.
Emperor Taizu developed an effective centralized bureaucracy staffed with civilian scholar-officials and regional military governors and their supporters were replaced by centrally appointed officials. This system of civilian rule led to a greater concentration of power in the central government headed by the emperor than had been possible during the previous dynasties. In the early 11th century, there were some 30,000 men who took the prefectural exams per year (see imperial examination), which steadily increased to roughly 80,000 by the end of the century, and to 400,000 exam takers during the 13th century. Although new municipal governments were often established, the same number of prefectures and provinces were in existence as before the Song came to power. Thus although more people were taking exams, roughly the same number were being accepted into the government as in previous periods, making the civil service exams very competitive amongst aspiring students and scholars.
Emperor Taizu also found other ways to consolidate and strengthen his power, including updated map-making (cartography) so that his central administration could easily discern how to handle affairs in the provinces. In 971, he ordered Lu Duosun to update and 're-write all the Tu Jing [maps] in the world'; a daunting task for one individual. Nonetheless, he travelled throughout the provinces to collect illustrative gazetteers and as much data as possible. With the aid of Song Zhun, the massive work was completed in 1010, with some 1566 chapters. The later Song Shi historical text stated (Wade–Giles spelling):
   Yuan Hsieh (d. +1220) was Director-General of governmental grain stores. In pursuance of his schemes for the relief of famines he issued orders that each pao (village) should prepare a map which would show the fields and mountains, the rivers and the roads in fullest detail. The maps of all the pao were joined together to make a map of the tu (larger district), and these in turn were joined with others to make a map of the hsiang and the hsien (still larger districts). If there was any trouble about the collection of taxes or the distribution of grain, or if the question of chasing robbers and bandits arose, the provincial officials could readily carry out their duties by the aid of the maps.
Taizu also displayed a strong interest in science and technology. He employed the Imperial Workshop to support such projects as Zhang Sixun's hydraulic-powered armillary sphere (for astronomical observation and time-keeping) that used liquid mercury instead of water (because liquid mercury would not freeze during winter). Emperor Taizu was also quite open-minded in his affairs, especially with those perceived as foreigners: he appointed the Arab Muslim Ma Yize (910–1005) as the chief astronomer of the Song court. For receiving envoys from the Korean kingdom of Goryeo alone, the Song court had roughly 1,500 volumes written about the nuanced rules, regulations, and guidelines for their reception. The Song also sent envoys abroad, such as Wang Yande (939–1006), who was sent as an official envoy to the Uyghur-Turkic city of Gaochang in 981, then under Kara-Khanid control. From the 2nd century onwards, ancient Chinese histories even record that embassies of the Roman Empire ("Daqin") and Byzantine Empire ("Fu lin") arrived in China. As recorded in the History of Song and Wenxian Tongkao, the last known arrival of Byzantine envoys came in 1081, apparently sent by Michael VII Doukas to the court of Emperor Shenzong of Song. However, the History of Yuan records that a Byzantine man served as an astronomer and physician at the court of Kublai Khan during the subsequent Yuan dynasty, and in 1371 the Hongwu Emperor of the Ming dynasty sent an alleged Byzantine merchant (who was likely Nicolaus de Bentra, Archbishop of Khanbaliq) to inform the Byzantine ruler of the founding of the new dynasty.

## Relations with Liao and Western Xia
### The Great Ditch and Treaty of Shanyuan

Relations between the Song and Liao (led by the Khitans) were relatively peaceful in the first two decades after Song was founded, the disputed territories of the Northern Han and the Sixteen Prefectures notwithstanding. In 974, the two began exchanging embassies on New Years Day. However, in 979 the Song moved against the Northern Han, long under the protection of the Liao dynasty. The Song emperor succeeded in forcing the Northern Han to surrender, but when marching on the Liao Southern Capital (present-day Beijing) in the Sixteen Prefectures, Song forces were defeated at the Battle of Gaoliang River. This defeat was politically damaging to the prestige of Emperor Taizong of Song (r. 976–997), so much so that his top military commanders orchestrated an aborted coup to replace him with his nephew Zhao Dezhao.
Relations between the Song and Liao remained tense and hostile: in 986 the Song sent three armies against the Liao in an effort to take advantage of an infant emperor and recapture the Sixteen Prefectures, but the Liao successfully repulsed all three armies. Following this, diplomatic relations were resumed. Relations between Song and Liao worsened in the 990s. From 993 to 1004, the Liao observed the Song as the latter built a 'Great Ditch' in northern Hebei province from the Taihang Mountains in the west all the way to the Bohai Sea in the east. This was essentially a series of canals meant to block the advance of Liao cavalry far from the northern border line, although the Liao perceived this engineering project as a means for the Song to dispatch offensive forces more efficiently via new waterways. In 999 the Liao began annual attacks on Song positions, though with no breakthrough victories. The Liao were interested in capturing the Guannan region of northern Hebei, both because the Song general Zhou Shizong had taken it from them and because it contained strategic passes.
In 1004, Liao forces managed to march deep into Song territory, camping out in Shanyuan, about 100 kilometers (62 mi) north of the Song capital of Kaifeng. However, their forces were greatly overextended and any possible escape route was in danger of being blocked by Song forces. Eventually, the completion of the 'Great Ditch' as an effective defensive blockade which slowed the advance of Liao cavalry forced the Liao to request a truce. Negotiations resulted in the Treaty of Shanyuan, signed in January 1005 (some sources cite 1004 due to the Chinese Lunar Calendar), which fixed the borders of the Song and Liao as they were before the conflict. The Khitan rulers also wanted to intermarry with the Zhao family line of the Song, an offer that the Song refused in favor of a nominal and figurative imperial kinship. However, the treaty required the Song to make annual tribute payments to the Liao and recognize Liao equality with the Song. The tribute consisted of 283 kg (100,000 oz) of silver along with 200,000 bolts of silk, increasing to 500,000 units by 1042. However, even with the increase in 1042, the Song economy was not damaged by this enforced tribute. The bullion holding of the Liao dynasty did not increase with the tribute either, since the Song exported many goods annually to the Liao, dwarfing the amount of imported goods from Liao. Therefore, much of the silver sent to Liao as tribute was used to pay for Song Chinese goods, and the silver wound up back into the hands of Chinese merchants and the Song government.
Until the Song dynasty took advantage of a large rebellion within the Liao Kingdom in 1125, the Song had to conduct cordial relations with the Liao. Skilled ambassadors were sent on missions to court the Liao and maintain peace, such as the renowned horologist, engineer, and state minister Su Song. The Song also prepared for armed conflict, increasing the overall size of the armed forces to a million soldiers by 1022. By that time, however, the military was consuming three-quarters of the tax revenues gathered by the state, compared to a mere 2 or 3 per cent of state income that would be consumed by just providing the Liao with tribute. Due to these circumstances, intense political rivalries would later arise in the Song court over how to handle these issues.

### Conflict and diplomacy in the northwest

The Song came into conflict with the Tanguts of the Western Xia dynasty as early as the 980s, when Song intended to retake the former Ordos prefectures of the late Tang dynasty, then held by the Tanguts. After the Tangut leader Li Jiqian died in 1004, the Tanguts under his successor Li Deming (r. 1005–1032) had initially attacked the Song, but later sought peaceful relations which brought economic benefits until 1038.
After Li Jipeng (aka Zhao Baozhong), a Tangut prince who had submitted to the Song dynasty, raided Xia's territory and destroyed some fortified settlements in 1034, the Tanguts under Li Yuanhao (1003–1048) retaliated. On 12 September 1034 the Tanguts raided Qingzhou in Huanqing Circuit, but later Li Yuanhao released Song officers and soldiers he had captured; by 29 January 1035 relations were restored when Li Yuanhao sent tribute of fifty horses to the Song court and requested a copy of a Buddhist canon in return, which he received. Although he retained some unique Tangut customs and had a Tangut script created, Li's administration followed the traditional Chinese model of bureaus. Li proclaimed himself the first imperial ruler of Western Xia, ruling as Emperor Jingzong (r. 1038–1048), and on 10 November 1038 he sent an envoy to the Song capital in order to gain recognition for his new title as "Son of Blue Heaven" and to cease paying tribute to Song to affirm his new status. The Xia began attacks on Song's borders which were repulsed by Song commander Lu Shouqin (fl. 1030–1050), and on 9 January 1039 the Song shut down its border markets and soon after a reward of 100,000 strings of coin was offered to anyone who could capture Emperor Jingzong. Although he won impressive victories in the initial phase of the war, Jingzong gained no additional territory for Western Xia by war's end in 1044, while both sides had lost tens of thousands of troops. Emperor Jingzong also conceded to the Song demand that he refer to himself as an inferior subject when addressing the Song, and that he accept Song ritualists to perform official ceremonies at his court. Throughout the war, the Song had maintained a number of fortified military outposts stretching some 480 km (300 mi) from the westernmost prefectures of Shaanxi to Hedong in what is now Shanxi. Since the Song could not rely on water obstacle defences in this region—like the Great Ditch of Hebei used against Liao—they instead garrisoned the wide expanse with a recorded 200 imperial battalions and 900 provincial and militia battalions by 1043.
The war was costly and the Song state had to raise the taxes by fifty per cent in the Hubei, Hedong and Shanxi circuits. Even after the end of the conflict, maintaining standing army in the resource-poor northern regions placed a heavy burden on the economy. Defence expenditures amounted to 50 million strings of cash by 1067, out of the total income of 60 million.
Relations broke down once more in 1067 with the ascension of Emperor Shenzong of Song, and in the 1070s the Song had considerable success in capturing Tangut territory. A mood of frontier adventurism permeated Shenzong's court, as well as a desire to reclaim territories he felt belonged to him as the rightful ruler of China; when a Song general led an unprovoked attack on a Western Xia border town, Shenzong appeared at the border to commend the general himself. To punish the Western Xia and damage their economy, Emperor Shenzong also shut down all commercial border markets along the Song-Western Xia border. The scientist and statesman Shen Kuo (1031–1095) was sent to Yanzhou (now Yan'an, Shaanxi province) in 1080 to stave off Tangut military invasion. He successfully defended his fortified position, yet the new Grand Councillor Cai Que held him responsible for the death of a rival Song military officer and the decimation of that officer's forces; as a result, Shen Kuo was ousted from office and the state abandoned the projected land that Shen was able to defend.
When Empress Dowager Gao died in 1093, Emperor Zhezong of Song asserted himself at court by ousting the political conservatives led by Sima Guang, reinstating Wang Anshi's reforms, and halting all negotiations with the Tanguts of the Western Xia. This resulted in continued armed conflict between the Song dynasty and the Western Xia. In 1099, the Northern Song launched a campaign into Xining and Haidong (in modern Qinghai province), occupying territory that was controlled by the Tibetan Gusiluo regime since the 10th century. By 1116, Song managed to acquire all of its territory and incorporated it into prefectures; the area became the westernmost frontier against the Western Xia.

## Relations with Đại Việt and border conflict
### Background

For roughly a millennium a series of Chinese dynasties had controlled northern Vietnam, until the Vietnamese regained independence in 905 when a local noble Khúc Thừa Dụ became jiedushi (governor) of Tĩnh Hải circuit, amid the collapse of the Tang Empire. In 938, Vietnamese general Ngô Quyền defeated the Southern Han state on Bạch Đằng River, firmly ending Chinese domination over Vietnam. In 939, he established the Ngô dynasty (939–965) and secured Vietnamese independence. In 968, Duke Đinh Bộ Lĩnh reunited northern Vietnam under the new Đinh dynasty and renamed his kingdom to Đại Cồ Việt (大瞿越). Đại Cồ Việt's independence was recognized by Emperor Taizong of Song in 973 with a nominally tributary relationship being put in place, regarded as Annam.
However, when Vietnam was politically unstable in 980, the Chinese Emperor sent a 40,000 man-strong force led by Hou Renbao to invade Vietnam with the stated aim of "recovering Giao Chỉ" in early 981, but were defeated by general Lê Hoàn (941–1005), who later was elected as the new king of the Vietnamese and also was recognized by the Chinese Empire. Lê Hoàn's son Lê Long Đĩnh succeeded him and ruled the country from 1005 to 1009, sent tributes to Song China, brought many Mahayana Buddhist sutras and Taoist books to Vietnam, and translated them into Vietnamese. The relationship of Song China to the Vietnamese remained peaceful. The new Vietnamese ruler, Lý Công Uẩn, replaced the house of Lê in November 1009, and Song China continued recognizing the Lý monarchs like their predecessors. Vietnamese tributary envoys sent to China horses, jades, and received back books, sutras, clothes and gold belts. In 1014, Đại Việt engaged in a border conflict with the Dali kingdom in Northwest Vietnam. King Lý Công Uẩn's envoy Phùng Chân brought 100 horses captured from Dali forces to Song court as gifts.
Subsequently, the Zhuang rebel Nong Zhigao (Nùng Trí Cao) (1025–1053) attempted to establish his own frontier kingdom in 1042, 1048, and 1052, creating a disturbance on Song's southern border that prompted an invasion against Nong Zhigao/Nùng Trí Cao's forces in the 1050s. This invasion resulted in the Song conquest of border regions inhabited by Tai peoples and a border confrontation with the Lý dynasty (1010–1225) that lasted from 1075 to 1077. The Song court's interest in maximizing the economic benefits of these frontier zones came into conflict with the Lý dynasty, whose goal was to consolidate their peripheral fiefdoms. In the aftermath, an agreement was negotiated by both sides that fixed the borders; the resulting line of demarcation "would largely remain in place through to the present day", according to James A. Anderson, Associate Professor in the History Department at the University of North Carolina.

### Border hostilities

The Vietnamese court had not intervened when the Song general Di Qing (1008–1061) crushed the border rebellion of Nùng Trí Cao in 1053. During the two decades of relative regional peace that followed, the Vietnamese observed the threat of Song expansion, as more Han Chinese settlers moved into areas which the Vietnamese relied upon for the extraction of natural resources. Initially, a division of Di Qing's soldiers (originally from Shandong) had settled the region, followed by a wave of Chinese settlers from north of the Yangzi River.
The Guangnan West Circuit Fiscal Commissioner, Wang Han (fl. 1043–1063), feared that Nùng Trí Cao's kinsmen Nùng Tông Đán intended to plunder the region after he crossed the Song border in 1057. Wang Han took a personal visit to Nùng Tông Đán's camp and spoke with Nùng Trí Cao's son, explaining that seeking "Interior Dependency" status would alienate them from the Vietnamese, but if they remained outside of China proper they could safely act as loyal frontier militia. Wang Han then sent a memorial to Emperor Renzong's (r. 1022–1063) court in 1060, advocating the policy agreed with the Nùng. The Song government rejected his proposal and made the Nùng communities (along with other ethnic groups) official dependents of Song imperial authority, and Nùng Tông Đán's request that the territories under his authority be incorporated into the Song Empire was granted in 1062. In 1059—six years before the Song court's New Policies under Chancellor Wang Anshi (1021–1086) organized new self-sufficient militia units throughout the empire and along the border with Đại Việt—the Vietnamese ruler Lý Thánh Tông reorganized northern frontier administrative units and raised new militias. This bolstered his kingdom's strength in a time of conflict with Champa (located in southern Vietnam).
In the spring of 1060, Giáp Đồng natives under the frontier prefectural governor Thân Thiệu Thái (996–1066)—an Tày officer in-law to the Vietnamese court through marriage alliance—raided the Song frontier for cattle and militia recruits. He succeeded in taking the Song military leader Yang Baocai hostage, and in autumn of 1060 Song troops were sent into the frontier to rescue the general but he was not found. The Song court appointed Yu Jing (余靖; 1000–1064) as a new military commissioner of the Guangnan region and charged him with the task of quelling the unrest caused by Thân Thiệu Tháii. Yu Jing also sent an agent to Champa to enlist Cham aid against the Song's enemies in Guangnan.

### Tribute and intrigue

The Vietnamese court discovered the Song's secret attempt to ally with Champa; while Dai Viet sent a delegation to Yongzhou to thank Song for putting down local rebellions and to negotiate terms of peace, they instructed their agents to gather intelligence on the alleged Champa alliance and the strength of Song's military presence in the Guangnan Western Circuit. Two Vietnamese envoys were permitted to offer tribute to the court of Renzong in Kaifeng, arriving on 8 February 1063 to deliver gifts, including nine tamed elephants. On 30 March 1063, Emperor Renzong died and was succeeded by Emperor Yingzong (r.1063–1067); Vietnamese envoys arrived in Kaifeng again to congratulate Yingzong on his ascension, and on 7 April 1063, Yingzong sent gifts such as calligraphy works by Renzong to Vietnamese King Lý Thánh Tông. On the day that the Vietnamese envoy Lý Kế Tiên prepared to depart from Kaifeng back to Đại Việt, news arrived that Thàn Thiệu Thái had raided Song's Guangnan West Circuit again. Although a plea from a Guangnan official urged Kaifeng to take action, Yingzong left defenses up to local Guangnan forces and labeled Thàn Thiệu Thái as "reckless and mad" in an effort to disassociate him from the Lý court.
The minor Song official Lu Shen, a prefect in Guizhou, sent a message to Kaifeng in 1065 which reported that Nùng Tông Đán had apparently switched allegiance from Song to Lý, as well as united with the Quảng Nguyên chieftain Lưu Ký. When the now "mentally weak and distracted ruler" Yingzong—as Anderson describes him—received the report, he took no other action but to reassign Nùng Tông Đán with new honorific titles. The court took no action to resolve the problem, and Nùng Tông Đán later played a key role in the Lý–Song War of 1075–1077. The Song also gave official titles to other Vietnamese leaders despite their involvement in Nùng Trí Cao's rebellions and their pledged loyalty to Lưu Ký, the latter employed as a tribal official under King Lý Thánh Tông.
Yingzong died on 8 January 1067, and was replaced by Emperor Shenzong (r. 1067–1085), who like his father, heaped rewards on Vietnamese leaders but was more observant of the Vietnamese delegations. When Vietnamese envoys arrived in Kaifeng to congratulate Shenzong on his ascension, he sent lavish gifts to the Lý court, including a golden belt, silver ingots, 300 bolts of silk, two horses, a saddle inlaid with gold and silver plating, and on 9 February 1067 bestowed the Vietnamese ruler Lý Thánh Tông with the official title "King of the Southern Pacified Region" (Chinese:南平王, pinyin: nán píng wáng, Vietnamese: Nam Bình Vương). Shenzong also countered Nùng Tông Đán's defection by recognizing his kinsman Nùng Trí Hội as the Nùng clan leader in 1069, giving him a title similar to Tông Đán's and command over Guihua prefecture (also known as Wuyang grotto settlement).

### Frontier policy and war

In his New Policies sponsored by Shenzong, Wang Anshi enhanced central authority over Song's frontier administrations, increased militia activity, increased troop levels and war horses sent to the frontiers (including the border areas with Đại Việt), and actively sought loyal supporters in border regions who could heighten the pace of extraction of local resources for the state's disposal. Officials at court debated the merits or faults of Wang's policies, yet criticism of his reforms even appeared in Đại Việt, where the high officer Lý Thường Kiệt (1019–1105) publicly announced that Wang's policies were deliberate efforts to seize and control their border frontiers. Tensions between Song and Lý were critical, and in these conditions any sign of hostility had potential to ignite a war.
The Quảng Nguyên chieftain Lưu Ký launched an unexpected attack against Yongzhou in 1075, which was repelled by the Song's Vietnamese officer Nùng Trí Hội in charge of Guihua. Shenzong then sought to cement an alliance with the "Five Clans" of northern Guangnan by issuing an edict which would standardize their once irregular tribute missions to visit Kaifeng now every five years. Shenzong had officials sent from the capital to supervise militiamen in naval training exercises. Shenzong then ordered that all merchants were to cease trade with the subjects of Đại Việt, a further indication of heightened hostility that prompted the Vietnamese court under Lý Nhân Tông (r. 1072–1127) to prepare for war.
In November 1075, Nùng Tông Đản advanced into Song territory in Guangxi while a naval fleet commanded by Lý Thường Kiệt captured Qinzhou and Lianzhou prefectures. Lý Thường Kiệt calmed the apprehensions of the local Chinese populace, claiming that he was simply apprehending a rebel who took refuge in China and that the local Song authorities had refused to cooperate in detaining him. In the early spring of 1076, Thường Kiệt and Nùng Tông Đản defeated the Song militia of Yongzhou, and during a battle at Kunlun Pass, their forces beheaded the Governor-General of Guangnan West Circuit, Zhang Shoujie (d. 1076). After a forty-two-day siege, Yongzhou was breached and razed to the ground. When Song forces attempted to challenge the Vietnamese forces, the latter retreated, with their spoils of war and thousands of prisoners.
Lý Thường Kiệt had fought a war with the Cham in 1069, and in 1076 Song called on the Khmer Empire and Champa to go to war again in 1076. At the same time, the Song commander Guo Kui (1022–1088) led the combined Song force of approximately 100,000 men against Dai Viet. The Song quickly regained Quảng Nguyên prefecture and in the process captured the resistance leader Lưu Ký. By 1077, the Song had destroyed two other Vietnamese armies and marched towards their capital at Thăng Long (modern Hanoi). Song forces halted at the Nhu Nguyệt River (in modern Bắc Ninh Province), where Lý Thường Kiệt had defensive ramparts built on the southern banks. However, Song forces broke through his defense line and their cavalry advanced to within several kilometers of the capital city. The Vietnamese counterattacked and pushed Song forces back across the river while their coastal defenses distracted the Song navy. Lý Thường Kiệt also launched an offensive, but lost two Vietnamese princes in the fighting at Kháo Túc River. According to Chinese sources, "tropical climate and rampant disease" severely weakened Song's military forces while the Vietnamese court feared the result of a prolonged war so close to the capital. In 1078 China defeated Đại Việt and overran several districts that would later make up part of Cao Bằng Province.
As a result, Thường Kiệt made peace overtures to the Song; the Song commander Guo Kui agreed to withdraw his troops, but kept five disputed regions of Quảng Nguyên (renamed Shun'anzhou or Thuận Châu), Tư Lang Châu, Môn Châu, Tô Mậu Châu, and Quảng Lăng. These areas now comprise most of modern Vietnam's Cao Bằng Province and Lạng Sơn Province. In 1082, after a long period of mutual isolation, King Lý Nhân Tông of Đại Việt returned Yong, Qin, and Lian prefectures back to Song authorities, along with their prisoners of war, and in return Song relinquished its control of four prefectures and the county of Đại Việt, including the Nùng clan's home of Quảng Nguyên. Further negotiations took place from 6 July to 8 August 1084 and were held at Song's Yongping garrison in southern Guangnan, where Vietnamese Director of Military Personnel Lê Văn Thịnh (fl. 1075–1096) convinced Song to fix the two countries' borders between Quảng Nguyên and Guihua prefectures.

### After 1082

Relations between Vietnam and Song China afterwards were generally at peace until the Mongol conquest. In 1125, a Vietnamese envoy came to the Song capital Kaifeng bearing gifts. Shortly after, the Jurchen Jin dynasty invaded northern China and laid siege to Kaifeng, now known as the Jingkang incident. A Vietnamese prince in the Vietnamese entourage, Lý Dương Côn (Lee Yang gon [ko]), survived the Jin siege and sought refugee in Goryeo (Korea). 19 years later, when the Song dynasty reorganized itself south of the Yangtze as the Southern Song dynasty, the Vietnamese king Lý Anh Tông sent a new tributary envoy to Song China, giving the Chinese court gifts of gold, silver, elephant teeth, and incense. In 1164, Emperor Xiaozong of Song officially recognized Vietnam as Annam, and referred to the rulers of Vietnam as king of Annam (安南國王). That Chinese designation for Vietnamese monarchs would continue until 1804. Four years later in the spring of 1168, Emperor Shizong of the Jin dynasty unsuccessfully attempted to establish a tributary relationship with Đại Việt.
There would be no tributary missions from Vietnam to China until the Trần dynasty deposed the Lý in 1225. In 1229, Trần ruler Trần Thái Tông sent a diplomatic mission to Song China, and was recognized as king of Annam. After the first Mongol invasion in 1258 however, Đại Việt ended all tributary and diplomatic relations with the Song dynasty.

## Partisans and factions, reformers and conservatives

After students passed the often difficult, bureaucratic, and heavily demanding Imperial Exams, as they became officials, they did not always see eye to eye with others that had passed the same examination. Even though they were fully-fledged graduates ready for government service, there was always the factor of competition with other officials. Promotion to a higher post, higher salary, additional honors, and selection for choice assignment responsibilities were often uncertain, as young new officials often needed higher-ranking officials to recommend them for service. Once an official would rise to the upper echelons of central administration based in the capital, they would often compete with others over influence of the emperor's official adoption of state policies. Officials with different opinions on how to approach administrative affairs often sought out other officials for support, leading to pacts of rivaling officials lining up political allies at court to sway the emperor against the faction they disagreed with.
Factional strife at court first became apparent during the 1040s. The unsuccessful war with Tanguts and the mounting economic pressures prompted the first reform movement of the Song: Qingli Reforms initiated by Fan Zhongyan (989–1052). Fan was a capable military leader (with successful battles in his record against the Tanguts of Xi-Xia) but as a minister of state he was known as an idealist, once saying that a well-minded official should be one that was "first in worrying about the world's troubles and last in enjoying its pleasures". When Fan rose to the seat of chancellor, there was a growing opposition to him within the older and more conservative crowd. They disliked his pushing for reforms for the recruitment system, higher pay for minor local officials to discourage against corruption, and wider sponsorship programs to ensure that officials were drafted more on the basis of their intellect and character. However, his reforms were cancelled within a year's time (with Fan replaced as chancellor), since many older officials halfway through their careers were not keen on making changes that could affect their comfortably set positions.
After Fan Zhongyan, there was Chancellor Wang Anshi (1021–1086). The new nineteen-year-old Emperor Shenzong (r. 1067–1085) had an instant liking of Wang Anshi when he submitted a long memorial to the throne that criticized the practices of state schools and the examination system itself. With Wang as his new chancellor, he quickly implemented Wang's New Policies, which evoked some heated reaction from the conservative base. Along with the Baojia system of a community-based law enforcement, the New Policies included:
* Low-cost loans for farmers and replaced the labor service with a tax instead, hoping this would ultimately help the workings of the entire economy and state (as he directly linked state income to the level of prosperity of rural peasants who owned farms, produced goods for the market, and paid the land tax). These government loans replaced the system of landlords offering their tenants private loans, which was prohibited under the new laws of Wang's reforms.
* Government monopolies on tea, salt, and wine in order to raise state revenues (although this would now limit the merchant class).
* Instituting a more up-to-date land survey system in order to properly assess the land tax.
* Introduction of a local militia in order to lessen the budget of expenses paid for upholding the official standing army, which had grown dramatically to roughly 1 million soldiers by 1022.
* The creation of a new government bureau in 1073 called the Directorate of Weapons, which supervised the manufacture of armaments and ensured quality control.
* Introduction of the Finance Planning Commission, created in mind to speed up the reform process so that dissident Conservatives would have less time to react and oppose reforms.
* The poetry requirement of the civil service examination (introduced during the earlier Tang dynasty) was scrapped in order to seek out men with more practical experience and knowledge.
In addition, Wang Anshi had his own commentaries on Confucian classics made into a standard and required reading for students hoping to pass the state examinations. This and other reforms of Wang's were too much for some officials to bear idly, as there were many administrative disagreements, along with many personal interests at stake. In any case, the rising conservative faction against the reformer Wang Anshi branded him as an inferior-intellect who was not up to par with their principles of governance (likewise, the reformers branded conservatives in the same labeled fashion). The conservatives criticized Wang's reforms as a means of curbing the influence of landholding families by diminishing their private wealth in favor of self-sufficient communal groups. The conservatives argued that the wealth of the landholding class should not be purposefully diminished by state programs, since the land holding class was the essential socio-economic group that produced China's scholar-officials, managers, merchants, and landlords.
Reminded of the earlier Fan Zhongyan, Wang was not about to allow ministers who opposed his reforms to have sway at court, and with his prowess (and perceived arrogance) was known as 'the bullheaded premier'. He gathered to his side ministers who were loyal to his policies and cause, an elite social coalition known as the New Policies Group (新法, Xin Fa). He had many able and powerful supporters, such as the scientist and statesman Shen Kuo. Ministers of state who were seen as obstructive to the implementation of Wang's reforms were not all dismissed from the capital to other places (since the emperor needed some critical feedback), but many were. A more extreme example would be "obstructionist" officials sent far to the south to administer regions that were largely tropical, keeping in mind that northern Chinese were often susceptible to malaria found in the deep south of China. Even the celebrated poet and government official Su Shi was persecuted in 1079 when he was arrested and forced into five weeks of interrogation. Finally, he confessed under guarded watch that he had slandered the emperor in his poems. One of them read:
| | An old man of seventy, sickle at his waist, Feels guilty the spring mountain bamboo and bracken are sweet. It's not that the music of Shao has made him lose his sense of taste. It's just that he's eaten his food for three months without salt. |
| Su Shi ||
This poem can be interpreted as criticizing the failure of the salt monopoly established by Wang Anshi, embodied in the persona of a hard-working old man who was cruelly denied his means to flavor his food, with the severity of the laws and the only salt available being charged at rates that were too expensive. After his confession, Su Shi was found guilty in court, and was summarily exiled to Hubei Province. More than thirty of his associates were also given minor punishments for not reporting his slanderous poems to authorities before they were widely circulated to the educated public.
Emperor Shenzong died in 1085, an abrupt death since he was in his mid 30s. His successor Emperor Zhezong of Song was only ten years old when he ascended to the throne, so his powerful grandmother served as regent over him. She disliked Wang's reforms from the beginning, and sought to appoint more Conservative officials at court who would agree to oppose the Reformists. Her greatest political ally was Sima Guang (1019–1086), who was made the next Chancellor. Undoing what Wang had implemented, Sima dismissed the New Policies, and forced the same treatment upon Reformers that Wang had earlier meted out to his opponents: dismissal to lower or frontier posts of governance, or even exile. However, there was still mounted opposition to Sima Guang, as many had favored some of the New Policies, including the substitution of tax instead of forced labor service to the state. Sure enough, when Emperor Zhezong's grandmother died in 1093, Zhezong was quick to sponsor the Reformists like his predecessor Shenzong had done. The Conservatives once more were ousted from political dominance at court. When Zhezong suddenly died in his twenties, his younger brother Emperor Huizong of Song (r. 1100–1125) succeeded him, and also supported the Reformers at court. Huizong banned the writing of Sima Guang and his lackeys while elevating Wang Anshi to near revered status, having a statue of Wang erected in a Confucian temple alongside a statue of Mencius. To further this image of Wang as a great and honorable statesman, printed and painted pictures of him were circulated throughout the country. Yet this cycle of revenge and partisanship continued after Zhezong and Huizong, as Reformers and Conservatives continued their infighting. Huizong's successor, Emperor Gaozong of Song, abolished once more the New Policies, and favored ministers of the Conservative faction at court.

## Jurchen invasions and the transition to Southern Song
### Jingkang Incident

Before the arrival of the Jurchens the Song dynasty was for centuries engaged in a stand-off against the Western Xia and the Khitan Liao dynasty. This balance was disrupted when the Song dynasty developed a military alliance with the Jurchens for the purpose of annihilating the Liao. This balance of power disrupted, the Jurchens then turned on the Song, resulting in the fall of the Northern Song and the subsequent establishment of the Southern Song.
During the reign of Huizong, the Jurchen tribe to the north (once subordinates to the Liao), revolted against their Khitan masters. The Jurchen community already had a reputation of great economic clout in their own region of the Liao and Sungari rivers. They were positioned in an ideal location for horse raising, and were known to muster ten thousand horses a year to sell annually to the Khitans of the Liao dynasty. They even had a martial history of being pirates, in the 1019 Toi invasion of the Heian Japanese islands in modern-day Iki Province, Tsushima Province, and Hakata Bay. From the Jurchen Wanyan clan, a prominent leader Wanyan Aguda (1068–1123) challenged Liao authority, establishing their own Jin (or 'Golden') dynasty in 1115. The Song government took notice of the political dissidence of the Jurchens in Liao's territory, as Council of State Tong Guan (1054–1126) persuaded the emperor to ally with the Jurchens against the Liao. The two nations secretly forged the Alliance on the Sea, so-named because it was negotiated by envoys who crossed the Bohai Sea, and agreed to jointly invade the Liao, and if successful, divide up Liao territory with the Sixteen Prefectures given to the Song.
In 1121–23, Song forces fared badly against the Liao, but the Jin succeeded in driving the Liao to Central Asia. Through the campaign, the Jurchens discovered weaknesses about the Song military based in the north (as the Chinese for so long had been sending tribute to the Liao instead of actually fighting them). Song forces had failed to make a joint attack in a siege with the Jurchens, who viewed the Song generals as incompetent. Banking on the possibility that the Song were weak enough to be destroyed, the Jurchens made a sudden and unprovoked attack against the Song in the north. Soon enough, even the capital at Kaifeng was under siege by Jin forces, only staved off when an enormous bribe was handed over to them. There was also an effective use of Song Chinese war machines in the defense of Kaifeng in 1126, as it was recorded that 500 catapults hurling debris were used. During the siege of Taiyuan, the Jin employed 30 catapults and over fifty carts protected by rawhide and sheets of iron plating so that Jin troops could be ferried to the walls safely to fill in Taiyuan city's defensive moat. The eunuch general Tong Guan, who had initially urged for an alliance with the Jurchens, was blamed for causing the war. He was eventually executed by Emperor Qinzong of Song (r. 1126–1127) after Huizong abdicated the throne to him.
However, the Jin returned soon after with enough siege machinery to scale Kaifeng's layer of walls defended by 48,000 Song troops. The Jin used siege towers taller than Kaifeng's walls in order to lob incendiary bombs into the city. The besieged city was captured by the Jurchens in less than two months. Three thousand members of the Emperor's court were taken as captives, including Qinzong and many of his relatives, craftsmen, engineers, goldsmiths, silversmiths, blacksmiths, weavers and tailors, Daoist priests, and female entertainers to label some. The mechanical clock tower designed by Su Song and erected in 1094 was also disassembled and its components carted back north, along with many clock-making millwrights and maintenance engineers that would cause a setback in technical advances for the Song court. According to the contemporary Xia Shaozeng, other war booty included 20,000 fire arrows that were handed over to the Jurchens upon taking the city.
After capturing Kaifeng, the Jurchens went on to conquer the rest of northern China, while the Song Chinese court fled south. They took up temporary residence at Nanjing, where a surviving prince was named Emperor Gaozong of Song in 1127. Jin forces halted at the Yangzi River, but staged continual raids south of the river until a later boundary was fixed at the Huai River further north. With the border fixed at the Huai, the Song government would promote an immigration policy of repopulating and resettling territories north of the Yangzi River, since vast tracts of vacant land between the Yangzi and Huai were open for landless peasants found in Jiangsu, Zhejiang, Jiangxi, and Fujian provinces of the south.

### A new capital and peace treaty

In 1129, Emperor Gaozong designated the site at Hangzhou (known then as Lin'an) to be the temporary settlement of the court, but it was not until 1132 that it was declared the new Song capital. Hangzhou and Nanjing were devastated by the Jin raids; both cities were heavily repopulated with northern refugees who outnumbered the remaining original inhabitants. Hangzhou was chosen not only for its natural scenic beauty, but for the surrounding topographic barriers of lakes and muddy rice-fields that gave it defensive potential against northern armies comprising mostly cavalry. Yet it was viewed by the court as only a temporary capital while the Song emperors planned to retake Kaifeng. However, the rapid growth of the city from the 12th century to the 13th necessitated long-term goals of residency. In 1133 the modest palatial residence of the imperial family was improved upon from a simple provincial lodging to one that at least accommodated strolls with new covered alleyways to deflect the rain. In 1148 the walls of the small palace compound were finally extended to the southeast, yet this was another marginal improvement.
The new triangular arrangement between the Southern Song, Jin, and Western Xia continued the age of division and conflict in China. The region of Huainan (between the Yangzi and Huai rivers) became a new borderland and battleground between Song and Jin from 1128 to 1141, displacing hundreds of thousands of families who had lived there for generations. The Southern Song deployed several military commanders, among them Yue Fei and Han Shizhong, to resist the Jin as well as recapture territory, which proved successful at times. Yue Fei in particular had been preparing to recapture Kaifeng (or Bianjing as the city was known during the Song period), the former capital of the Song dynasty and the then southern capital of the Jin, after a streak of uninterrupted military victories.
However, the possible defeat of the Jurchens threatened the power of the new emperor of the Southern Song, Gaozong and his premier Qin Hui. The reason for this was that Qinzong, the last emperor of the Northern Song was living in Jin-imposed exile in Manchuria and had a good chance of being recalled to the throne should the Jin dynasty be destroyed. Although Yue Fei had penetrated into enemy territory as far as Luoyang, he was ordered to head back to the capital and halt his campaign. Emperor Gaozong signed the Treaty of Shaoxing in 1141 that fixed the borders at the Huai River, as well as conceded territory regained through the efforts of Yue Fei, while Yue was killed during imprisonment. As part of the treaty, the Song were also forced to pay tribute to the Jin, much as it had to the Liao. With the treaty of Shaoxing, hostilities ceased between the Jin and Song dynasties for the next two decades. In the meantime, Emperor Gaozong negotiated with the Jin over his mother's ransom while he commissioned a symbolic art project about her, the Eighteen Songs of a Nomad Flute, originally based upon the life of Cai Wenji (b. 177). Gaozong's mother was eventually released and brought south, but Qinzong was never freed from his confinement in the north.
Decades after Yue's death, the later Emperor Xiaozong of Song honored Yue Fei as a national hero in 1162, providing him proper burial and memorial of a shrine. As a means to shame those who had pressed for his execution (Qin Hui and his wife), iron statues of them were crafted to kneel before the tomb of Yue Fei, located at the West Lake in Hangzhou.

## China's first standing navy

As the once great Indian Ocean maritime power of the Chola dynasty in medieval India had waned and declined, Chinese sailors and seafarers began to increase their own maritime activity in South East Asia and into the Indian Ocean. Even during the earlier Northern Song period, when it was written in Tamil inscriptions under the reign of Rajendra Chola I that Srivijaya had been completely taken in 1025 by Chola's naval strength, the succeeding king of Srivijaya managed to send tribute to the Chinese Northern Song court in 1028. Much later, in 1077, the Indian Chola ruler Kulothunga Chola I (who the Chinese called Ti-hua-kia-lo) sent a trade embassy to the court of Emperor Shenzong of Song, and made lucrative profits in selling goods to China. There were other tributary payers from other regions of the world as well. The Fatimid-era Egyptian sea captain Domiyat traveled to a Buddhist site of pilgrimage in Shandong in 1008, where he presented the Chinese Emperor Zhenzong of Song with gifts from his ruling Imam Al-Hakim bi-Amr Allah, establishing diplomatic relations between Egypt and China that had been lost during the collapse of the Tang dynasty in 907 (while the Fatimid state was established three years later in 910). During the Northern Song, Quanzhou was already a bustling port of call visited by a plethora of different foreigners, from Muslim Arabs, Persians, Egyptians, Hindu Indians, Middle-Eastern Jews, Nestorian Christians from the Near East, etc. Muslims from foreign nations dominated the import and export industry (see Islam during the Song dynasty). To regulate this enormous commercial center, in 1087 the Northern Song government established an office in Quanzhou for the sole purpose of handling maritime affairs and commercial transactions. In this multicultural environment there were many opportunities for subjects in the empire of foreign descent, such as the (Arab or Persian) Muslim Pu Shougeng, the Commissioner of Merchant Shipping for Quanzhou between 1250 and 1275. Pu Shougeng had gained his reputable position by helping the Chinese destroy pirate forces that plagued the area, and so was lavished with gifts and appraisal from Chinese merchants and officials. Quanzhou soon rivaled Guangzhou (the greatest maritime port of the earlier Tang dynasty) as a major trading center during the late Northern Song. However, Guangzhou had not fully lost its importance. The medieval Arab maritime captain Abu Himyarite from Yemen toured Guangzhou in 993, and was an avid visitor to China. There were other notable international seaports in China during the Song period as well, including Xiamen (or Amoy).
When the Song capital was removed far south to Hangzhou, massive numbers of people came from the north. Unlike the flat plains of the north, the mountainous terrain riddled with lakes and rivers in southern China is largely a hindrance and inhospitable to widespread agriculture. Therefore, the Southern Song took on a unique maritime presence that was largely unseen in earlier dynasties, grown out of the need to secure importation of foreign resources. Commercial cities (located along the coast and by internal rivers), backed by patronage of the state, dramatically increased shipbuilding activity (funding harbor improvements, warehouse construction, and navigation beacons). Navigation at sea was made easier by the invention of the compass and Shen Kuo's treatise of the 11th century on the concept of true north (with magnetic declination towards the North Pole). With military defense and economic policy in mind, the Southern Song established China's first standing navy. China had a long naval history before that point (example, Battle of Chibi in 208), and even during the Northern Song era there were concerns with naval matters, as seen in examples such as the Chinese official Huang Huaixin of the Xining Reign (1068–1077) outlining a plan of employing a drydock for repair of 'imperial dragon boats' (see Science and technology of the Song dynasty). Already during the Northern Song, the Chinese had established fortified trade bases in the Philippines, a noted interest of the court to expand China's military power and economic influence abroad. Provincial armies in the Northern Song era also maintained naval river units. However, it was the Southern Song court that was the first to create a large, permanent standing naval institution for China in 1132. The new headquarters of the Southern Song Chinese admiralty was based at Dinghai, the office labeled as the Yanhai Zhizhi Shisi (Imperial Commissariat for the Control and Organization of Coastal Areas). Even as far back as 1129 officials proposed ambitious plans to conquer Korea with a new navy and use Korea as a base for launching invasions into Jin territory, but this scheme was never achieved and was of secondary importance to maintaining defense along the fluctuating border with Jin.
Capturing the essence of the day, the Song era writer Zhang Yi once wrote in 1131 that China must regard the Sea and the River as her Great Wall, and substitute warships for watchtowers. Indeed, the court administration at Hangzhou lived up to this ideal, and were successful for a time in employing their navy to defend their interests against an often hostile neighbor to the north. In his Science and Civilization in China series, Joseph Needham writes:
   From a total of 11 squadrons and 3,000 men [the Song navy] rose in one century to 20 squadrons totalling 52,000 men, with its main base near Shanghai. The regular striking force could be supported at need by substantial merchantmen; thus in the campaign of 1161 some 340 ships of this kind participated in the battles on the Yangtze. The age was one of continual innovation; in 1129 trebuchets throwing gunpowder bombs were decreed standard equipment on all warships, between 1132 and 1183 a great number of treadmill-operated paddle-wheel craft, large and small, were built, including stern-wheelers and ships with as many as 11 paddle-wheels a side (the invention of the remarkable engineer Kao Hsuan), and in 1203 some of these were armored with iron plates (to the design of another outstanding shipwright Chhin Shih-Fu)...In sum, the navy of the Southern Sung held off the [Jurchen Jin] and then the Mongols for nearly two centuries, gaining complete control of the East China Sea.
During the reign of Emperor Xiaozong of Song, the Chinese increased the number of trade missions that would dock at ports throughout the Indian Ocean, where Arab and Hindu influence was once predominant. The Chinese sailed regularly to Korea and Japan in the Far East, westwards towards India and Sri Lanka, and into the Persian Gulf, and the Red Sea. The Chinese were keen to import goods such as rare woods, precious metals, gems, spices, and ivory, while exporting goods such as silk, ceramics, lacquer-ware, copper cash, dyes, and even books. In 1178, the Guangzhou customs officer Zhou Qufei wrote in Lingwai Daida of an island far west in the Indian Ocean (possibly Madagascar), from where people with skin "as black as lacquer" and with frizzy hair were captured and purchased as slaves by Arab merchants. As an important maritime trader, China appeared also on geographical maps of the Islamic world. In 1154 the Moroccan geographer Al-Idrisi published his Geography, where he described the Chinese seagoing vessels as having aboard goods such as iron, swords, leather, silk, velvet, along with textiles from Aden (modern-day Yemen), the Indus River region, and Euphrates River region (modern-day Iraq). He also commended the silk manufactured at Quanzhou as being unparalleled in the world for its quality, while the Chinese capital at Hangzhou was best known throughout the Islamic world for being a major producer of glass wares. By at least the 13th century, the Chinese were even familiar with the story of the ancient Lighthouse of Alexandria since it is described at length by Zhao Rugua, a Southern Song customs inspector of Quanzhou.

## Defeat of Jin invasion, 1161

In 1153 the Jin emperor Wanyan Liang moved the empire's capital from Huining Prefecture in northern Manchuria (south of present-day Harbin) to Zhongdu (now Beijing). Four years later in 1157 he razed Beijing, including the nobles’ residences, and moved the Jin's southern capital from Beijing to Kaifeng. It was here at the former seat of the Song dynasty that he began a large project of reconstruction (since the siege against it in 1127). For much of his reign there was peace between Jin and Song, while both states upheld an uninterrupted flow of commercial trade between each other. While amassing tribute from the Southern Song, the Jin dynasty also imported large amounts of tea, rice, sugar, and books from the Southern Song. However, Wanyan Liang reopened the Jin dynasty's armed conflict with the Song by the 1160s.
Wanyan Liang established a military campaign against the Southern Song in 1161, with 70,000 naval troops aboard 600 warships facing a smaller Song fleet of only 120 warships and 3,000 men. At the Battle of Tangdao and the Battle of Caishi along the Yangtze River, Jin forces were defeated by the Southern Song navy. In these battles, the Jin navy was wiped out by the much smaller Song fleet because of their use of fast paddle-wheel crafts and gunpowder bombs launched from trebuchet catapults (since explosive grenades and bombs had been known in China since the 10th century). Meanwhile, two simultaneous rebellions of Jurchen nobles, led by soon-to-be crowned Jin emperor Wanyan Yong and Khitan tribesman, erupted in Manchuria. This forced the reluctant Jin court to withdraw its troops from southern China to quell these uprisings. In the end, Wanyan Liang failed in taking the Southern Song and was assassinated by his own generals in December 1161. The Khitan uprising was not suppressed until 1164, while the Treaty of Longxing (隆興和議) was signed in 1165 between Song and Jin, reestablishing the 1142 border line and ushering in four decades of peace between the two.

## Rise of the Mongols

In the years 1205 and 1209 the Jin state was under raid attacks by Mongols from the north, and in 1211 the major campaign led by Genghis Khan was launched. His army consisted of fifty thousand bowmen, while his three sons led armies of similar size. Patricia Ebrey writes that at this point the Mongol population could not have been greater than 1.5 million, yet they boosted their numbers by employing Khitans and Han Chinese "who felt no great loyalty to their Jurchen lords." After a Jurchen general murdered the Jin emperor Wanyan Yongji in 1213 and placed Emperor Xuanzong on the throne, a peace settlement was negotiated between Jin and the Mongol forces in 1214, as Genghis made the Jin a vassal state of the Mongol Empire. However, when the Jin court moved from Beijing to Kaifeng, Genghis saw this move as a revolt, and moved upon the old Jin capital at Beijing in 1215, sacking and burning it. Although the now small Jin state attempted to defend against the Mongols and even fought battles with the Song in 1216 and 1223, the Jin were attacked by the Mongols again in 1229 with the ascension of Ögedei Khan. According to the account of 1232, written by the Jin commander Chizhan Hexi, the Jurchens led a valiant effort against the Mongols, whom they frightened and demoralized in the siege of the capital by the use of 'thunder-crash-bombs' and fire lance flamethrowers. However, the capital at Kaifeng was captured by siege in 1233, and by 1234 the Jin dynasty finally fell in defeat to the Mongols after the capture of Caizhou.
The Western Xia met a similar fate, becoming an unreliable vassal to the Mongols by seeking to secure alliances with Jin and Song. Genghis Khan had died in 1227 during the 5-month siege of their capital city, and being held somewhat responsible for this, the last Xia ruler was hacked to death when he was persuaded to exit the gates of his city with a small entourage.

## Yuan invasion and end of the Song dynasty

Following the death of Gaozong and the emergence of the Mongols, the Song dynasty formed a military alliance with the Mongols in the hope of finally defeating the Jin dynasty. Several tens of thousands of carts full of grain were sent to the Mongol army during the siege. Following the destruction of the Jin dynasty in 1234, the Southern Song generals broke the alliance, proceeding to recapture the three historical capitals of Kaifeng, Luoyang and Chang'an. However, the cities, ravaged by years of warfare, lacked economic capacity and yielded little defensibility. This breaking of alliance meant open warfare between the Mongols and the Song dynasty. Ögodei Khan's forces conquered fifty-four out of Sichuan's fifty-eight total districts by 1236, while ordering the slaughter of over a million people that inhabited the city of Chengdu, which was taken by the Mongols with ease.

### Möngke's campaign

The Mongols eventually gained the upper hand under Möngke Khan, famed for his battles in Russia and Hungary in Eastern Europe, and ushered in the final destruction of the ruling Ch'oe family of Korea in 1258.
In 1252, Möngke commissioned his younger brother Kublai and experienced general Uriyangkhadai to conquer the Dali Kingdom. From the summer of 1253 to early 1254, the campaigns were successful in conquering and pacifying the tribes, with Uriyangkhadai's military experience proving invaluable in battle. After Kublai's return to northern China, Uriyangkhadai conquered neighboring tribes in Tibet before turning east towards the Trần dynasty by 1257.
Meanwhile, Uriyangkhadai's forces invaded Vietnam with generals Trechecdu and Aju and captured the Trần dynasty capital of Thang Long in 1258. While Chinese source material incorrectly stated that Uriyangkhadai withdrew from Vietnam after nine days due to poor climate, his forces did not leave until 1259. In 1259, Uriyangkhadai's forces attacked Guangxi from Thang Long as part of a coordinated Mongol attack in 1259 with armies attacking in Sichuan under Mongol leader Möngke Khan and other Mongol armies attacking in modern-day Shandong and Henan. Möngke Khan died during the Siege of Diaoyu Castle while attacking the Sichuan anti-Mongol fortresses in Chongqing on August 11, 1259. There are several different claims as to how he died; the causes of death include either an arrow wound from a Chinese archer during the siege, dysentery, or cholera epidemic.
Möngke's death in battle led to the recall of the main Mongol armies led by Hulagu campaigning in the Middle East and sparked a succession crisis that would ultimately favor Kublai as the new Khan of the Mongols. Hulagu had to travel back to Mongolia in order to partake in the traditional tribal meeting of the khuriltai to appoint a new successor of the Mongol Khanate.

### A fluctuating border

Although Möngke's forces stalled the war effort immediately after his death, his younger brother Kublai continued to fight the Southern Song along the Yangzi River for the next two months into the autumn of 1259. Kublai made a daring advance across the river during a storm, and assaulted the Southern Song troops on the other side. Both sides suffered considerable casualties, but Kublai's troops were victorious and gained a foothold south of the Yangzi. Kublai made preparations to take the heavily fortified city of Ezhou. Meanwhile, the Song chancellor Jia Sidao dispatched General Lü Wende to lead the reinforcements in the defense of Ezhou, and on October 5 Lü slipped past Kublai's ill-prepared forces and entered the city. Jia Sidao then sent his general and emissary Song Jing to negotiate a tributary settlement with Kublai. He offered Kublai annual tribute of silver like in the earlier treaty with the Khitans, in return for the territories south of the Yangzi that had been taken by the Mongols. Kublai rejected the proposal since he was already in a favorable strategic position on the other side of the Yangzi. By the winter of 1259, Uriyangkhadai's army fought its way north to meet Kublai's army. However, Kublai had to suspend the war and travel north with the majority of his forces due to the Toluid Civil War. His rival brother Ariq Böke led a sudden movement of troops towards Kublai's home base of Xanadu.
Kublai's absence from the war front was seen by Chancellor Jia Sidao as an opportune moment, so he ordered to resume armed conflict. The Song army routed the small armed detachment that Kublai had stationed south of the Yangzi, and the Song regained its lost territory. With his ally Hulagu busy fighting the Golden Horde and his own forces needed in the north against the rival Khagan claimant Ariq Böke, Kublai was unable to focus on hostilities in the south. On May 21, 1260, Kublai sent his envoy Hao Jing and two other advisors to negotiate with the Southern Song. Upon their arrival and attempts to solve the conflict through diplomatic means, Jia Sidao ordered Kublai's embassy to be detained. Although Kublai would not forget this slight of imprisoning his ambassadors, he nonetheless had to focus on more pressing affairs with the threat of his brother and rival Khan. From 1260 to 1262 the Song forces raided Kublai's southern border which forced Kublai to retaliate with some minor incursions until 1264, when his brother finally surrendered and ended the civil war. In 1265 the first major battle in five years erupted in Sichuan province, where Kublai gained a preliminary victory and considerable war booty of 146 Song naval ships.

### Growing discontent

While Kublai attended to other matters in the north, the Song court was mobilizing its populace for war and all available resources that could be rendered and drained into the war effort. In the mid 13th century, the Song government led by Jia Sidao began confiscating portions of estates owned by the rich in order to raise revenues in a land nationalization scheme. This had the negative effect of alienating the wealthy landowners and hastening the collapse of the empire, as wealthy landlords and merchants favored what they deemed the inevitable Mongol conquest and rule than the other alternative of paying higher taxes for continual, exhaustive warfare.
There was also mounting political opposition against Chancellor Jia Sidao. Jia had purged several dissident officials who were opposed to his reforms aimed at limiting official corruption and personal profiteering. When he replaced some of these officials with his own cronies, however, political conditions were ripe for a schism at court and within the gentry class that would be favorable to a strong, unified force led by Kublai. Kublai used various ploys and gestures in order to entice defectors from the Southern Song to his side. Kublai Khan established Dadu (Beijing) as his new capital in 1264, catering to the likes of the Chinese with his advisor Liu Bingzhong and the naming of his dynasty with the Chinese word for "primal" ("Yuan"). He made it a policy to grant land, clothing, and oxen to Song Chinese who defected to his side. Kublai Khan chose the moral high ground of releasing Song captives and prisoners while Jia Sidao refused to release Kublai's emissary Hao Jing. In 1261 Kublai personally released seventy-five Song merchants captured at the border; in 1263 he released fifty-seven merchants; in 1269 he released forty-five merchants. In 1264 he publicly reprimanded his own officers for executing two Song generals without trial or investigation. With these acts his reputation and legitimacy in the eyes of the Chinese were greatly enhanced.

### Battle of Xiangyang

The siege of the city Xiangyang was a long, drawn out conflict from 1268 to 1273. Xiangyang and the adjacent town of Fancheng were located on the opposite bank of the Han River and were the last fortified obstacles in Kublai's way towards the rich Yangzi River basin. Kublai made an attempt to starve the city of its supply lines by gaining naval supremacy along the Han River in a gigantic blockade. It was the Song defector Liu Zheng who was the main proponent in advising Kublai Khan to expand the Yuan's naval strength, which was a great factor in their success. An international force – composed of Chinese, Jurchens, Koreans, Mongols, Uyghur Turks, and Middle Eastern Muslims— contributed to Kublai's siege effort in crafting ships and artillery. On several occasions—August 1269, March 1270, August 1271, and September 1272—the Southern Song attempted to break the Yuan blockade with its own navy, yet each attempt was a costly failure of thousands of men and hundreds of ships. After the siege, in the summer of 1273, Kublai appointed the Chinese general Shi Tianze and Turkic general Bayan as the commander-in-chief of the armed forces. However, Shi Tianze died in 1275; Bayan was then granted a force of 200,000 (composed mostly of Han Chinese) to assault Song.

### Final resistance

In March 1275 the forces of Bayan faced the army of Chancellor Jia Sidao, which was 130,000 strong; the result was a decisive victory for Bayan, and Jia was forced to retreat after many deserted him. This was the opportune moment for his political rivals to smite him. Jia was effectively stripped of rank, title, and office and banished to Fujian in exile from the court; while en route to Fujian, he was killed by the same commander that was appointed to accompany him. After his death many of his supporters and opposing ministers submitted to Bayan. By 1276 the Yuan army had conquered nearly all of the Southern Song's territory, including the capital at Hangzhou.
Meanwhile, the rebel remnants of the Song court fled to Fuzhou. Emperor Gong was left behind as the empress dowager submitted to Bayan, horrified by reports of the total slaughter of Changzhou. Before the capital was taken, Empress Dowager Xie (1208–1282) made attempts to negotiate with Bayan, promising annual tribute to the Yuan dynasty, but he rejected these proposals. After her attempts at diplomacy had failed, she handed over the Song dynasty's imperial seal to Bayan, "an unambiguous symbol of capitulation." With the submission of Emperor Gong, Bayan ordered that the Song imperial family should be respected, and forbade the pillaging of their imperial tombs or treasuries. Kublai granted the deposed emperor the title "Duke of Ying", but he was eventually exiled to Tibet where he took up a monastic life in 1296.
Any hope of resistance was centered on two young princes, Emperor Gong's brothers. The older boy, Zhao Shi, who was nine years old, was declared emperor on June 14, 1276, in Fuzhou. The court sought refuge in Quanzhou, seeking an alliance with the Superintendent of Maritime Shipping, the Muslim Pu Shougeng. However, he secretly formed an alliance with Kublai, so the Song court was forced to flee in 1277. Pu defected after Song general Zhang Shijie seized his ships and properties after Pu refused to lend Zhang ships for the war. The court then sought refuge in Silvermine Bay (Mui Wo) on Lantau Island. The older brother became ill and died on May 8, 1278, at age ten, and was succeeded by his younger brother who became Emperor Huaizong of Song, aged seven. The Sung Wong Toi monument in Kowloon commemorates his enthronement. On March 19, 1279, the Song army was defeated in its last battle, the Battle of Yamen, fought against the Yuan army led by the Han general Zhang Hongfan in the Pearl River Delta. Song Prime Minister Lu Xiufu is said to have taken the boy emperor in his arms and jumped from his sinking ship into the sea, drowning both of them.

## Historical literature

During the Song dynasty, the Zizhi Tongjian (Chinese: 資治通鑒/资治通鉴; Wade–Giles : Tzu-chih t'ung-chien; literally "Comprehensive Mirror for/to Aid in Government") was an enormous work of Chinese historiography, a written approach to a universal history of China, compiled in the 11th century. The work was first ordered to be compiled by Emperor Yingzong of Song in 1065, the team of scholars headed by Sima Guang, who presented the completed work to Emperor Shenzong of Song in 1084. Its total length was 294 volumes containing roughly 3 million Chinese characters. The Zizhi Tongjian covers the people, places, and events of Chinese history from the beginning of the Warring States in 403 BC until the beginning of the Song dynasty in 959. Its size, brevity, and scope has often been compared to the groundbreaking work of Chinese historiography compiled by the ancient historian Sima Qian (145 BC–90 BC), known as the Shiji. This historical work was later compiled and condensed into fifty nine different books by the Neo-Confucian philosopher Zhu Xi in 1189, yet his pupils had to complete the work shortly after his death in 1200. During the Manchu Qing dynasty, the book was reprinted in 1708, while the European Jesuit Father Joseph Anne Maria de Moyriac de Mailla (1679–1748) translated it shortly after in 1737. It was later edited and published by the Jesuit Abbé, Jean Baptiste Gabriel Alexandre Grosier (1743–1823), in part with Le Roux des Hauterays, where a thirteenth volume and a title page were added. It was also translated and published by the Jesuit astronomer Antoine Gaubil in 1759, whose pupils founded a Russian school of sinology.
Another historical source was the enormous encyclopedia Prime Tortoise of the Record Bureau published by 1013, one of the Four Great Books of Song. Divided into 1000 volumes of 9.4 million written Chinese characters, this book provided important information on political essays of the period, extensive autobiographies on rulers and various subjects, as well as a multitude of memorials and decrees brought forth to the imperial court. However, the official history of the Song dynasty was the Song Shi, compiled in 1345 during the Yuan dynasty. The recorded history of the Jurchen Jin dynasty, the Jin Shi, was compiled in the same year.