China Divided and Reunited 220-618

Power eventually split three ways between Cao Cao in the north, Liu Bei in Sichuan, and Sun Quan in the south, as Cao Cao was defeated by the latter two, who allied together to defend themselves. After Cao Cao died in 220, his son Cao Pei usurped the throne and named his dynasty Wei; the next year Liu Bei, claiming to be of the house of Han, proclaimed the Shu Han dynasty; and in 222 Sun Quan founded the Wu dynasty to begin the Three Kingdoms period. In this era of warfare Wei defeated the Yan king in southern Manchuria and conquered Korea; Shu Han invaded the southwest; and Wu's military power extended into Vietnam. In Wei a system of classifying officials into nine grades was supposed to select the best men; but emphasis on filial piety favored superficial outward behavior, and soon men were being selected primarily for family status, power, wealth, and military distinction.
Generals from dominant families like the Sima gained power in Wei. Yet for a decade during the regency of Cao Shuang and Sima Yi, philosophers Ho Yen and Wang Bi (226-49) gave official advice based on the mysteries of Lao-ziZhuang-zi, and the Yi Jing until Sima Yi took control and executed Cao Shuang and Ho Yen in 249. Daoist Wang Bi, who died in a plague, taught that virtue could be attained through non-being. Daoism grew in popularity as outstanding individuals such as the seven sages of the bamboo grove retreated from political life and participated in "purified conversation." One of the seven, Ruan Ji (210-63), refused to accept an official position and once stayed drunk for sixty days in order to avoid a marriage alliance proposed by Sima Zhao. Ruan Ji entitled all his poems "Songs of My Cares," and he protested the Sima clan's usurpation of power. Xi Kang (223-62) believed in transcending moral doctrines of good and evil by harmoniously entering into the feelings of all living creatures. No longer having an ego, he asked why he should feel anxious. The best person makes use of the heart without having attachments. Xi Kang criticized the boredom of official life, the servitude imposed by propriety and morals, and social affectation. He worked as a smith, but he was executed for being impolite to an important minister and for defending a friend unjustly accused of violating filial piety.
Guo Xiang (d. 312) was a high government official who incorporated Xiang Xiu's Commentary on Zhuang-zi into his own. Guo Xiang recommended spontaneity in a changing universe. To imitate sages is to imitate the dead past instead of meeting the living present. Everything is always changing, and institutions and morals are not exceptions; when they do not change, they become artificial and harmful. One should live according to one's own nature, not that of others, so that integrity will be preserved. Transcending distinctions leads to freedom and happiness. The Daoist alchemist Go Hong (253-333) quoted the writing of Bao Jingyen who criticized Confucian literati for assuming that heaven placed rulers over people when it was really the strong oppressing the weak and the cunning tricking the innocent that caused mastery and servitude. Using force against other creatures is not natural but humans' attempts to gain useless adornments. Go Hong complained that the poor were forced to work so that officials could enjoy fat salaries.
Sima Yen succeeded his father as Wei ruler in 251, conquered Shu Han in 263, and two years after that declared himself Wu Di Qin, the Martial Emperor of Qin. Four centuries of Han law were compiled into a new Qin code. Wu Di Qin also annexed the Wu kingdom in 280, briefly reuniting China; but ten years later his death and the Jia family stimulated a civil war called the Revolt of the Eight Kings.
Sixteen kingdoms of five "barbarians" (Xiongnu, Jie, Xian Bei, Qiang, and Di) ruled northern China between 304 and 439. In 304 a Di family founded the Cheng Han kingdom in Sichuan, while the Xiongnu of southern Shansi became the independent kingdom of Zhao, seizing Luoyang in 311 and Chang'an five years later, once again destroying the library. A Buddhist monk from Central Asia named Fotudeng advised Zhao ruler Shi Hu to rule with compassion and avoid killing; though he said the guilty could be executed, killing the innocent would cause calamities. When a minister complained the Buddha was a foreign deity, Shi Hu replied that as he and the people of Zhao were also foreign, Buddha was the very god they should worship.
In the 4th century most of northwestern China converted to Buddhism. Yao Xing (r. 393-415) of the Later Qin patronized Buddhism, sustaining 3,000 monks with his donations. Kumarajiva (350-413), son of a Brahmin father and Kuchean princess, was born at Kucha, followed his mother into a Buddhist order at age seven, studied Buddhism in Kashmir, and was converted to Mahayana in Kashgar. Kumarajiva was kept a prisoner at Wuwei by general Lu Guang of the Earlier Qin kingdom for seventeen years until Later Qin ruler Yao Xing conquered Gansu in 401 and took Kumarajiva to Chang'an, where he directed a team of scholars in making excellent translations of Buddhist scriptures.
While millions of people migrated south into the Yangzi valley, the Eastern Qin established themselves at Jiankang (near current Nanjing) in 317. Ho Chong became regent in 345 and promoted Buddhism at court; two years later Sichuan was subjugated. When Emperor Xiaowu came of age, he indulged in pleasures while allowing monks and nuns to run the government. Daoan (312-85) promoted Buddhism south and north of the Yangzi River. Graft and corruption increased at the Eastern Qin court, and during the reign (397-418) of An Di a great peasant rebellion broke out and threatened Jiankang in 400 CE but was crushed in two years. About twenty years after founding the Donglin monastery in the Yangzi valley, in 402 Huiyuan (334-417) led initiated monks and lay people in vowing to be reborn in the Pure Land of the western paradise proclaimed by Mahayana Buddhism. Huiyuan communicated with Kumarajiva and wrote the Treatise on the Three Rewards to defend the doctrine of karma by explaining that some actions have their consequences in future lives. Faxian, after spending 15 years traveling to India, in 414 settled in Jiankang to translate the Buddhist scriptures he brought back.
General Liu Yu organized a campaign to invade Henan province and captured Luoyang and Chang'an in 417, but the territories were lost as soon as he returned south. He forced the Eastern Qin emperor to abdicate and founded the Liu Song dynasty at Jiankang in 420; but it was overthrown in 479 by a general named Xiao Daocheng, who proclaimed the Qi dynasty. In 502 this was transformed into the Liang when his relative Xiao Yen became the Martial Emperor (Wu Di) of Liang and patronized Buddhism so generously that Confucians protested. In 507 he sponsored a debate on the immortality of the soul, and materialist Fan Zhen criticized the money spent on lazy monks, monasteries, and images. In 529 it was said 50,000 Buddhists assembled, and four years later 300,000 persons received material gifts along with Buddhist doctrine. The preaching emperor joined the Buddhist community three times and had to be bought back by the court for large ransoms. When Liang Wu Di died in 549, powerful generals caused a civil war until one of them established the Chen dynasty (557-89) that was taken over by the Sui.

Northern China was united for a few years when Tibetans led by Fu Jian (r. 357-85) used great military force to expand the Eastern Qin kingdom. After capturing Xiangyang with 100,000 soldiers Fu Jian brought Daoan back to Chang'an. Daoan advised Fu Jian not to attack the Eastern Qin but was not heeded, and in 383 their massive army was defeated at Fei River in a critical battle that preserved Chinese culture in the south. The Toba people had moved into northern Shansi and asserted their independence in 386 as the Northern Wei, which eventually gained control of northern China in 439. During the reign (386-409) of Dao Wu Di 460,000 people were deported. Convicts were made slaves at Buddhist monasteries to reclaim wasted land by cultivation.
Confucian Cui Hao (381-450) became chancellor and gained influence with Wu Di (r. 424-51) by promoting the successful campaign against the Bei Liang kingdom in the northwest in 439. Cui Hao also recommended his Daoist friend Kou Qianzhi, who prevented the ruler from executing 3,000 resisting monks captured in that battle at Liangzhou, putting them in labor battalions. Cui Hao won the Daoist master over to Confucian principles and applied a strong Chinese penal code to the Wei kingdom. Kou after having a series of visions and taking the title of Heavenly Master persuaded the Northern Wei emperor to declare Daoism the official religion in 444, condemning mediums and sorcerers and abolishing most local cults, while anyone supporting Buddhist monks privately might be executed. Two leading monks were executed, and during a rebellion the next year at Chang'an weapons were found in a Buddhist monastery. The emperor condemned those monks to death, and Cui Hao suggested executing all the monks in the realm, though Kou managed to delay that. Cui Hao was hated for his prejudice against non-Chinese in the history he was writing, and the people's complaints led the emperor to liquidate him and his entire clan of 128 people. When Wu Di died, his successor granted Buddhists freedom. During the 5th century and early 6th nine peasant rebellions were stimulated by bands of Buddhists.
Xiao Wen Di (r. 471-99) promoted Chinese customs and prohibited other languages in court; when nomadic fighters resented the influence of Confucian scholars, he even executed his own son for refusing to cooperate with the Sinicization program. Early in his reign Buddhist monasteries were greatly expanded by Tanyao's plan of assigning penal slaves to cultivate their fields. With many farms abandoned after two centuries of war, in 485 the Wei government began distributing land to males over 15 years of age. During the reign (515-28) of Xiao Ming Di his empress Hu oversaw lavish building as Luoyang became a great center of Buddhism. By the end of the Northern Wei dynasty there were said to be 30,000 monasteries and two million Buddhist clergy. Outside the capital less effete military forces in six garrisons revolted in 523, and a civil war raged for a decade. Empress Hu had Xiao Ming Di assassinated and put a child on the throne; but tribal armies from Shansi seized Luoyang, drowned them both in the Yellow River, and murdered two thousand courtiers.
In 534 General Gao Huan set up an Eastern Wei emperor hostile to Chinese culture that in 550 became the Northern Qi dynasty, while general Yuwen Tai created a Western Wei puppet depending on the Chinese aristocracy at Chang'an. In 544 this emperor recommended the following Confucian principles to local officials: administer with compassion, value learning, cultivate land, use able and good people; penalize sparingly, and tax fairly. His son took the throne to found a Northern Zhou dynasty in 557. Wu Di of Northern Zhou (r. 561-78) organized a debate between Confucians, Buddhists, and Daoists, and in 573 he declared Confucians the winner and the next year interdicted the losing Buddhists and Daoists. Using the strategic capital at Chang'an, this dynasty also destroyed the Northern Qi in 577, reunifying north China.
Sui Dynasty 581-617
Yang Jian (541-604) married a devout Buddhist, whose father Dugu Xin had been forced to commit suicide by a powerful Yuwen prince in 557. Yang Jian succeeded his father as Duke Sui in 568. As a reward for helping Wu Di on his victory over the Northern Qi in Henan in 577 Yang Jian was appointed commander of the army and governed the conquered territory. The religious persecution ended with Wu Di's death; but his son Yuwen Bin was Yang Jian's son-in-law and violated his consorts and concubines. After ruling two years he died in 580, leaving a 7-year-old son under the control of General Yang Jian, who ended the proscription of the Buddhists and had 120 monks ordained for the temples in Luoyang and Chang'an. Two senior princes failed to assassinate Yang Jian and were executed. The boy abdicated in 581, and Yang Jian usurped the throne as Wen Di (r. 581-604) to found the Sui dynasty. Sui Wen Di claimed the mandate of heaven but put to death 59 members of the Yuwen family; yet as a Buddhist he believed in karma, and these killings would haunt him. Wen Di established national Buddhist temples, and in 583 he ordered regular services performed. The ban on Daoists was also lifted, and Daoists were granted a metropolitan temple.

Wen Di had previously revised Northern Zhou laws, and he promulgated a New Code in 581, moderating previously severe punishments. In 583 Wen Di ordered the code simplified, and the commission headed by Pei Zheng reduced the Kaihuang Code to 500 articles. The main punishments were death, deportation to forced labor or military service, and beatings. Officials could commute these sentences to fines measured in copper. The Tribunal of Censors investigated crimes and supervised all imperial officials. The Board of Civil Office appointed suitable officials according to nine ranks, each with an upper and lower grade, and they were also responsible for annual reviews. Thus hereditary privilege was lessened. In 587 Wen Di ordered the prefectures to send three worthy men annually to the capital, but merchants and artisans were disqualified. He established schools for the study of the Confucian classics, and he particularly admired the Classic of Filial Submission. Examinations on a single classic or for literary ability were used to screen men for positions. The rule of avoidance meant that local officials could not serve in their place of origin so that family and friends would not influence them. Terms of service were for only three or four years, and parents and sons over fifteen could not accompany them. Each prefecture sent delegates to an annual court assembly.

In 588 a Sui edict condemned the immoral incompetence of the Chen ruler, and the next year eight forces said to total 518,000 men attacked the Chen in eight different places with armies, cavalry using 100,000 fresh horses from the north, and three flotillas of ships led by Yang Su. The Chen capital at Jiankang was defended by more than 100,000 troops; but the Sui forces took over the entire Chen domain of southern and eastern China from the Yangzi River to the South China Sea. Chen officials were treated leniently, and local administrations were governed by newly appointed Sui officials. However, Su Wei tried to impose the "Five Teachings" of public and private morality so forcefully that revolts broke out and killed Sui officials. Yang Su had to suppress the rebellion by killing thousands and executing their leaders.

Yang Guang, the second son of Wen Di, was the official commander in the Chen war and became the ruler of the conquered territory in 589. He attempted to make them loyal Sui subjects by introducing rational administration. He ordered Buddhist scriptures collected and copied, building a library and Buddhist temples. In 591 at Qiangdu during a vegetarian feast for a thousand monks Yang Guang asked Zhiyi (538-97), founder of Tiantai Buddhism and the most respected monk in the south, to name him a bodhisattva. Later Zhiyi petitioned Yang Guang to stop the razing of the Chen capital, particularly its Buddhist temples, and he complained after a thousand monks, who had come to hear him speak, were dispersed by Sui officials. In addition to supporting Buddhism Yang Guang had two Daoist monasteries built at his capital.

Yang Su used cavalry to scatter the army of the Eastern Turks. Wen Di ordered the collecting of a progressive grain tax that stored as much as three-quarters of a large crop but took nothing in hard years, establishing relief granaries to prevent famines. A canal was constructed from Chang'an to the Yellow River, and great walls were built in the northwest. Construction on a grand scale was begun at both capitals of Chang'an and Luoyang. Sui Wen Di also saw the completion of the Tongji canal connecting the Yellow River with the Huai and the Yangzi, and his armies gained control of northern Vietnam. In spite of his massive construction projects a militia system lessened military expenses except during campaigns, and Wen Di by frugality and his huge granaries was able to reduce taxation and exempt new population from taxes for ten years. He even proclaimed himself a disciple of the Buddha and donated 120,000 bolts of silk to repair the damage of the recent persecutions in the north.

Books were collected, annotated, and copied. An edict of 593 forbade apocryphal and prognostic books; unofficial histories and character reading were also prohibited to prevent subversion. Wen Di became dissatisfied with Confucianism, and in 601 all schools in the empire were abolished except for one college with seventy students in the capital. Instead the Emperor distributed Buddhist relics to all the prefectures, and thirty missions were sent out, followed by 53 the next year and thirty more in 604.

In 600 Yang Guang visited his mother, the monogamist Empress, who complained that the crown prince Yong had four sons by a concubine. Yang Guang began to plot against his brother Yong and was supported by Yang Su; later that year Yang Guang had himself proclaimed crown prince. In 603 Wen Di degraded his fourth son on suspicion of black magic. The next year the Emperor became ill, and Yang Guang ascended the throne, as Yang Su may have suppressed the reinstatement of Yong as successor. Han prince Liang, the youngest brother, revolted in the east; but Yang Su's army defeated his forces and put him in prison, where he soon died.

So Yang Guang became the second Sui emperor as Yang Di (r. 604-17). He traveled frequently between his three capitals at Daxing Cheng in the west, Luoyang, and his beloved Yangzi capital at Qiangdu. Yang Di was criticized for the extravagant re-building of the capital at Luoyang. Great libraries were built; the largest at Luoyang had 370,000 scrolls. An examination system based on the Confucian classics was instituted in 606 to attract scholars into the bureaucracy from the south. The new emperor disliked the criticism of his father's advisor Gao Qiong and had him executed in 607. Several other important officials were also put to death, and their families were banished. Yang Di continued to conscript large numbers of workers to extend canals to Hangzhou Bay and north to what is now Beijing, to build the great wall at Shansi, and to complete projects at Chang'an and Luoyang. Not frugal like his father, it was said that he once hired 18,000 musicians to entertain guests for a month. Such ambitious projects and floods on the lower Yellow River in 611 caused greater peasant rebellions in Hebei and Shandong.

In 608 a Sui army led by Yuwen Shu was sent to assist the Tuyu Hun; but when the latter fled, Yuwen Shu drove them from their land and enslaved 4,000 captives. Yang Di personally led the campaign against the Tuyu Hun in the Gansu corridor the next year. An expedition against Formosa or the islands in the China Sea failed in 610. The Chinese also failed to get Turkish mercenaries, and special war taxes were levied. The Sui dynasty began its decline when Yang Di mobilized 1,132,800 men for a campaign against Koguryo (
Korea) in 612. Although Yang Di's armies had conquered Tibet, the three annual campaigns against northern Korea and southern Manchuria were disastrous; Eastern Turks revolted, and uprisings occurred until the end of the dynasty. In 615 Yang Di offered bounties to fight against the Turks at Yenmen and announced the end of the unpopular Koguryo war; but when the Emperor went back on both promises, he lost credibility. Stimulated by his son Li Shimin, general Li Yuan rebelled in Shansi, allied with Turkish tribes, and marched on Chang'an, where he founded the Tang dynasty. As the Sui empire was disintegrating, Yang Di fled to southern China, where he was assassinated in his bath by a descendant of the Yuwen family and the son of his general Yuwen Shu in 618.
Tang Dynasty Empire 618-906
While Li Yuan reigned (618-26) as Gaozu at Chang'an, many contenders for the Sui throne fought each other in the south. Gaozu had twelve large standing armies plus regional commands of local militias. Yet with so many domestic battles, Gaozu paid tribute to the Eastern Turks to keep them from invading. In 622 the twelve imperial armies were disbanded. That year Li Shimin stopped a force of 150,000 Turks led by khagan Xieli into Taiyuan; but the next year the twelve armies were called back to counter the Turkish threat that put the capital at Chang'an under martial law and to face another incursion into Taiyuan in 625. Tang armies led by the Emperor's sons, Li Shimin in the south and eastern plain and crown prince Jiancheng in the northwest, offered amnesty and put down most of the resistance by 624.

Uniform coins were minted starting in 621. Most of the great Luoyang library was lost in a disastrous accident in 622, leaving only 90,000 scrolls, though this was increased to 200,000 by the end of the reign. By 624 Gaozu had completed a centralized code of Tang laws, distributed land to adult males, implemented the northern equal-field system, and reformed taxes to apply to persons instead of property. Irrigation systems were constructed diverting water from the Huangho (Yellow River) in 624, and a canal was built in Shensi to transport grain to the capital. The three schools in Chang'an were re-opened to prepare sons of the aristocracy for examinations. At court heated debates took place between Confucians, Buddhists, and Daoists. The court astrologer Fu Yi wrote memorials criticizing Buddhism for removing tens of thousands of men and women from secular work. In 626 Gaozu reduced 120 Buddhist temples to three and Daoist temples from about ten to one; but these directives were canceled three months later when Gaozu's son Li Shimin took over the government.

Li Shimin had gained much prestige for his victories over the rebel leaders Dou Jiande and Wang Shichong, and in 621 he founded his own literary college. After falsely accusing his brothers of having illicit relations with the imperial harem, Li Shimin ambushed them at the palace gate, killing the heir apparent Jiancheng himself, while his officer murdered his younger brother Yuanji. Three days later Li Shimin proclaimed himself Emperor Tang Taizong (r. 626-49) and forced his father to retire. Having had a successful military career, Taizong restrained building projects and listened to his advisors, gaining a fine reputation for good Confucian rule for several years. He expanded Confucian education, standardized the curriculum on its classics, and developed the civil service examination system. Under his father the Sui bureaucracy had doubled, but Taizong reduced administrative subdivisions.

Relief granaries were established in 628. That year a school of calligraphy was founded, followed by a school of law in 632. A commission was appointed in 629 to write histories, and the same year an imperial order proclaimed that monks illegally ordained for tax evasion were to be executed, though after ten years of development a new law code was decreed in 637 that reduced the number of capital offenses. By 637 Ma Zhou was complaining of increased labor services and disregard of the people, and Wei Zheng criticized Taizong's arrogance and extravagance. The appointment of Wei Zheng as counselor had set an example of amnesty, because he had supported a major rebel. In 639 Taizong ordered clergy to obey the dying instructions of the 
Buddha in the Fo Yijiao jing in order to keep them out of politics. Xuan Zang (602-64) traveled to India (629-45) and then returned to Chang'an to direct the translation of 1338 chapters of Buddhist texts out of the total 5084 translated into Chinese over six centuries.

Wars between the Turks helped the Tang regime to subjugate the Eastern Turks in 630 when Taizong was declared a khan, their chief ruler. About 100,000 defeated Turks were resettled in southern China. The silk route west was protected when the Chinese were aided by the Uighur tribes in taking the Tarim Basin from the Western Turks, who were also divided by a civil war in 630. An administrative protectorate was established there along with one in the north for Mongolia, in the east for southern Manchuria, and in the south called Annan, which later gave the name Annam to 
Vietnam. The state of Karashahr began paying tribute to the Tang in 632; but an alliance with the Western Turks made them stop until the Chinese invaded and occupied Karashahr in 644, defeating the Western Turkish army. This war caused Kucha to stop paying tribute until the Tang army defeated them in 648.

The Tibetan Tuyuhun brought tribute to Chang'an in 634 but plundered Chinese territory on their way home, causing the Tang army to launch a punitive campaign. Tibetan king Srongbtsansgampo asked to marry a Chinese princess and was rebuffed, causing fighting until the Chinese complied in 641. Peace was maintained with the Koguryo after they sent tribute to the Tang in 619 until the Tang vassal state Silla complained that Koguryo and Paekche attacked them in 643. A large Tang campaign was planned; but in 645 the Tang army could not take the fortress city of Anshi, and thousands of returning soldiers perished in a blizzard. Taizong ordered a large armada built and prepared an even larger expedition, but he died before it could be launched. Despite this disappointment at the end of his life, Taizong was remembered as one of the greatest of Chinese emperors, and his discussions with his advisors compiled by Wu Jing in 705 in the Zhenguan Zhengyao became a popular guidebook on imperial government.

The heir apparent Li Chengqian's plot to take the throne was exposed when Qi prince Li You's revolt failed in 643. Chengqian was degraded to a commoner and died the next year. Taizong was succeeded by his son Li Zhi, who became Gaozong (r. 649-83); but most of his reign was overshadowed by the clever and powerful Empress Wu. Wu Zhao came to the palace about 640 during her teens as a low-ranking concubine. According to the story, after Taizong died, she went to a nunnery, where she was found by Gaozong and bore him a son in 652. The Empress Wang had made many enemies; Wu intrigued with them until Wang was demoted, and Wu became Gaozong's principal consort in 655. Wu then had Wang and her concubine accomplice murdered, and many of her opponents were also purged by exile, murder, or suicide.

When Gaozong suffered bad health as the result of a stroke in 660, Empress Wu took control of the imperial administration. She became a devoted Daoist, and the immense Buddhist translation project was ended in 664. 
Lao-zi was given resplendent titles in 666, and Daoist temples were erected in every prefecture. That year the currency was debased 90%, and in 670 grain was so scarce that wine brewing was prohibited. More than half the population was unregistered and so paid no taxes. In 674 Empress Wu tried to win public favor by proclaiming an enlightened twelve-point reform program that promoted agriculture, remission of taxes, cessation of military operations, no extravagant building, reduction of unpaid labor, increased free expression, suppression of slander, study of the Dao De Jing, full mourning periods for mothers, making honorific officials permanent, increased official salaries, and promotion of talented officials. Yet the next year she started removing imperial family members she considered threatening, and many prominent officials were banished. Meanwhile the empire was in a financial crisis because of decades of ruinous wars and extravagant public building. The examinations were suspended most of the time between 669 and 679 but were held regularly after they were reformed in 681.

By helping the Silla defeat the Koguryo, Tang forces made a unified Korea a loyal vassal in 668 as 200,000 captives were deported to China. Two years later a revolt against Chinese occupation restored the Koguryo house, and in 676 the Chinese withdrew from Pyongyang. During the reign of Gaozong the Tarim Basin was lost to Tibet, though it was later regained under Empress Wu. Tang armies were able to quell a 679 rebellion by Eastern Turks after heavy losses by 681. Empress Wu deposed Gaozong's successor after one year and installed a puppet, ordering many in the royal family and hundreds of aristocrats executed. She quelled rebellions by rewarding those who resisted them while granting amnesty to those who had been coerced into joining them. In 685 she took a lover, who was installed as abbot of the most prestigious monastery.

In 690 Empress Wu inaugurated the Zhou dynasty, proclaimed herself an incarnation of the future Buddha Maitreya, and made Luoyang the "holy capital." In 693 she replaced the compulsory 
Dao De Jing in the curriculum temporarily with her own Rules for Officials. In 697 while Empress Wu was considering adding to the 870 tons of bronze already used for nine ceremonial tripods, Khitans were marching unopposed into the Beijing area. Then she sent two large armies to stop their advance. Eventually she allowed the Northern Turks led by Qapaghan with his army of 400,000 to take over large territories north of the Wall. The last years of her reign were dominated by the Zhang brothers when corruption and patronage became widespread until they were executed by a conspiracy in 705. The Tang dynasty was restored, and Empress Wu died later that year. Objective assessment of her policies is difficult since Confucian historians disapproved of her as a woman and a Daoist. For five years while Empress Wei and her daughter were powerful, princes, officials, favorites, and monasteries enriched themselves and enlarged their estates, while taxes falling on peasant farmers and tenants multiplied.

In 710 Xuanzong (r. 712-56) put his father on the throne but after two years became emperor himself. After the Taiping princess committed suicide in 713, all but one of the chief ministers were executed or committed suicide. Yao Chong implemented the following ten reforms: govern humanely instead of by harsh deterrents; refrain from military adventures; apply law equally to all; exclude eunuchs from politics; prohibit excessive taxes; exclude imperial relatives from the central government; restore the personal authority of the emperor; allow ministers to freely remonstrate without fear of punishment; suspend construction of Buddhist and Daoist temples; and eliminate the power of consort families. Court business was now conducted openly in public, and examination graduates were appointed as the chief ministers. The Buddhist clergy was investigated, and more than 30,000 monks and nuns were returned to lay life. Building of new monasteries was banned. New Statutes, Regulations and Ordinances were promulgated in 715. Stored grain was no longer sent to the capital as revenue but was saved for relieving famine.

Xuanzong managed to increase the number of families on the tax registers, gave more control to local military commanders, increased the number of horses by improving government stud farms, and repaired canals to facilitate grain transport from the south to northern armies. As population increased along with the concentration of wealth and property, there was not enough land for the poor, and per-capita taxes paid in grain, cloth (silk or hemp), and labor (or military service) became problematic; gradually more progressive taxes on land and wealth were instituted along with commercial taxes.

Although fighting occurred in 714 with the Tibetans and Eastern Turks, a large imperial army estimated in 722 at more than 600,000 kept the peace. Zhang Yue persuaded the Emperor to return a third of these to farming. By 723 120,000 paid soldiers had replaced the militia in the capital guards, and frontier armies also became more professional. Chief ministers were also paid regularly with the revenues of 300 households, while provincial officials received regular salaries, though allowances for their attendants were cut. Roads with post-stations at intervals provided hostels and restaurants for traveling officials. Hierarchical and delegated government authority included an independent board of censors to investigate public and private abuses by officials. After 738 more and more imperial edicts were drawn up by the Academy of Scholars.

Schools of Buddhism flourished throughout China as never before. The Pure Land sect practiced chanting homage to the Amitabha Buddha. One of its masters, Cimin (680-748), spent twelve years in India (704-16) and criticized the popular Chan school for concentrating on meditation while neglecting equally important learning and moral behavior. To limit corruption in growing Buddhist monasteries in 729 a government census was begun to assure that each prefecture had only one official monastery with no more than thirty monks. Xuanzong sponsored at the capital Tantric masters Subhakarasimha 716-35 and Vajrabodhi 719-41. In 741 the Emperor set up Daoist schools, and in 747 the 
Dao De Jing was declared the most important canonical book. The aristocracy won a major battle against the meritocracy in 737 when Wei valley noble Li Linfu overcame the scholarly civil servant Zhang Jiuling, and his new versions of the law codes and commentaries were promulgated. By 742 military forces of 574,733 men made up a little more than one percent of the population. The violent purges of Li Linfu that began in 744 removed many prominent men from government.

The peace with Tibet ended in 736 when they attacked Gilgit, and sporadic fighting continued through the rest of Xuanzong's reign. The Turkish empire ended when the Uighurs killed their last kaghan Baimei in 745. Although military expenditures were increasing, the great Tang empire in this era had no equal in the world. At this peak of imperial power in 751 Tang armies were defeated by the Thai state of Nanzhao, and the Muslims defeated the Tang's Korean general at Talas in Central Asia. When the prime minister Li Linfu died the next year, and the Emperor Xuanzong, distracted by a high-class prostitute, appointed his favorite Yang Guozhong, the slighted general An Lushan brought his armies from the north in 755 and took over Luoyang and Chang'an. The Emperor fled to Chengdu in Sichuan, where his army forced him to put to death his favorite concubine and her brother. Xuanzong was declared retired in 756 and died five years later. His son Suzong reigned (756-62) while China was torn apart by An Lushan's rebellion. An Lushan was murdered by his son in 757, and so was the general who took over the rebellion. In 760 insurgent bands massacred several thousand Arab and Persian merchants at Yangzhou.

Daizong (r. 762-79) sent a Turkish general to bribe the Uighurs, who helped Tang forces defeat the rebels at Chang'an in 763, the year the Tibetans invaded Chang'an. As regional commanders became more independent, the decline of the central government is indicated by the census figures for the next year that showed a population of 16,900,000 compared to 52,880,488 ten years earlier. Unable to raise revenues with regular taxes, the Tang state created a salt monopoly in 759 which in twenty years was producing half the government's revenue, as merchants became richer collecting salt taxes. Monopolies were also organized in alcohol in 764 and in the rapidly expanding consumption of tea in 793. Daizong was criticized for being influenced by the Tantric monk Amoghavajra (715-74).

The energetic Dezong (r. 779-805) tried to stop the decline. A twice annual tax on land and harvests was systematized by reformer Yang Yen in 780. Large sums of capital and credit stimulated commerce, as each provincial capital thrived. Improvements in growing rice enabled the south to export large amounts of food via canals. Yet rebellions by independent commanders in the northwest broke out between 781 and 786 after Emperor Dezong assigned a quota of taxes to each province and would not allow them to appoint their own governors. In 783 Dezong had to flee Chang'an. In this crisis the leadership of two eunuchs and Lu Zhi began the rise of the inner court's power. Tibet took advantage of the situation by breaking their pledge to help fight the rebels and by invading Shensi in 785. The independent Hebei provinces increased their armies; but the rebels could not get along with each other, and the south stayed loyal. Lu Zhi had served in the Hanlin Academy (779-91) before he was appointed chief minister; but he was replaced by the corrupt finance minister Pei Yenling in 795. In 790 Tibetans had defeated the Uighurs and the Tang army, but in 794 Nanzhao renounced Tibetan sovereignty and joined with the Chinese invading Tibet in 801. A half century of foreign wars were over by his death, and Dezong had built up the palace army to 100,000 though command was given to the eunuchs, who managed to get rid of the next monarch in a year.

Xianzong (r. 806-20) used Tang imperial power to quell rebellions in Sichuan and the Yangzi delta, though he had to compromise with the governors of Hebei. In 807 chief minister Li Jifu reported that only eight provinces were paying taxes to the Tang government. Pei Ji tried to gain money by controlling the price of silk, but mobilization for the internal wars of 809-10 exhausted Tang finances. Uprisings in the Huai valley and Pinglu province 815-18 were also crushed, restoring central governmental authority. After Pinglu governor Li Shidao was assassinated in 819, this dangerous northern province was divided into three parts. New prefectures were also organized in the Tianping and Yenhai provinces, and they were allowed to keep their entire revenues until 832.

Chinese militarism is indicated by government estimates of the number of soldiers that went from 850,000 in 807 to a record 990,000 in the early 820s; the central government alone was paying 400,000 in 837. Observing hysteria over moving a relic of the Buddha in 819, the influential writer Han Yu (768-824) criticized Buddhism as a foreign religion that changed Chinese customs adversely; he was banished for his temerity. In 836 an imperial decree forbade the Chinese from having relations with "people of color" (foreigners). Provincial administrations were controlled by eunuch army supervisors, who were resented by officials, and factional conflicts between the Niu and Li political parties weakened the Tang regime. Eunuchs had murdered Xianzong, and in despair Emperor Wenzong (r. 827-40) seems to have drank himself to death at the age of thirty. His attempt to ambush eunuchs in the "sweet dew" incident of 835 had resulted in the army massacring more than a thousand people in the government quarter.

When Wuzong (r. 840-46) became emperor, only the benevolence of Li Deyu, son of Li Jifu, prevented the two chief ministers of the Niu party from being put to death; but by consolidating power Li Deyu was able to implement some minor reforms in reducing the independence of the Hanlin secretaries. Li Deyu took command of the war against the Uighurs that killed 10,000 of them in 843. The cost of wars, harem luxury, and the eunuch establishment caused the Daoist Wuzong to try to solve the financial crisis by reigning in the economically powerful Buddhist monasteries and their monks that were exempt from taxation by closing 40,000 shrines, melting down their precious metals, confiscating their gems, freeing their 150,000 slaves (dependents), and returning 260,000 monks and nuns to lay life. Buddhist monasteries operated mills and oil presses, provided loans, lodgings for travelers, hospitals for the sick, homes for the aged, and primary schools for poor children. Other foreign religions that had also been tolerated, such as Zoroastrians, Nestorian Christians, and Manichaeans were closed down, though Jews and Muslims managed to survive.

The next emperor Xuanzong (r. 846-59) was elevated to the throne by palace eunuchs and immediately demoted Li Deyu, who was sent to an island, where he died in 850. Xuanzong revived Buddhism after the three-year persecution, executing eleven Daoist advisors who had urged that policy. Buddhists sects emphasizing rituals, shrines, and temples did not revive as well as the Pure Land and Chan schools that emphasized prayer and meditation respectively.

During the first half of the 9th century much of the tax burden had fallen on the prosperous lower Yangzi provinces until they could no longer be exploited. Thus in the second half of the century Tang administration gradually declined. Insurrections began in southern China in 856. A revolt broke out in Annam in 858, and the next year the Nan Zhao invaded. At the same time the bandit leader Qiu Fu revolted in Zhedong, gathering peasants who had abandoned their lands, though in 860 Qiu Fu was captured. Emperor Yizong (r. 859-73) was chronically ill from taking Daoist elixirs, and the hostility between the eunuchs and officials increased. In 868 a mutiny in Pang Xun had to be put down by using tribal cavalry from beyond the Great Wall. When Yizong's daughter died after marrying Wei Baoheng in 870, the Emperor executed her physicians and put their families in jail. Wei Baoheng then banished his opponents, and the mayor of Chang'an committed suicide. Yizong did further his father's patronage of Buddhism.

Two eunuch generals raised Yizong's fifth son to the throne as Xizong (r. 873-88). In 874 a rebellion led by Huang Chao began with defiance of the salt tax, and brigandage became widespread especially between the Yellow and Huai rivers. Bandits attacked prefectural cities and confederated into large organizations. By 877 few areas of China were free of rebel activity, but the next year the Tang government began winning victories. More mutinies north of the Yellow River weakened imperial forces, and in 879 rebels sacked Nanhai (Canton) and massacred foreign merchants. The capitals of Luoyang and Chang'an were captured by 600,000 insurgents led by Huang Chao in the next two years, forcing the Emperor to flee to Chengdu in Sichuan for four years. During the exile the court was divided by the hatred between the eunuchs and the aristocratic officials and tried to raise revenue with a monopoly tax on salt. Irked by a critical poem, Huang Chao ordered every poet killed and made anyone who could write do menial labor; more than 3,000 people were killed. Two prefect governors defected from the harsh Huang Chao. In 883 Shato leader Li Koyong's Hodong forces defeated the army of Huang Chao and those of other provinces before sacking the capital at Chang'an that had been abandoned again, leaving it in ruins. The next year Huang Chao was cornered and cut his own throat. His former ally Zhu Wen was by now a military governor.

Zhaozong (r. 888-904) merely tried to survive while eunuchs were in control of diminished territory. Local militias were organized by Wei Zhunjing to fight the rebels, and by 892 his 34 militia armies had about 45,000 men. During the ten-year revolt, regional commanders became independent. By 901 eunuchs and ministers were even injuring themselves to defeat their court enemies. A struggle for control in the north resulted in Zhu Wen setting up a puppet emperor in 904 and usurping the throne himself three years later when he moved the capital east to Bian (Kaifeng). He thus ended the Tang dynasty and founded the Later Liang dynasty (907-23) during which wars continued to ravage northern China.
Liao, Xi Xia, and Jin Dynasties 907-1234
After the collapse of the Tang dynasty in 907, northern China was ruled by a sequence of five dynasties until 960-Later Liang 907-23, Later Tang 923-36, Later Jin 936-46, Later Han 946-50, and Later Zhou 951-60. At the same time ten kingdoms ruled fairly consistently with eight of them in the south, the Tangut in the northwest, and the Khitans (Liao) in the far north. Block printing had been used to print books since at least the seventh century. In 940 an anthology of lyric poetry was published that was called Amidst the Flowers because many of the poems were about courtesans. Around the same time eleven Confucian classics were printed in 130 volumes. After the Later Han emperor was assassinated at the end of 950, the popular military leader Guo Wei proclaimed the Great Zhou dynasty (951-60) that unified most of northern China and in 955 melted down precious metals taken from Buddhist shrines to make coins. During this rebellious era many aristocratic estates were taken over by their managers. When the second Zhou ruler, Guo Rong, was succeeded by his six-year-old son in 959, soldiers rioted and made Zhao Kuangyin emperor. He restrained the military and founded the Song dynasty in 960.
Abaoji was born in 872, and in 901 he was elected chieftain of the Yila tribe. In 905 he led 70,000 cavalry in an attack on Datong in Shanxi and became the blood brother of Li Keyong. Two years later the chieftains recognized Abaoji as the great khan of the Khitan nation. He modeled the Liao government after the Chinese, and in 918 had a capital built. Abaoji called the military department of the government the Northern Chancellery and the civil section the Southern Chancellery. Although his empire took in sedentary peoples, the Khitans maintained the steppe traditions. Under Abaoji the Khitans took over Inner Mongolia and southern Manchuria, and the Liao had regional capitals. He extended the Liao empire east to the Yalu and Ussuri rivers, conquering the Bohai kingdom, where he died of typhoid fever in 926. Abaoji had named his son Bei the prince of Dongdan and his successor, and the clan name Yelu was adopted by his dynasty. However, Empress Yingtian and others forced Bei to abdicate and made her second son Deguang the second Liao emperor. Bei was drawn to Chinese culture and in 934 urged the Khitans to invade northern China. When the Khitans attacked in 936, the Later Tang ruler had Bei assassinated. In 940 an imperial decree abolished the Khitan custom of making a younger sister marry the husband of her dead older sister. The Liao demanded sixteen prefectures in northern China from the Later Jin and gained nineteen prefectures by invading the capital at Kaifeng in March 947, ending the Later Jin dynasty. Yelu Deguang put on the imperial robes of the Chinese, but he left when the weather got warm and died of illness in May.
Dowager Empress Yingtian named Bei's son Wuyu as emperor. The short-lived Later Hans (947-51) pushed back the Khitans and destroyed 30,000 Buddhist monasteries and shrines in order to confiscate their property. When Wuyu was killed by a rebellious nephew in 951, Deguang's son Yelu Jing became Emperor Muzong. He was violent and cruel, spending his time hunting and drinking; when he started killing his bodyguards, six attendants finally murdered him in 969. Then the Liao line reverted to Bei's grandson Xian, who became Emperor Jingzong. In 979 the Khitans defended the Northern Han and helped them defeat the attacking Song armies. Jingzong's son became Emperor Shengzong (r. 982-1031). The Liao empire assimilated Chinese immigrants and culture, while treating badly the Bohai people of eastern Manchuria. The Khitans adopted the Chinese examination system in 988 and began holding triennial exams. In 1005 the Song Chinese bought peace with the Khitans by offering to pay them 200,000 bolts of silk and 100,000 ounces of silver annually. After the Korean king was deposed in 1009, Shengzong led the Khitan invasion with an army reported to be 400,000 that burned the Korean capital at Kaekyong (Kaesong). The Liao made territorial demands, but in 1019 Korea gained a favorable settlement. The Bohai people rebelled in 1029 but were put down the following year. Xingzong (r. 1031-55) was also interested in Chinese culture. In 1036 the Liao compiled their laws passed since Abaoji, though conflicts between the tribes and the Chinese continued. A Liao edition of the complete BuddhistTripitaka was completed about 1075 while Daozong ruled the Liao from 1055 until 1101.
The last Liao ruler, Tianzuo (r. 1101-25), led the losing effort against the Jurchens until he fled west into the desert in 1122. Nobles put his uncle on the throne as Tianxi, and the Liao forces fought off the Song invasion. When Tianxi died in 1123, the Jurchens recaptured the southern capital, forcing Yelu Dashi and other nobles to flee to join Tianzuo. He led an attack on the Jurchens but in 1125 was defeated, captured, and died in prison. Meanwhile Yelu Dashi and a few hundred followers had crossed the Gobi Desert to Zhenzhou. He was given the Turkic title Gurkhan, meaning chief of the khans. In 1131 they moved northwest into Transoxiana and eventually became known as the Kara-Khitai, or Black Khitans. Yelu Dashi died in 1143 and was succeeded by his son and grandson, who ruled until they were absorbed by the Mongols in 1221.
Tangut chieftains of the Tuoba clan had been recognized as Xia dukes by the Tang empire in 883. Using the imperial surname Li, in 954 the Chinese acknowledged Li Yixing as the king of Xiping, and upon his death in 967 Song Taizu called him the king of Xia. Like Korea in the east, the Xia in the west had to compete with both the Liao and the Song empires. Li Jipeng became king of Xia in 980 and two years later went to live at Kaifeng as China's military governor of Xi (Western) Xia. His young cousin Li Jiqian objected to this submission and fled to the desert in the north. When the Song armies invaded the Khitans in 986, Li Jiqian became an ally of the Liao and attacked the Song forces. He married a Liao princess and in 990 was recognized by the Liao as king of Xia. The next year Li Jipeng came back from the Song court to fight his cousin and was called the king of Xiping by the Liao court. In 1004 Li Jiqian was killed fighting the Tibetans in the west, and Li Jipeng died the same year. Jiqian's son Li Deming became king and ruled the Xia until 1032.
Deming's son Yuanhao rejected the Li surname and thought his father had made Tanguts weak by accepting Chinese bribes. He went back to raiding, ordered a new script that used 6,000 characters, and in 1038 proclaimed himself emperor of Da (Great) Xia. Yuanhao ordered Tangut clothing worn and all men to shave their heads within three days or be decapitated. He conscripted men older than fourteen into his army and took the tribal nobility into his elite cavalry of 5,000. The Song empire closed its borders and became antagonistic. In 1042 the Liao joined with the Xia and threatened to invade China, resulting in a new treaty that increased the Song tribute to the Khitans to 300,000 bolts of silk and 200,000 ounces of silver. The Xia demanded tribute also, and in 1044 the Song agreed to give them 130,000 bolts of silk, 50,000 ounces of silver, and 20,000 catties of tea annually, plus lavish gifts on three annual festivals and Yuanhao's birthday. When Tangut tribes revolted in the Liao empire, a Khitan army of 100,000 crossed the border and defeated the Xia army. Yuanhao went to the Liao capital and returned to arouse his own forces that then defeated the Khitans.
In 1048 an opposing clan assassinated Yuanhao, and the next year the Liao took advantage of the chaos to invade again. In 1061 the fourteen-year-old heir Li Liangzuo reversed his father's policies and adopted Chinese culture; but the Song court insulted the Xia envoy in 1064, causing border skirmishes for several years. Li Liangzuo was called Emperor Yizong and died in 1068; his son Bingchang was only seven years old, and his mother ruled as regent. When she sent him to an isolated garrison in 1081, civil strife broke out. In 1086 Bingchang's son became Emperor Chongzong at the age of three. Another regency lasted until the Empress was poisoned by a Liao envoy in 1099, and then Chongzong ruled until 1139. He continued sinification and centralized his authority over the tribal chiefs, whom he appointed as kings. Buddhism was popular, and scriptures were translated from Chinese and Tibetan into Tangut. While the Liao empire was being taken over by the Jurchens, the Song briefly made the Xia submit in 1119. As the last Liao emperor was fleeing, the Xia emperor led a fight against the Jurchens in 1122, but the Xia were defeated the next year. In 1127 the Xia made a treaty with the new Jin empire that recognized their superiority and redefined borders.
Xia emperor Renzong (r. 1139-93) succeeded his father at the age of fifteen. Renzong had a Chinese mother and favored Chinese culture. His extravagance burdened the Tangut people and aroused rebellion. In 1143 a severe earthquake and Yellow River flooding devastated farmers. Ren Dejing, a former Song military commander whose daughter was an empress dowager, led the effort that suppressed the rebellion. Ren Dejing was named duke of Xiping and had an extravagant court. In 1170 he told the Emperor to divide the empire and recognize his independent state of Chu, but Renzong refused. Ren tried to send a messenger through Jin territory to the Song state; this was intercepted by the Xia, and Ren Dejing and his faction were executed. Renzong promoted Confucian education and expanded the National Academy his father had founded.
After Huanzong (r. 1194-1206) the Xia had four rulers before they succumbed to the Mongols in 1227. The Mongols first raided Xia in 1205, and four years later they surrounded the capital. In 1211 Li Zunxu usurped the throne from his nephew and ruled as Shenzong until 1223. He made peace with the Mongols but refused to supply them with warriors in 1217. The Mongols surrounded the capital again. The Jurchens refused to help; so the Song and the Xia formed an alliance against the Jin. In 1220 the Jin asked for help against the Mongols; but this time Shenzong refused, and the Jin defeated the Xia. In 1221 the Mongols occupied Xia territory for two years. The unpopular Shenzong abdicated in 1223, and the next emperor allied with the Jurchens against the Mongols. In 1226 Genghis (Chinggis) Khan led the final siege against the Xia capital, but he died before the Mongols' victory. In 1227 the last Xia ruler surrendered and was butchered.
Like the Koreans and Manchus, the Jurchens used a Tungusic branch of the Altaic language. Wanyan Wugunai (1021-74) arose as the leader of the wild Jurchens, and his grandson was Wanyan Aguda (1068-1123). Aguda succeeded his older brother in 1114 and attacked the Liao border defenses the next year. In 1115 he founded the Jin dynasty, and with an army of 10,000 defeated the Liao army that was at least ten times as large but retreated. The fierce Jurchens captured the Liao's eastern capital in 1116, their main northern capital in 1120, and in 1122 the central, western, and southern capitals. Aguda was advised by the scholarly Yang Pu, who was a Bohai but had earned the highest jinshi degree. He was experienced in the Liao's dual administration that the Jurchens adopted. Aguda made a treaty with the Song to return the northern territory the Khitans had occupied since 938. However, the Song armies failed to take the southern capital as promised. The Jurchens turned over the city but only after looting it and deporting the residents.
Aguda's brother Wuqimai was an effective administrator and became Jin Taizong in 1123, imposing an alliance on the Xi Xia the next year. In 1126 the Jurchens took back the Liao southern capital and then invaded the Song, surrounding Kaifeng. Before fleeing, Emperor Huizong abdicated to his son, who became Emperor Qinzong. Aguda's son, Wanyan Zongwang, was commander of the Eastern Army and made a treaty with the Song. Qinzong surrendered, and Huizong was captured; both were sent into Manchuria to spend the rest of their lives in exile. From the Song treasury the Jin gained 150 million ounces of gold, 400 million ounces of silver, and millions of bolts of silk, plus weapons, manufactures, and artistic productions. Song emperor Gaozong (r. 1127-62) escaped by crossing the Yangzi and even going to sea for a while. The Jurchens ordered the Chinese men to shave the front of their heads and wear Jurchen clothing styles. The Jin tried to establish a puppet regime as the state of Qi until 1137 but then made the Huai River their southern boundary. Wuqimai abolished the council of the great chieftains in 1134. The Jurchens adopted the Chinese civil service examinations but had a dual system that enabled many Jurchens to pass in their own language. During the century-long Jin empire more than 16,000 jinshi degrees were awarded. Most chose the literature exam that emphasized poetry, and very few attempted the most difficult test on history, statecraft, and philosophy.
About three million people, half of them Jurchens, migrated south into northern China over two decades, and this minority governed about thirty million Chinese. The Jurchens were given land grants and organized society into meng'an (one thousand households) and mouke (one hundred households). Many married Chinese, although the ban on Jurchen nobles marrying Chinese was not lifted until 1191. After Wuqimai died in 1135, the next three Jin emperors were grandsons of Aguda by three different princes. Young Jin Xizong (r. 1135-49) studied the classics and wrote Chinese poetry. He adopted Chinese cultural traditions, but the Jurchen nobles had the top positions. In the winter of 1142 the Jin dynasty made a treaty with the Song that gave them annual tribute and diplomatic respect.
Jin Xizong became an alcoholic and executed many Chinese officials for criticizing him. He also had Jurchen leaders who opposed him murdered, even those in his own Wanyan clan. In 1149 he was murdered by a cabal of relatives and nobles, who made his cousin Wanyan Liang the next Jin emperor. He was also violent, and historians refused to give him a posthumous name as an emperor but only referred to him as Prince Hailing. In 1153 he moved the Jin capital to the site of the old Liao southern capital, which is now Beijing, and four years later he had the old capital razed, including the nobles' residences. He lavishly reconstructed the Song capital of Bian (Kaifeng) as the Jin southern capital. Hailing also tried to suppress dissent by killing Jurchen nobles, executing 155 princes. He spent two years preparing for a war against the southern Song. His building and military expenses strained the resources, and in 1161 Khitans revolted in Manchuria. Jurchen nobles rebelled in southern Manchuria and were led by Wanyan Yong, who was proclaimed emperor in October, two months before the generals assassinated Hailing in his military camp after his defeat by the Song. His son and heir was also killed in the capital, and Wanyan Yong became Emperor Shizong.
Jin Shizong (r. 1162-89) attempted to revive the fading Jurchen traditions. The Khitan uprising was not suppressed until 1164; their horses were confiscated so that the rebels had to take up farming. Other Khitan and Xia cavalry units had been incorporated into the Jin army. In the early 1180s Shizong instituted a restructuring of 200 meng'an units to remove tax abuses and help Jurchens. Communal farming was encouraged. The Jin empire prospered and had a large surplus of grain in reserve. Shizong's grandson, Emperor Zhangzong (r. 1189-1208) venerated Jurchen values, but he also immersed himself in Chinese culture and married a Chinese woman. The Taihe Code of law was promulgated in 1201 and was based mostly on the Tang Code. Near the end of his reign the Song Chinese tried to invade, but the Jin forces effectively repulsed them. In the peace agreement the Song had to pay higher annual indemnities and behead Han Tuozhou, the leader of their war party.

Genghis Khan first led the Mongols into Xi Xia territory in 1205 and ravaged them four years later. In 1211 about 50,000 Mongols on horses invaded the Jin empire and began absorbing Khitan and Jurchen rebels. The Jin army had a half million men with 150,000 cavalry but abandoned the western capital. The next year the Mongols went north and looted the Jin eastern capital, and in 1213 they besieged the central capital. The next year the Jin made a humiliating treaty but retained the capital. That summer Emperor Jin Xuanzong (r. 1213-24) abandoned the central capital and moved the government to the southern capital. In 1216 a war faction persuaded Xuanzong to attack the Song, but in 1219 they were defeated at the same place by the Yangzi River, where Prince Hailing had been defeated in 1161. Emperor Jin Aizong (r. 1224-34) won a succession struggle against his brother and then quickly ended the war and went back to the capital. He made peace with the Tanguts, who had been allied with the Mongols.Genghis Khan died in 1227 while his armies were conquering the Xia. His son Ogodei invaded the Jin empire in 1232. The Jurchens tried to resist; but when the southern capital was attacked, Aizong fled south. The Mongols looted the capital in 1233, and the next year Aizong committed suicide to avoid being captured, ending the Jin dynasty.