Li Yuanji

He was the fourth and final son of Li Yuan the Duke of Tang, a hereditary noble, and Li Yuan's wife Duchess Dou, who was herself the daughter of Dou Yi (竇毅) the Duke of Shenwu and Northern Zhou's Princess Xiangyang.

In 616, with agrarian rebellions beginning to engulf northern China and frequent Eastern Tujue incursions across the border, Emperor Yang of Sui commissioned Li Yuan to be the commander of the forces at Taiyuan, guarding it against both agrarian rebels and Eastern Tujue.

In spring 618, Emperor Yang, then at Jiangdu (江都, in modern Yangzhou, Jiangsu), was killed in a coup led by the general Yuwen Huaji.

When the news arrived at Chang'an, Li Yuan had Yang You yield the throne to him, establishing the Tang dynasty as its Emperor Gaozu.

His wet nurse Chen Shanyi (陳善意) tried to get him to change his ways, but he had his guards batter her to death.

Less than a month later, however, with the people of Taiyuan petitioning to have Li Yuanji kept in charge, Emperor Gaozu restored him.

(The traditional historians allege that Li Yuanji pressured the people into petitioning Emperor Gaozu.)

In fall 619, Li Yuanji fled with his wife and concubines back to Chang'an, and Liu captured Taiyuan, moving his capital from Mayi (馬邑, in modern Shuozhou, Shanxi) there.

When subsequently another rival ruler, Dou Jiande the Prince of Xia, came to Wang's aid, Li Shimin left Li Yuanji at Luoyang to continue the siege and to watch Wang, while he himself advanced to Hulao Pass to engage Dou.

Li Shimin defeated and captured Dou at the Battle of Hulao, and Wang, in fear, surrendered.

Meanwhile, however, Liu returned from Eastern Tujue and again occupied Dou's old territory, and Li Yuanji was not able to stop him.

Around the new year 623, with Liu's forced bogged down while attacking Tang's Wei Prefecture (魏州, in modern Handan, Hebei), Li Jiancheng and Li Yuanji engaged him at Guantao (館陶, in modern Handan as well), crushing him.

Liu fled north toward Eastern Tujue, but was ambushed and captured by his own official Zhuge Dewei (諸葛德威), who delivered him to Li Jiancheng.

When, subsequently, Li Jiancheng nevertheless requested the commandant at Qing Prefecture (慶州, in modern Qingyang, Gansu), Yang Wen'gan (楊文幹), to conscript troops, presumably to guard against Li Shimin, the officers Erzhu Huan (爾朱煥) and Qiao Gongshan (橋公山) informed Emperor Gaozu that Li Jiancheng was encouraging Yang to start a rebellion so that they could seize power together.

Li Jiancheng briefly flirted the idea of occupying Chang'an and not accepting the order, but eventually reported to Renzhi Palace to request forgiveness.

Later that year, Emperor Gaozu, troubled by repeated Eastern Tujue incursions, seriously considered burning Chang'an to the ground and moving the capital to Fancheng (樊城, in modern Xiangfan, Hubei), a suggestion that Li Jiancheng, Li Yuanji, and the chancellor Pei Ji agreed with.