Emperor Gaozu of Tang

Emperor Gaozu of Tang (7 April 566 – 25 June 635), born Li Yuan, courtesy name Shude, was the founding emperor of the Tang dynasty of China, reigning from 618 to 626. Under the Sui dynasty, Li Yuan was the governor in the area of modern-day Shanxi, and was based in Taiyuan.

In 615, Li Yuan was assigned to garrison Longxi. He gained much experience by dealing with the Göktürks of the north and was able to pacify them. Li Yuan was also able to gather support from these successes and, with the disintegration of the Sui dynasty in July 617, Li Yuan – urged on by his second son Li Shimin (李世民, the eventual Emperor Taizong) – rose in rebellion. Using the title of "Great Chancellor" (大丞相), Li Yuan installed a puppet child emperor, Yang You, but eventually removed him altogether and established the Tang dynasty in 618 with himself as emperor. His son and successor Li Shimin honoured him as Gaozu ("high founder") after his death.

Emperor Gaozu's reign was concentrated on uniting the empire under the Tang. Aided by Li Shimin, whom he created the Prince of Qin, he defeated all the other contenders, including Li Gui, Dou Jiande, Wang Shichong, Xue Rengao and Liu Wuzhou. By 628, the Tang dynasty had succeeded in uniting all of China. On the home front, he recognized the early successes forged by Emperor Wen of Sui and strove to emulate most of Emperor Wen's policies, including the equal distribution of land amongst his people, and he also lowered taxes. He abandoned the harsh system of law established by Emperor Yang of Sui as well as reforming the judicial system. These acts of reform paved the way for the reign of Emperor Taizong, which ultimately pushed Tang to the height of its power.

In 626, Li Shimin, in a dispute with his brothers Li Jiancheng, the Crown Prince, and Li Yuanji, the Prince of Qi, ambushed Li Jiancheng and Li Yuanji at Xuanwu Gate, killing them. Fearful of what Li Shimin might do next, Emperor Gaozu passed the throne to him and became Taishang Huang (retired emperor). He died on 25 June 635.

Early life and career
According to the official genealogy of the Tang ruling house, Li Yuan's seventh-generation ancestor was Li Gao, the Han Chinese founder of the Dunhuang-based Sixteen Kingdoms state of Western Liang. After Western Liang's destruction by the Northern Liang, Li Gao's grandson Li Zhong'Er (李重耳) served as a Northern Wei official, but for several generations after that, Li Yuan's ancestors had only minor military titles. Li Yuan's paternal grandfather Li Hu (李虎) served as a major general under Western Wei's paramount general Yuwen Tai, and was created the Duke of Longxi and given the Xianbei surname Daye (大野). Li Hu died before Yuwen Tai's son Emperor Xiaomin of Northern Zhou founded Northern Zhou, but was posthumously created the Duke of Tang after Northern Zhou's founding. His son and Li Yuan's father Li Bing (李昞), of Han ethnicity, inherited the title of the Duke of Tang and married one of the Dugu sisters and daughter of the prominent Xianbei general Dugu Xin. Li Bing died in 572, and Li Yuan inherited the title of Duke of Tang, a title he continued to hold after the Northern Zhou throne was seized by Emperor Wen of Sui (Yang Jian) in 581, establishing the Sui dynasty, as Emperor Wen's wife, Empress Dugu, was an aunt of his.

At some point, he married Lady Dou, a daughter of Dou Yi (竇毅) the Duke of Shenwu and Northern Zhou's Princess Xiangyang (Yuwen Tai's daughter) as his wife and duchess.

During Emperor Wen's reign (581–604), Li Yuan served three terms as a provincial governor. Early in the reign of Emperor Wen's son Emperor Yang, Li Yuan served as commandery governor (as Emperor Yang converted provinces into commanderies), but was later recalled to serve as a junior minister within Emperor Yang's administration. When Emperor Yang carried out his second campaign against Goguryeo in 613, Li Yuan was in charge of part of the logistics operation. When the general Yang Xuangan rebelled near the eastern capital Luoyang, Emperor Yang commissioned Li Yuan as a general and made him be in charge of the operations west of the Tong Pass, although Yang Xuangan's rebellion eventually did not involve that region. Li Yuan took the opportunity to recruit talented people to his staff. Later that year, when Emperor Yang summoned him to his presence, he declined, citing ill health—an excuse that Emperor Yang did not believe, as he questioned Li Yuan's niece, Consort Wang (Emperor Yang's concubine), "Will he die?". In fear, Li Yuan took up drinking and receiving bribes to try to show Emperor Yang that he did not have great ambitions. In 615, Emperor Yang placed him in charge of the operations against agrarian rebels in the Hedong (河東) region (roughly modern Shanxi), but recalled him in 616. Later that year, Emperor Yang put him in charge of the key city of Taiyuan (太原, in modern Taiyuan, Shanxi).

Rebellion against Emperor Yang of Sui
Emperor Yang grew dissatisfied with Li Yuan and Wang Rengong (王仁恭), the governor of Mayi Commandery (馬邑, roughly modern Shuozhou, Shanxi), over their inability to stop incursions by the Eastern Turks (Tujue) and the growing strength of agrarian rebels—particularly the Turk-supported Liu Wuzhou, the Dingyang Khan, who soon rose against Wang and killed him and captured Emperor Yang's secondary palace near Taiyuan. Li Yuan also became fearful due to prophecies circulating throughout the empire that the next emperor would be named Li—and because Emperor Yang had killed another official, Li Hun (李渾) and his clan over his fears that Li Hun's nephew Li Min (李敏, the son-in-law of Emperor Yang's sister Yang Lihua, the Princess Leping) had imperial ambitions.

Traditional accounts, compiled during the reign of Li Yuan's second son by the Duchess Dou, Li Shimin (Emperor Taizong), emphasize the latter's initiative and major role in instigating his father's rebellion. According to these, Li Shimin was secretly planning rebellion against Sui rule with Pei Ji, the majordomo of Emperor Yang's secondary palace, and with Liu Wenjing, the magistrate of Jinyang County (晉陽, i.e., Taiyuan), but at first did not reveal their plans to Li Yuan. At Li Shimin's urging, Pei Ji, who had also earlier, against regulations, allowed Li Yuan to have sexual relations with some of late Emperor Wen's imperial concubines, persuaded Li Yuan that it was necessary for him to rebel. Modern researchers, however, have concluded that the initiative for the revolt came from Li Yuan himself.

Li Yuan began to gather forces from the region, claiming that they were necessary to defend against the Turks, which drew suspicions from his deputies Wang Wei (王威) and Gao Junya (高君雅). Li Yuan, afraid that Wang and Gao would act against him first, then used a Turkic attack as an excuse to falsely claim that Wang and Gao were working in concert with the Turkic khagan, Shibi Khan (Ashina Duojishi), and had them executed. He sent secret messengers to Hedong to recall his sons Li Jiancheng, Li Yuanji (both by Duchess Dou) and Li Zhiyun (李智雲, by his concubine Lady Wan), whom he had left there to watch over his household, and the capital Chang'an (modern Xi'an) to recall his daughter (the future Princess Pingyang) and her husband Chai Shao (柴紹). Li Jiancheng and Li Yuanji, leaving Li Zhiyun at Hedong, soon met with Chai, and they arrived together at Taiyuan. Li Yuan's daughter, believing it would be difficult for her to flee with Chai, chose to hide instead.

Once Li Jiancheng, Li Yuanji, and Chai arrived at Taiyuan, Li Yuan formally declared his rebellion, but maintained the guise of a Sui loyalist and declared that his intention was simply to install on the throne Emperor Yang's grandson Yang You, the Prince of Dai, who was then at Chang'an, and honor Emperor Yang as Taishang Huang (retired emperor). Li Yuan first secured his northern flank by contacting Shibi Khan, offering tribute, and received men and horses in exchange. He put Li Jiancheng and Li Shimin in charge of his army and, leaving Li Yuanji in charge at Taiyuan, advanced south. Meanwhile, the Sui officials at Hedong arrested Li Zhiyun and delivered him to Chang'an, where he was executed.

His daughter Pingyang sold her possessions to raise an army for him. She persuaded several other leaders to fight under her banner. They took several towns and her army swelled until she had 70,000 troops under her command.

Meanwhile, Li Yuan wrote another rebel leader, Li Mi the Duke of Wei, who was near Luoyang, trying to see if Li Mi would be willing to follow him, but Li Mi, believing in his own strength, had his secretary Zu Junyan (祖君彥) write Li Yuan for him in this way:

"Although I and you, my older brother, are of different branches, but we are both Lis. I know that I do not have sufficient strength, but by the love of the men on this earth, I have been made the leader. I hope that you will support and help me. Let us capture Ziying at Xianyang, and let us kill Xin of Shang at Muye; would it not be a great accomplishment?"

Li Yuan was dismayed but, not wanting to make another enemy, wrote back humbly:

"Although I am ordinary and foolish, but I have had the opportunity to, by my ancestors' largess, receive the opportunity to be an imperial messenger when leaving the capital and a guard leader in the capital. If the administration falls and I am unable to help it, even the most understanding wise man will rebuke me. Therefore, I have organized a righteous army and sought peace with the barbarians to the north [i.e., Tujue] to try to calm the earth and to protect Sui. However, for the people under the heavens, there must be someone to rule over them, and other than you, who can be that person? I am too old – over 50 – and that is not my intent, but I am happy to support you, my younger brother. I hope to be able to climb onto the scale of a dragon and hold onto the wing of a phoenix, and I hope that you, my younger brother, will soon, in accordance with the prophecy, pacify all who are on this earth. You are the leader among the Li, and I hope that you will be gracious and accept me, and to give me again the domain of Tang; that will be enough glory for me. I do not have the heart to hear such commands as killing Xin of Shang at Muye, nor do I dare to listen to the order of capturing Ziying at Xianyang. Also, the Fen and Jin region [i.e., modern Shanxi] requires pacification right now, and I am not yet able to arrange a time for the meeting at Mengjin [(盟津, in modern Zhengzhou, Henan, where King Wu of Zhou met his supporters before attacking Shang's King Zhou)]."

Li Mi was pleased with Li Yuan's response, believing that Li Yuan was willing to support him, and from that point on, Li Mi and Li Yuan often exchanged messengers. Li Yuan's campaign against Chang'an thus went without opposition from Li Mi. Meanwhile, however, when Li Yuan arrived near Hedong, his army was bogged down by the weather, and with food running out, there were rumors that Eastern Tujue and Liu Wuzhou would attack Taiyuan. Li Yuan initially ordered retreat, but at the earnest opposition by Li Jiancheng and Li Shimin, continued to advance. After defeating Sui forces at Huoyi (霍邑, also in modern Yuncheng), he decided to leave a small contingent to watch over Hedong while advancing across the Yellow River into Guanzhong (i.e., the Chang'an region). Once he did, he headed for Chang'an himself, while sending Li Jiancheng to capture the territory around the Tong Pass region to prevent Sui forces at Luoyang from reinforcing Chang'an and Li Shimin north of the Wei River to capture territory there. Meanwhile, his daughter had also risen in rebellion in support of him, and she was able to gather a sizable army and capture some cities. She joined forces with Li Shimin and her husband Chai Shao. Soon, Li Yuan reconsolidated his forces and put Chang'an under siege. In winter 617, he captured Chang'an and declared Yang You emperor (as Emperor Gong). He had himself made regent (with the title of grand chancellor) and created the Prince of Tang. (Meanwhile, most of Sui territory did not recognize Yang You as emperor and continued to recognize Emperor Yang as emperor and not as retired emperor.) He sent his nephew Li Xiaogong south, and Li Xiaogong was able to persuade the Sui cities in modern southern Shaanxi, Sichuan, and Chongqing to submit.

Establishment of Tang and gradual unification
In spring 618, Emperor Yang was killed at Jiangdu (江都, in modern Yangzhou, Jiangsu) in a coup led by the general Yuwen Huaji. When the news reached Chang'an, Li Yuan had Yang You yield the throne to him, becoming Emperor Gaozu of the Tang dynasty. He restored much of the institutions of Sui's first ruler, Emperor Wen, reversing a number of changes that Emperor Yang made. He created Yang You the Duke of Xi, Li Jiancheng, his oldest son, was named crown prince, while Li Shimin was made the Prince of Qin and Li Yuanji the Prince of Qi. Meanwhile, the Sui officials at Luoyang declared another grandson of Emperor Yang, Yang You's brother Yang Tong, the Prince of Yue, as emperor, and refused to recognize the regime change in Chang'an.

Emperor Gaozu's rule immediately faced a major challenge from Xue Ju, an agrarian leader who had declared himself the Emperor of Qin. During the fall of 618, Xue took advantage of Li Shimin's illness to defeat an army commanded by Li Shimin and Liu Wenjing at Qianshui Plain (in modern Xianyang, Shanxi) and approach Chang'an. In response, Gaozu tried to enter an alliance with Li Gui, the Prince of Liang, between whose domain and the Tang Xue's Qin state was located, writing Li Gui and referring to him as cousin. Li Gui briefly submitted to Gaozu. Meanwhile, before he could attack Chang'an, Xue Ju died of illness and was succeeded by his son Xue Rengao, who was a capable commander but who had alienated his generals because of his cruelty. Li Shimin was soon able to attack Xue Rengao at Gaozhi (高墌, in modern Xianyang as well), and force Xue Rengao to surrender.

Meanwhile, Li Mi, having been defeated earlier in the year in a surprise attack (at the Battle of Yanshi) by the Sui general Wang Shichong, fled to Tang territory and submitted to Gaozu. Li Mi's general Xu Shiji, who controlled a major part of Li Mi's former territory, also submitted, and Emperor Gaozu, impressed with Xu's faithfulness to Li Mi, bestowed the imperial surname of Li on Xu. Gaozu created Li Mi the Duke of Xing, but only made him the Minister of Feasts, a post that Li Mi viewed as below his stature. Around New Year 619, Li Mi requested Emperor Gaozu's permission to head east to persuade some of his former subordinates to submit to Tang, but once he left Chang'an, planned to restore his independence. He was ambushed and killed by the Tang general Sheng Yanshi (盛彥師).

In spring 619, Wang Shichong at Luoyang had Yang Tong yield the throne to him, ending the Sui dynasty and establishing a new state of Zheng.

Around the same time, Li Gui, while stating that he wished to be a Tang subject, refused the Tang creation of Prince of Liang, instead declaring himself the Emperor of Tang. In summer 619, Li Gui's official An Xinggui (安興貴), formerly a Tang official, rebelled against Li Gui and captured him, submitting to Tang. Gaozu executed Li Gui and incorporated his domain into Tang. Also around the same time, the rebel leader Du Fuwei, who controlled the modern southern Anhui, submitted to Tang, and Gaozu also bestowed the imperial surname of Li on him, creating him the Prince of Wu. Similarly, Luo Yi, who controlled the modern Beijing region, submitted, was bestowed the imperial surname of Li, and was created the Prince of Yan.

Meanwhile, Tang was facing another serious threat—Liu Wuzhou, now determined to march south against Tang. Emperor Gaozu sent Pei Ji against Liu's advancing army, but Pei was defeated by Liu, who then put Taiyuan under siege. Li Yuanji fled back to Chang'an, and much of modern Shanxi was seized by Liu. Emperor Gaozu then sent Li Shimin against Liu, and by summer 620, Li Shimin had defeated Liu, forcing him to flee to the Eastern Turks. Liu's territory was incorporated into Tang. Around the same time, however, Dou Jiande the Prince of Xia made a major offensive against the cities that had submitted to Tang in modern Hebei and Henan, north of the Yellow River, seizing nearly all of them and taking Emperor Gaozu's cousin Li Shentong (李神通) the Prince of Huai'an, Emperor Gaozu's sister the Princess Tong'an, and Li Shiji's father Li Gai (李蓋) captive. With Li Gai in Dou's custody, Li Shiji surrendered to Dou as well. In 620, Li Shiji, in association with another Tang general who surrendered to Dou, Li Shanghu (李商胡), plotted to ambush Dou, but the plot was discovered; Li Shanghu was killed, and Li Shiji fled back to Tang.

In 620, Li Fuwei captured much of the territory of another agrarian ruler, Li Zitong, the Emperor of Wu, in the lower Yangtze River region, in the name of the Tang dynasty. Li Zitong, in turn, defeated and took over the territory of Shen Faxing the Prince of Liang, roughly modern Zhejiang.

After Li Shimin defeated Liu, he started a campaign against Wang's Zheng state in fall 620. He initially could not decisively defeat Zheng, but by spring 621 had put the Zheng capital Luoyang under a tight siege, although he was not able to capture it. Wang sought aid from Dou. The latter agreed, concerned that a Tang victory over Zheng would also mean his own demise, but at the same time was eager to exploit the weakness of the Zheng and claim its domains for himself. Emperor Gaozu was initially fearful that Dou and Wang would be able to sandwich Li Shimin's forces between them and ordered Li Shimin to retreat, but upon Li Shimin's petition changed his mind and permitted Li Shimin to remain in the Luoyang region. Li Shimin, leaving Li Yuanji in charge of the siege of Luoyang, advanced and took up position at Hulao Pass. In summer 621, the Tang and Xia forces engaged at Hulao, and Li Shimin defeated Dou, capturing him. Despairing, Wang also surrendered, and most of the Zheng territory was seized by the Tang. Xia territory was also seized by Tang, but after Emperor Gaozu executed Dou, Dou's general Liu Heita rose against the Tang and seized most of the former Xia territory, while Xu Yuanlang, a rebel leader who had previously submitted to Zheng, also rose in revolt, occupying the modern Shandong region.

Also in 621, Li Xiaogong defeated Xiao Xian the Emperor of Liang, who had controlled the modern Hubei, Hunan, and Guangxi region, forcing Xiao Xian to surrender. On another front, Li Fuwei's lieutenant Fu Gongshi defeated Li Zitong, forcing him to surrender as well. Liang and Wu territory were seized by Tang.

Meanwhile, while not as noted as Emperor Gao of Han's killing of Han Xin and Peng Yue, historians have nevertheless noted that some contributors to Emperor Gaozu's establishment of Tang were wrongly killed by him or killed based on fairly little evidence of wrongdoing:
 * Liu Wenjing, in 619, on accusation that he engaged sorcerers.
 * Emperor Gaozu's cousin Dugu Huai'en (獨孤懷恩), in 620, on accusation of treason.
 * Li Zhongwen (李仲文) the Duke of Zhenxiang, in 620, on accusation of collaboration with Eastern Tujue.
 * Liu Shirang (劉世讓) the Duke of Yingyang, in 623, on accusation of collaboration with Eastern Tujue.

Struggle between sons and the Xuanwu Gate Incident
In spring 622, Li Shimin defeated Liu Heita, forcing him to flee to the Eastern Turks, but Liu Heita soon returned with Turkic reinforcements and killed Emperor Gaozu's nephew Li Daoxuan (李道玄) the Prince of Huaiyang in battle, again seizing former Xia territory, although by this point Li Shimin and Li Yuanji had also defeated Xu Yuanlang and reduced his territory to a few cities.

Meanwhile, an intense rivalry had developed between Li Jiancheng and Li Shimin, as while Li Jiancheng had some contributions toward Tang's reunification of China, Li Shimin had been the one defeating and capturing the major rivals Xue Rengao, Liu Wuzhou, Dou Jiande, and Wang Shichong, causing him to possess the greater reputation among the army. Li Yuanji, who was also often relied on by Emperor Gaozu as a general, supported Li Jiancheng in this rivalry, and often pushed Li Jiancheng toward a more hardline position against Li Shimin, wanting to be crown prince when Li Jiancheng would become emperor. Li Jiancheng and Li Yuanji had better relations with Emperor Gaozu's favored young concubines than Li Shimin did (as their mother Duchess Dou had died before Tang's establishment), and those concubines helped rehabilitate Li Jiancheng's standing before Emperor Gaozu, causing him to no longer consider making Li Shimin crown prince instead, as he considered at one point.

By winter 622, Liu Heita posed the only remaining major threat against Tang rule. At the suggestion of his staff members Wang Gui and Wei Zheng, who argued that Li Jiancheng needed some victories himself to establish his reputation, Li Jiancheng volunteered to command the army against Liu Heita. Emperor Gaozu thus sent Li Jiancheng, assisted by Li Yuanji. 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 the Eastern Turks, but was ambushed and captured by his own official Zhuge Dewei (諸葛德威), who delivered him to Li Jiancheng. Li Jiancheng executed Liu. Around the same time, Xu was killed in flight. Meanwhile, Lin Shihong the Emperor of Chu, who had one point controlled modern Jiangxi and Guangdong, had died, and his followers scattered. China was by this point completely unified by Tang except for the domain of Liang Shidu the Emperor of Liang, who controlled modern northern Shaanxi and western Inner Mongolia, although, with Li Fuwei at Chang'an, Fu Gongshi rebelled in 623 and declared himself the Emperor of Song. Fu's rebellion, however, was quelled by Li Xiaogong in 624.

Meanwhile, the rivalry between Li Jiancheng and Li Shimin intensified. In 624, Li Jiancheng requisitioned a number of soldiers from the general Li Yi the Prince of Yan, to supplement his guard corps, against Emperor Gaozu's regulations. When this was revealed to Emperor Gaozu, Emperor Gaozu rebuked Li Jiancheng and exiled his guard commander Keda Zhi (可達志). 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. Emperor Gaozu, then at Renzhi Palace (仁智宮, in modern Tongchuan, Shaanxi), was incensed, and summoned Li Jiancheng, then at Chang'an, to Renzhi Palace. Li Jiancheng briefly flirted the idea of occupying Chang'an and not accepting the order, but eventually reported to Renzhi Palace to request forgiveness. Emperor Gaozu put him under arrest. When Yang heard this, Yang rebelled, and Emperor Gaozu, after promising Li Shimin that he would be made crown prince, sent Li Shimin to attack Yang. (Under Emperor Gaozu's promise, Li Jiancheng would be removed as crown prince and created the Prince of Shu instead. He would then send Li Jiancheng to the modern Sichuan region.) Once Li Shimin left, however, Li Yuanji, Emperor Gaozu's concubines, and the chancellor Feng Deyi, all spoke on Li Jiancheng's behalf, and Emperor Gaozu changed his mind, released Li Jiancheng, and allowed him to return to Chang'an and remain as crown prince. Instead, Emperor Gaozu only blamed the discord between his sons on Li Jiancheng's staff members Wang Gui and Wei Ting (韋挺), and Li Shimin's staff member Du Yan, exiling them. Yang was subsequently assassinated by his own subordinates.

Another problem that Emperor Gaozu faced was constant Eastern Turkic incursions. Emperor Gaozu 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. Li Shimin opposed, however, and the plan was not carried out. Meanwhile, Li Shimin himself was sending his confidants to Luoyang to build up personal control of the army there. After an incident in which Li Shimin suffered a severe case of food poisoning after feasting at Li Jiancheng's palace—an event that both Emperor Gaozu and Li Shimin apparently interpreted as an assassination attempt—Emperor Gaozu considered sending Li Shimin to guard Luoyang to prevent further conflict, but Li Jiancheng and Li Yuanji, after consulting each other, believed that this would only give Li Shimin an opportunity to build up his personal power there, and therefore opposed it. Emperor Gaozu therefore did not carry out the plan.

By 626, Li Shimin was fearful that he would be killed by Li Jiancheng, and his staff members Fang Xuanling, Du Ruhui, and Zhangsun Wuji were repeatedly encouraging Li Shimin to attack Li Jiancheng and Li Yuanji first—while Wei Zheng was encouraging Li Jiancheng to attack Li Shimin first. Li Jiancheng persuaded Emperor Gaozu to remove Fang and Du, as well as Li Shimin's trusted guard officers Yuchi Gong and Cheng Zhijie (程知節), from Li Shimin's staff. Zhangsun, who remained on Li Shimin's staff, continued to try to persuade Li Shimin to attack first.

In summer 626, the Eastern Turkic khaganate was making another attack, and under Li Jiancheng's suggestion, Emperor Gaozu, instead of sending Li Shimin to resist the Turks as he first was inclined, decided to send Li Yuanji instead. Li Yuanji was given command of much of the army previously under Li Shimin's control, further troubling Li Shimin, who believed that with the army in Li Yuanji's hands, he would be unable to resist an attack. Li Shimin had Yuchi summon Fang and Du back to his mansion secretly, and then on one night submitted an accusation to Emperor Gaozu that Li Jiancheng and Li Yuanji were committing adultery with Emperor Gaozu's concubines. Emperor Gaozu, in response, issued summonses to Li Jiancheng and Li Yuanji for the next morning, convening the senior officials Pei Ji, Xiao Yu, and Chen Shuda to examine Li Shimin's accusations. As Li Jiancheng and Li Yuanji approached the central gate leading to Emperor Gaozu's palace, Xuanwu Gate (玄武門), Li Shimin carried out the ambush he had set. He personally fired an arrow that killed Li Jiancheng. Subsequently, Yuchi killed Li Yuanji. Li Shimin's forces entered the palace and, under the intimidation of Li Shimin's forces, Emperor Gaozu agreed to create Li Shimin crown prince. Meanwhile, Li Shimin accused the late Li Jiancheng and Li Yuanji of plotting treason, posthumously demoted them to commoners and had their sons all executed as well, with Emperor Gaozu unable to oppose the action. Two months later, Emperor Gaozu passed the throne to Li Shimin (as Emperor Taizong).

As retired emperor
Emperor Gaozu, as retired emperor, did not appear to try to exert much influence in the reign of his son Emperor Taizong, and not much was recorded about his activities. Indeed, Emperor Taizong, almost immediately, began reversing some of his policies, including his policies of creating many relatives to be imperial princes (which Emperor Taizong reversed later in 626, reducing the ranks of most of those princes to dukes) and Emperor Gaozu's gathering of many ladies in waiting (which Emperor Taizong reversed in 628, releasing about 3,000 ladies in waiting from service, although Emperor Taizong himself, later in his reign, appeared to have gathered as many if not more).

In 629, Emperor Gaozu moved from the main palace, Taiji Palace (太極殿) to the subsidiary Hongyi Palace (弘義宮), which was then renamed Da'an Palace (大安宮). Only then was Emperor Taizong able to move from the crown prince's palace to Taiji Palace.

In 630, when Emperor Gaozu, who had been submitting tribute to the Eastern Turks throughout his reign, heard that Emperor Taizong had sent the general Li Jing to defeat and capture the Turkic khagan Jiali Khan (Ashina Duobi), commented, "Gaozu of Han was trapped [at Baideng (白登, in modern Datong, Shanxi) in 200 BCE by Xiongnu forces] and could not avenge himself. Now my son can destroy Tujue. I have entrusted the empire to the right person, and what do I have to worry about?" He subsequently summoned a number of princes and princesses, along with high level officials, to celebrate the victory, playing the pipa himself at the celebration and having the guests dance to it.

As Chang'an was often hot during the summer, Emperor Taizong often invited Emperor Gaozu to go with him to Jiucheng Palace (九成宮, in modern Baoji, Shaanxi), to avoid the heat during the summer. However, as Sui's Emperor Wen had died there (which was named Renshou Palace (仁壽宮) during the Sui dynasty), Emperor Gaozu did not want to visit Jiucheng Palace. Rather, in 634, Emperor Taizong began to construct another summer palace, Daming Palace (大明宮), to serve as Emperor Gaozu's summer palace, but Emperor Gaozu fell ill before it was completed, and he never visited Daming Palace. He died in spring 635.

Era name

 * Wude (武德 wǔ dé) 618–626

Chancellors during reign

 * Li Shimin (618–626)
 * Pei Ji (618–626)
 * Liu Wenjing (618)
 * Xiao Yu (618–626)
 * Dou Wei (618)
 * Dou Kang (618)
 * Chen Shuda (618–626)
 * Yang Gongren (619–626)
 * Feng Deyi (620–626)
 * Pei Ju (624–625)
 * Yuwen Shiji (625–626)
 * Gao Shilian (626)
 * Fang Xuanling (626)

Family
Consorts and Issue:
 * Empress Taimu, of the Dou clan of Henan (太穆皇后 河南竇氏/河南窦氏; c. 569–613)
 * Li Jiancheng, Crown Prince Yin (隱皇太子 李建成/隐皇太子 李建成; 589–626), first son
 * Princess Zhao of Pingyang (平陽昭公主; d. 623), third daughter
 * Married Chai Shao, Duke of Qiao (谯国公柴绍，d. 638), and had issue (two sons)
 * Li Shimin, Emperor Taizong (太宗 李世民; 598–649), second son
 * Li Xuanba, Prince Weihuai (衛懷王 李玄霸/卫怀王 李玄; 599–614), third son
 * Li Yuanji, Prince Chaola (巢剌王 李元吉; 603–626), fourth son
 * Noble Consort, of the Wan clan (貴妃 萬氏/贵妃 万氏)
 * Li Zhiyun, Prince Chu'ai (楚哀王 李智雲/楚哀王 李智; 604–617), fifth son
 * Virtuous Consort, of the Yin clan (德妃 尹氏)
 * Li Yuanheng, Prince Fengdao (酆悼王 李元亨; 619–632), eighth son
 * First Imperial Concubine, of the Yuwen clan (昭儀 宇文氏/昭仪 宇文氏, d. 634)
 * Li Yuanjia, Prince Han (韓王 李元嘉/韩王; 620–688), 11th son
 * Li Lingkui, Prince Lu (魯王 李靈夔/鲁王 李零夔; 625–688), 19th son
 * Noble Imperial Concubine, of the Mo clan (貴嬪 莫氏/贵嫔 莫氏; 597–618), personal name Lifang (麗芳/丽芳)
 * Li Yuanjing, Prince Jing (荊王 李元景; 618–653), sixth son
 * Imperial Concubine, of the Sun clan (嬪 孫氏/嫔 孙氏)
 * Li Yuanchang, Prince Han (漢王 李元昌/汉王 李元昌; 619–643), seventh son
 * Imperial Concubine, of the Cui clan of Boling (嬪 博陵崔氏/嫔 博陵崔氏； d. 636), personal name Shanggui (商珪)
 * Li Yuanyu, Prince Dengkang (鄧康王 李元裕/邓康王 李元裕; 624–665), 17th son
 * Imperial Concubine, of the Yang clan of Hongnong (嬪 弘農楊氏/嫔; 602–657)
 * Li Yuanxiang, Prince Jiang'an (江安王 李元祥; 626–680), 20th son
 * Imperial Concubine, of the Yang clan (嬪 楊氏/嫔 杨氏)
 * Li Yuanming, Prince Shu (舒王 李元名; 624–689), 18th son
 * Fairness Lady, of the Zhang clan (婕妤 張氏/张氏)
 * Li Yuanfang, Prince Zhou (周王 李元方; 619–629), ninth son
 * Fairness Lady, of the Guo clan (婕妤 郭氏)
 * Li Yuanli, Prince Xukang (徐康王 李元禮/李元礼; 619–672), tenth son
 * Fairness Lady, of the Liu clan (婕妤 劉氏/刘氏)
 * Li Yuanqing, Prince Daoxiao (道孝王 李元慶/李元庆; 623–664), 16th son
 * Beauty, of the Zhang clan (美人 張氏/张氏)
 * Li Yuangui, Prince Huo (霍王 李元軌/李元轨; 622–688), 14th son
 * Beauty, the Yang clan (美人 楊氏/杨氏; d. 644)
 * Li Feng, Prince Guozhuang (虢莊王 李鳳/虢庄王 李凤; 622–675), 15th son
 * Talented Lady, of the Wang clan (才人 王氏; 596–662)
 * Li Yuanze, Prince Pengsi (彭思王 李元則/李元则; 620–651), 12th son
 * Talented Lady, of the Lu clan (才人 魯氏/鲁氏)
 * Li Yuanxiao, Prince Mizhen (密貞王 李元曉/密贞王 李元晓; 628–676), 21st son
 * Treasured Lady, of the Zhang clan (寶林 張氏/宝林 张氏; 589–645), personal name Chongze (寵則/宠则)
 * Li Yuanyi, Prince Zhenghui (鄭惠王 李元懿/郑惠王 李元懿; 621–673), 13th son
 * Treasured Lady, of the Liu clan (寶林 柳氏/宝林 柳氏)
 * Li Yuanying, Prince Teng (滕王 李元嬰/李元婴; 630–684), 22nd son
 * Unknown
 * Princess Changsha (長沙公主/长沙公主), first daughter
 * Married Feng Shaoshi of Changle (長樂 馮少師/长乐 风少师)
 * Princess Xiangyang (襄阳公主), 2nd daughter
 * Married Dou Dan of Henan, Duke Shen (河南 竇誕/窦诞; 580–648), the third son of Dou Kang, in 617, and had issue (two sons, one daughter)
 * Princess Gaomi (高密公主; d. 655), 4th daughter
 * Married Zhangsun Xiaozheng of Henan (河南 長孫孝政/长孙孝政), and had issue (one daughter)
 * Married Duan Lun, Prince Jinchang (段綸/段纶; d. 642), and had issue (one son, one daughter)
 * Princess Changguang (長廣公主/长广公主; d. 648), 5th daughter
 * Married Zhao Cijing of Tianshui, Duke Kaihua (天水 赵慈景; d. 618)
 * Married Yang Shidao of Hongnong, Duke Ande (弘農 楊師道/弘农 杨师道; d. 647) in 622, and had issue (one daughter)
 * Princess Fangling (房陵公主; 619–673), 6th daughter
 * Married Dou Fengjie of Henan, Duke Zan (河南 竇奉節/窦奉节) in 630, and had issue (one son, one daughter)
 * Married Helan Sengjia, Baron Tonghua (賀蘭僧伽/贺兰僧伽), and had issue (one son)
 * Princess Changle (常樂公主/长乐公主; d. 688), 7th daughter
 * Married Zhao Gui (趙瑰/赵瑰; d. 688)
 * Princess Jiujiang (九江公主), 8th daughter
 * Married Zhishi Sili, Duke An (執失思力/安国公 执失思力)
 * Princess Luling (廬陵公主/庐陵公主), 9th daughter
 * Married Qiao Shiwang, Viscount Xiangyi (喬師望/乔师望)
 * Princess Nanchang (南昌公主),10th daughter
 * Married Su Xu (蘇勗/苏勖)
 * Princess Anping (安平公主), 11th daughter
 * Married Yang Sijing of Hongnong (弘農 楊思敬/弘农 杨思敬)
 * Princess Huainan (淮南公主; 622–690), personal name Chengxia (澄霞), 12th daughter
 * Married Feng Daoyan of Bohai, Duke Mi (渤海 封道言; 616–699), a son of Feng Lun, in 638
 * Princess Zhending (真定公主), 13th daughter
 * Married Cui Gongli of Boling (博陵 崔恭禮/崔恭礼)
 * Princess Hengyang (衡陽公主/衡阳公主), 14th daughter
 * Married Ashina She'er, Duke Bi (阿史那社爾阿史那社尔; 609–655), a son of Ashina Xichun, in 636
 * Princess Danyang (丹陽公主/丹阳公主), 15th daughter
 * Married Xue Wanche of Hedong, Duke Wu'an (河東 薛萬徹/河东 薛万彻; d. 653) in 644
 * Princess Linhai (臨海公主/临海公主), 16th daughter
 * Married Pei Lüshi of Hedong, Duke Hedong (河東 裴律師/河东 裴律师), the second son of Pei Ji
 * Princess Guantao (館陶公主/馆陶公主), 17th daughter
 * Married Cui Xuanqing (崔宣慶/崔宣庆)
 * Princess Changsha (長沙公主/长沙公主; d. 724), 18th daughter
 * Married Doulu Huairang of Changli, Duke Rui (昌黎 豆盧懷讓/豆卢怀让), and had issue (one son, one daughter)
 * Princess Anding (安定公主), 19th daughter
 * Married Wen Ting (溫挺/温挺), the second son of Wen Yanbo
 * Married Zheng Jingxuan of Xingyang (滎陽 鄭敬玄/荥阳 郑敬玄), and had issue (one son)