The Niu–Li factional strife () was an ongoing contention at the court of the mid-to late Tang dynasty. It is largely viewed to have started during the reign of Emperor Muzong, circa 821, but having its seeds in the events of his father Emperor Xianzong—between two court factions later to be referred to by Chinese historians as the Niu Faction (牛黨), named after Niu Sengru, which was largely viewed as a faction of officials from humble origins and who passed the imperial examinations to get into government; and the Li Faction (李黨), named after Li Deyu, which was largely viewed as a faction of officials from aristocratic origins. The two factions struggled for decades at court, during the reigns of Emperor Muzong and his sons Emperor Jingzong, Emperor Wenzong, and Emperor Wuzong. The struggles are viewed as having ended at the start of the reign of Emperor Wuzong's successor and Emperor Muzong's younger brother Emperor Xuānzong, in 846. Emperor Xuanzong despised Li Deyu and systematically demoted officials related to Li Deyu, leading to the complete defeat of the Li Faction.
Background.
Traditionally, the seeds of the Niu–Li factional strife were seen to have been sown in 808, when Emperor Xianzong held a special imperial examination for the examinees to give honest criticism of government. The officials in charge of the examination, Wei Guanzhi and Yang Yuling (楊於陵), selected three examinees who gave blunt criticism—Niu Sengru, Huangfu Shi (皇甫湜), and Li Zongmin—for top marks. However, Chancellor Li Jifu was stung by the criticism they provided and viewed it as a personal attack against him. Li Jifu tearfully complained to Emperor Xianzong that the reviewers of the scores that Wei and Yang gave the imperial scholars - Pei Ji and Wang Ya — had conflicts of interest, as Huangfu was Wang's nephew. As a result of his accusations, Pei, Wang, Yang, and Wei were each demoted, with Wei initially demoted to be the prefect of Guo Prefecture (果州, in modern Nanchong, Sichuan), and then further moved to be the prefect of Ba Prefecture (巴州, in modern Bazhong, Sichuan). Niu, Huangfu, and Li Zongmin were not exiled, but were said in the "Zizhi Tongjian" to be effectively stalled in their careers, forcing them to find governmental positions themselves under regional governors. Despite this, Li Jifu's son Li Deyu viewed the insult on his father to be too great to bear, and thereafter an enmity developed between Li Deyu and those he viewed as having criticized his father unfairly.
During Emperor Muzong's reign.
After Emperor Xianzong's death in 820, Emperor Xianzong's son Emperor Muzong became emperor. Subsequently, the imperial examinations of 821 became, according to the Song dynasty historian Sima Guang, the triggering event for what became the Niu–Li factional strife.
As of 821, Li Deyu was serving as an imperial scholar (翰林學士, "Hanlin Xueshi"), and both he and fellow imperial scholar Yuan Zhen were resentful of Li Zongmin, who had become a "Zhongshu Sheren" (中書舍人)—a mid-level official at the legislative bureau of government (中書省, "Zhongshu Sheng"). Meanwhile, Li Zongmin's junior colleague at the legislative bureau, Yang Rushi (楊汝士), and the deputy minister of rites (禮部侍郎, "Libu Shilang") Qian Hui (錢徽), were in charge of overseeing the imperial examinations. The military governor ("Jiedushi") Duan Wenchang (a former chancellor) and the imperial scholar Li Shen both made secret pleas to Qian for certain examinees. However, when the results were announced, the examinees that Duan and Li Shen recommended were not given passing results, while among those passing the examinations were Zheng Lang, the brother of the examination bureau (門下省, "Menxia Sheng") official Zheng Tan; Pei Zhuan (裴譔) the son of the military governor Pei Du (also a former chancellor); Li Zongmin's son-in-law Su Chao (蘇巢); and Yang Rushi's brother Yang Yinshi (楊殷士). This caused a popular uproar, and Duan submitted a report accusing Yang Rushi and Qian of being unfair. When Emperor Muzong requested opinions from the imperial scholars, Li Deyu, Yuan, and Li Shen all agreed with Duan's opinion. Emperor Muzong thus ordered Li Zongmin's colleague Wang Qi (王起) to conduct a re-examination, while demoting Qian, Li Zongmin, and Yang Rushi to be prefectural prefects and deposing 10 of the examinees selected by Qian and Yang Rushi.
Meanwhile, by 823, Niu Sengru was serving as the deputy minister of census (戶部侍郎, "Hubu Shilang"), and was much respected by Emperor Muzong. After the death of the military governor-turned-chancellor Han Hong, Emperor Muzong discovered that virtually all the officials in the imperial administration had received bribes from Han, who wanted to ingratiate them, but that Niu had refused the bribe. Emperor Muzong, impressed by Niu, named him chancellor in 823. At that time, Li Deyu, who had become the governor (觀察使, "Guanchashi") of Zhexi Circuit (浙西, headquartered in modern Zhenjiang, Jiangsu), was considered a potential chancellor candidate as well, and as he was passed over in this selection and would eventually not be promoted for a stretch of eight years. He came to believe that it was the chancellor Li Fengji (who was later considered a Niu-party leader as well) who recommended Niu for chancellorship in order to reject him. He thus resented Niu and Li Fengji even more.
Meanwhile, Li Shen, still an imperial scholar at this point, was also respected by Emperor Muzong, and he often criticized both Li Fengji and the powerful eunuch Wang Shoucheng, with whom Li Fengji had a good relationship. Li Fengji, in order to alienate Emperor Muzong from Li Shen, intentionally recommended Li Shen as deputy chief imperial censor (御史中丞, "Yushi Zhongcheng") in order to create a conflict between Li Shen and Han Yu, the mayor of the capital municipality Jingzhao Municipality (京兆, i.e., the Chang'an region)—over the matter of whether Han, as the mayor, was required by tradition to pay respect to the imperial censors. As Han also carried the honorary title of chief imperial censor (御史大夫, "Yushi Daifu"), Li Fengji had ruled that he need not, but Li Shen nevertheless demanded it, causing him and Han to exchange harshly worded communiques to each other. With the dispute between Li Shen and Han flaring into the open, Li Fengji recommended demotions for both, and Han was made the deputy minister of defense (兵部侍郎, "Bingbu Shilang") while Li Shen was made the governor of Jiangxi Circuit (江西, headquartered in modern Nanchang, Jiangxi). Subsequently, Emperor Muzong realized that this conflict had been manufactured by Li Fengji, and kept Li Shen in the capital as the deputy minister of census.
During Emperor Jingzong's reign.
In 824, Emperor Muzong died and was succeeded by his son Emperor Jingzong. In the aftermath of Emperor Jingzong's ascension, Li Fengji had Wang Shoucheng informed Emperor Jingzong that it was because of Li Fengji's support that Emperor Muzong made him crown prince—and that Li Shen and the former chancellor Du Yuanying had both supported Emperor Muzong's younger brother Li Cong (李悰) the Prince of Shen. Believing Wang's assertions, Emperor Jingzong exiled Li Shen to be the military advisor to the prefect of Chao Prefecture (潮州, in modern Chaozhou, Guangdong), and demoted two imperial scholars that Li Shen had recommended, Pang Yan (龐嚴) and Jiang Fang (蔣防), to be prefects of two other distant prefectures. Li Fengji's associates subsequently often asked that Li Shen be put to death, and Emperor Jingzong initially agreed. After the junior imperial scholar Wei Chuhou submitted a petition in Li Shen's defense, Emperor Jingzong reviewed the palace archives and found that both Du and Li Shen (as well as Pei Du) had also supported him as crown prince, Emperor Jingzong destroyed all the reports accusing Li Shen of crimes, although he did not recall Li Shen to Chang'an.
Meanwhile, in 825, Niu Sengru was still serving as chancellor, but he was feeling powerless to stop what he saw as Emperor Jingzong's frivolousness and poor governance. He asked to be sent out of the capital. Emperor Jingzong made him the military governor of Wuchang Circuit (武昌, headquartered in modern Ezhou, Hubei). Also, that year after Emperor Jingzong declared a general pardon, Li Fengji submitted a proposed edict announcing the general pardon that would permit those exiled officials who had "previously" received a movement toward Chang'an be given another one, but not stating anything with regard to those exiled officials who had "never" received a previous movement toward Chang'an. Wei pointed out that this wording was intended by Li Fengji to prevent Li Shen's movement toward Chang'an. At Wei's suggestion, the edict was revised, allowing Li Shen to be moved to Jiang Prefecture (江州, in modern Jiujiang, Jiangxi) to serve as its secretary general.
In 826, Emperor Jingzong summoned Pei (viewed by some later historians as a Li Party leader) back to the capital and made him chancellor again. Trying to prevent Pei from gaining Emperor Jingzong's trust, Li Fengji's associates spread rumors that Pei was prophesied to be emperor, but Emperor Jingzong was not moved by these rumors.
During Emperor Wenzong's reign.
Before the Ganlu Incident.
In 826, Emperor Jingzong was assassinated by his polo players, who had resented him for his impulsively harsh treatment of them. After a faction of eunuchs had tried to make his uncle Li Wu the Prince of Jiāng emperor, another faction of eunuchs, led by Wang Shoucheng, defeated the faction supporting Li Wu and made Emperor Jingzong's younger brother Li Han the Prince of Jiàng (note different tone) emperor (as Emperor Wenzong).
Early in Emperor Wenzong's reign, Pei Du and Wei Chuhou were the leading chancellors. In 828, after Wei's death, Lu Sui succeeded Wei. In 829, Emperor Wenzong, under Pei's recommendation, recalled Li Deyu to Chang'an to serve as the deputy minister of defense, and Pei further recommended Li Deyu for chancellorship. However, Li Zongmin, then serving as deputy minister of civil service affairs (吏部侍郎, "Libu Shilang"), was said to prevail over Li Deyu because of support from the eunuchs, and Li Zongmin became chancellor, instead of Li Deyu. Subsequently, in 830, at Li Zongmin's recommendation, Niu was recalled from Wuchang and also made chancellor. It was said that Niu and Li Zongmin, working together, began to eject Li Deyu's partisans out of the imperial government. This included Pei, whom Li Zongmin had made the military governor of Shannan East Circuit (山南東道, headquartered in modern Xiangfan, Hubei), even though Li Zongmin had previously served on Pei's staff during Pei's first term as chancellor.
Li Deyu himself was sent to Xichuan Circuit (西川, headquartered in modern Chengdu, Sichuan), which had recently been devastated by a Nanzhao incursion, as its military governor. It was said that Li Deyu distinguished himself there by building up the defenses, rebuilding the economy, and training the soldiers. In 831, Xidamou (悉怛謀), the Tufan officer in charge of Wei Prefecture (維州, in modern Ngawa Tibetan and Qiang Autonomous Prefecture, Sichuan), surrendered Wei Prefecture, which Tufan had captured from Tang decades earlier, to him. Li Deyu advocated accepting the surrender and using Wei Prefecture as a launch pad for a major campaign against Tufan. Niu opposed, arguing that this was a violation of the peace treaty between Tang and Tufan and that, should a war start, Tufan forces could reach Chang'an easily. Emperor Wenzong accepted his argument and ordered that Li Deyu return Wei Prefecture, as well as Xidamou and his soldiers, to Tufan. Tufan had Xidamou and his soldiers massacred. The massacre brought much popular sentiment against Niu, and was commonly viewed at the time to be the result of the conflict between Niu/Li Zongmin and Li Deyu. With Emperor Wenzong regretting the decision, Niu repeatedly offered to resign. Emperor Wenzong was constantly asking the chancellors when true peace would come to the realm. Niu saw true peace as impossible to achieve within a short time and viewed Emperor Wenzong as overly eager. Around the new year 833, Emperor Wenzong made Niu the military governor of Huainan Circuit (淮南, headquartered in modern Yangzhou, Jiangsu). (The Xidamou incident has been one of the most controversial incidents in the study of Tang history, with various historians taking different views on the issue of whether Niu had a partisan motive in opposing Li Deyu's proposal to accept Xidamou's surrender and to further attack Tufan, and whether, ultimately, Niu or Li Deyu was correct.)
Li Deyu was recalled to Chang'an to serve as the minister of defense (兵部尚書, "Bingbu Shangshu"), and it was commonly expected that he would next become chancellor, despite