Emperor Xizong of Tang

His reign saw his realm overrun by the great agrarian rebellions led by Wang Xianzhi and Huang Chao, and while both were eventually defeated, by the end of Emperor Xizong's reign, the Tang state had virtually disintegrated into pieces ruled by individual warlords, rather than the imperial government, and would never recover, falling eventually in 907.

Li Yan was born on June 8, 862,[1][2] at the eastern palace in the Tang imperial capital Chang'an, as the fifth son of then-reigning Emperor Yizong.

The eunuch commanders of the imperial Shence Armies, Liu Xingshen (劉行深) and Han Wenyue (韓文約), despite the fact that Li Yan was one of the younger sons of Emperor Yizong, supported him as the successor.

Meanwhile, Tian Lingzi became very influential, and was described as the actual decision-maker for most of the important decisions of state, as Emperor Xizong was young and trusting of him.

[6] However, Wang Xianzhi again made a peace overture in 877, sending his deputy Shang Junzhang (尚君長) to meet the eunuch general Yang Fuguang to negotiate a surrender.

Huang continued the roving campaign, and marched south, capturing and for some time holding Guang Prefecture (廣州, in modern Guangzhou, Guangdong) as his headquarters.

[7] By winter 879, Huang Chao, with his soldiers stricken by tropical/subtropical illnesses that they were not accustomed to, decided to change strategy and head north.

Gao's spirit was crushed by Zhang's death, and he did not try to stop Huang's subsequent advance north, across the Yangtze River into the heart of the Tang realm.

However, Huang defeated Cao, and after a mutiny at nearby Zhongwu Circuit caused the death of the military governor of Zhongwu, Xue Neng (薛能), Qi Kerang, the Tang general in command of the Yin River defense, abandoned the defensive position, causing Huang's path toward the Tang eastern capital Luoyang to become wide open.

[7] In light of his obstacle being removed, Huang headed straight for Luoyang; on the way, he stopped pillaging other than to force young men into his army and adding to its numbers.

[8] Emperor Xizong and Tian Lingzi conscripted a new army and put Zhang Chengfan (張承範) in charge of it, having him rendezvous with Qi at Tong Pass to defend against Huang's advance toward Chang'an.

[10][11][12][13][14] Meanwhile, Yang Fuguang enlisted Li Keyong, who had previously fled to the Dada tribes, to return to Tang realm to help battle Qi, offering to pardon him.

Huang's forces then were continued to be defeated by Tang generals Li Keyong, Zhu Quanzhong, and Shi Pu, eventually falling apart.

[11] Emperor Xizong did not return to Chang'an, immediately, apparently fearing Qin Zongquan—formerly a Tang military governor of Fengguo Circuit (奉國, headquartered in modern Zhumadian, Henan) but who had turned against Tang and was pillaging the modern Henan region with his power base centered at Fengguo's capital Cai Prefecture.

Qin, indeed, would subsequently declare himself emperor and try to expand the extent of his control, causing him to battle with Zhu and other Tang generals.

[11] Soon after Emperor Xizong's return to Chang'an, however, a serious dispute developed between Tian Lingzi, who was still largely in control of the imperial court, and Wang Chongrong, then the military governor of Huguo Circuit (護國, headquartered in modern Yuncheng, Shanxi).

Wang refused the transfer and, allied with Li Keyong, prepared for a confrontation with the imperial armies under Tian, as well as Tian's allies Zhu Mei the military governor of Jingnan Circuit (靜難, headquartered in modern Xianyang, Shaanxi) and Li Changfu the military governor of Fengxiang Circuit (鳳翔, headquartered in modern Baoji, Shanxi).

Faced with a situation he could not handle, Tian resigned his position as the commander of the Shence Armies and fled to Xichuan to join his brother Chen Jingxuan.