Xuanwu Gate Incident

The Xuanwu Gate Incident was a palace coup for the throne of the Tang dynasty on 2 July 626, when Prince Li Shimin (Prince of Qin) and his followers assassinated his brothers Crown Prince Li Jiancheng and Prince Li Yuanji (Prince of Qi). Li Shimin, the second son of Emperor Gaozu, was in an intense rivalry with his brothers. He took control and set up an ambush at Xuanwu Gate, the northern gate leading to the Palace City within the imperial capital Chang'an. There, Li Jiancheng and Li Yuanji were murdered by Li Shimin and his men. Within three days after the coup, Li Shimin was installed as the crown prince. About two months later, Emperor Gaozu abdicated and passed the throne to Li Shimin, who would become known as Emperor Taizong.

Background
After the founding of the Tang dynasty by Emperor Gaozu, the Emperor's eldest son, Li Jiancheng, was established as the heir apparent, but he was often overshadowed by his younger brother Li Shimin. For instance, Li Shimin was instrumental in defeating several of Tang's major rivals. He had led the attack on Dou Jiande and Wang Shichong, whom he defeated in battle, which gained him prestige among his contemporaries. Meanwhile, Li Jiancheng was stationed along the northern frontier to guard it against the Tujue, which left him unable to build up a similar reputation. Eventually, Emperor Gaozu elevated Li Shimin's position above all other nobles. He placed Li Shimin in charge of the civil and military administration of the eastern plain, with Luoyang as its headquarters. There, Li Shimin established himself and appointed about fifty civil and military officials, which made it possible for him to challenge the heir apparent's pre-eminence. In 621, he established the College of Literary Studies comprising a staff of eighteen scholars, who served as his advisors on state affairs. This may have insinuated in Li Jiancheng's mind that Li Shimin could harbor ambition to ascend to the throne himself. Henceforth, Li Jiancheng attempted to undermine Li Shimin by getting his staff members removed and reassigned to other posts.

Prince Li Shimin found himself unable to gain support in the capital Chang'an or inside the imperial palaces, as he was often away on military expeditions. He mostly relied on Luoyang where he could successfully build strong support among military and civil officials. In Chang'an, Crown Prince Li Jiancheng was increasing his power by recruiting more than two thousand men to serve in the Changlin troops, which he stationed at the East Palace near the Changlin Gate. He was allied with his second younger brother Prince Li Yuanji. They had the support of Emperor Gaozu's consorts, who often interceded with court affairs on behalf of the two princes.

There were allegations that Yang Wengan was raising troops for Li Jiancheng, who was left in charge of the capital while Emperor Gaozu was away in his summer palace, to stage a coup for the throne. Whether Li Jiancheng was actually involved is still disputed among historians. Yang Wengan was the regional commander of Qingzhou in Gansu and a former guard of Li Jiancheng at the East Palace. The alleged plot was disclosed to the authorities, so Li Jiancheng was summoned from Chang'an and Yang Wengan was summoned from his garrison post. Li Jiancheng went to seek forgiveness against the advice of a subordinate to seize the throne. In contrast, Yang Wengan raised his troops and rebelled in the sixth month of 624. Emperor Gaozu sent Li Shimin to put down the rebellion, but Yang Wengan's own subordinates killed him after the imperial forces arrived at the scene. Emperor Gaozu initially offered Li Shimin the position of heir apparent in light of Yang Wengan's rebellion. However, Li Jiancheng's supporters, Li Yuanji, the palace ladies, and Minister Feng Deyi interceded to clear Li Jiancheng from the affair. Thus, Emperor Gaozu allowed Li Jiancheng to remain the heir apparent, but exiled some of Li Jiancheng's advisors and at least one member of Li Shimin's staff.

There are many questions with this rebellion, including why Yang Wengan rebelled, whether Li Jiancheng actually intended to rebel, what happened between Yang Wengan and Yuwen Ying (an emissary sent by the Emperor to Yang before the rebellion), why Yuwen Ying joined the rebel army, whether Li Shimin influenced some of the events or people involved, why Li Shimin's subordinate Du Yan was one of those who were exiled, and why the emperor did not install Li Shimin as the new heir as was promised.

Some texts state that, prior to the coup, Li Shimin survived a poisoning attempt by his two brothers. According to the Jiu Tangshu, it happened prior to 626, while the Zizhi Tongjian dates it to the sixth lunar month of 626, placing it within three days of the coup. states that the latter interpretation is most probably the one to be incorrect, since the poisoning had rendered Li Shimin seriously ill. It is still disputed when or whether this poisoning actually happened. Li Jiancheng and Li Yuanji successfully plotted the dismissal of Fang Xuanling and Du Ruhui, who were Li Shimin's principal advisors, from service. Yuchi Jingde, who was a general of Li Shimin, escaped an assassination attempt ordered by the two princes, but he was later slandered by the two princes at court and came near execution if it had not been for Li Shimin's intercession. By 626, Li Shimin became increasingly worried by his brothers' successful machinations in turning Emperor Gaozu against him and in removing his staff members.

Events leading to the incident
In early 626, the Tujue attacked the frontier of the Tang empire. At Li Jiancheng's recommendation, Li Yuanji was commissioned for a military campaign against these hostile forces, thus Li Shimin's best generals and crack troops were transferred to Li Yuanji. Thereafter, Li Shimin received word from his men that Li Jiancheng and Li Yuanji had taken preparations to assassinate him when he would see off Li Yuanji as was the custom during the onset of a military campaign.

Li Shimin decided to take action and planned to dispose of his two brothers at the advice of his subordinates, especially Zhangsun Wuji, Fang Xuanling, Du Ruhui, Yuchi Jingde, and Hou Junji. Li Shimin sent Zhangsun Wuji to recall Fang Xuanling and Du Ruhui, who were Li Shimin's two most important advisors, to help plan the course of action. After being summoned in secrecy, Fang Xuanling and Du Ruhui disguised themselves as Taoist priests and traveled to Li Shimin's camp to discuss the strategy. Li Shimin also bribed Chang He, who was the military commander guarding the Xuanwu Gate, into following his orders. Few years prior, Chang He had been an officer under Li Shimin, but he was eventually reassigned to a key position at the Xuanwu Gate in 624.

Li Shimin submitted a message to his father, Emperor Gaozu, accusing Li Jiancheng and Li Yuanji of having illicit affairs with several consorts of the emperor. After receiving the message, Emperor Gaozu summoned Li Shimin to come for an audience the following morning. The emperor also requested for his personal advisors Pei Ji, Xiao Yu, Chen Shuda, Feng Lun, and Yan Shigu to come. Consort Zhang learned of Li Shimin's accusations and informed Li Jiancheng. Li Jiancheng summoned Li Yuanji to deliberate together on how to deal with the difficult situation. Li Yuanji opted to not attend the imperial court that morning, but to excuse themselves due to "illness" to prepare the troops and observe the situation. However, Li Jiancheng said that the troops were already prepared and wanted to leave for the Palace City to hear first-hand what was amiss. Li Jiancheng and Li Yuanji left at dawn to consult Emperor Gaozu personally, while Li Shimin and his followers had taken control over the Xuanwu Gate.

Coup d'état
On the dawn of 2 July 626, Li Shimin and his followers arrived at the Xuanwu Gate, where they awaited the arrival of Li Jiancheng and Li Yuanji. Chang He, a military officer stationed at Xuanwu Gate, led his troops in support of Li Shimin on the day of the coup. As stated by, in the morning, Li Jiancheng and Li Yuanji probably left from the East Palace through its northern gate and traveled westwards through the Forbidden Park towards the Xuanwu Gate, while Li Shimin probably left from the Hongyi Palace and traveled southwards through the Forbidden Park towards the Xuanwu Gate.

As Li Jiancheng and Li Yuanji approached the Linhu Hall, they began to realize that a coup was about to unfold and immediately retreated eastward. Li Shimin rode towards his brothers and hailed them. Hereupon, Li Yuanji attempted to draw his bow to shoot his arrows at Li Shimin, but he did not manage to draw it. Li Shimin shot his arrows at Li Jiancheng and killed him.

Yuchi Jingde and seventy horsemen caught up with Li Yuanji and shot at him, causing Li Yuanji to fall from his horse. Li Shimin's horse fled into the woods and became entangled with tree branches, which led to Li Shimin falling off his horse too and being unable to get up. Li Yuanji quickly grabbed Li Shimin's bow and tried to strangle his brother with it. However, Yuchi Jingde arrived and shouted at Li Yuanji, so Li Yuanji fled on foot to Wude Hall. Yuchi Jingde overtook Li Yuanji and killed him with his arrows. Following the deaths of Li Jiancheng and Li Yuanji, while Li Shimin's forces held Xuanwu Gate under their control, fighting broke out between the two armed factions. When Yuchi Jingde arrived with the heads of the two princes, their retainers quickly dispersed with their troops.

Aftermath
Emperor Gaozu was sailing on a lake inside the Palace City during the time of the coup according to the Jiu Tangshu and Zizhi Tongjian. suggests that the emperor was alarmed by the impending crisis and therefore withdrew himself from the situation. He also suggests that the emperor surrounded himself with senior officials who were friendly to Li Shimin, because the emperor possibly realized that Li Shimin was the cause of the unfolding events and had better military connections that provided the advantage. The officials with the emperor were Pei Ji, Xiao Yu, Chen Shuda, Feng Lun, Yan Shigu, Dou Dan, and Yuwen Shiji.

During the ongoing battle, according to the Jiu Tangshu and Zizhi Tongjian, Li Shimin sent Yuchi Jingde fully armed into the Palace City to announce the news of the situation to Emperor Gaozu. Emperor Gaozu asked who was disturbing the peace and why he came, whereupon Yuchi Jingde replied that the Prince of Qin had taken arms to execute the heir apparent and the Prince of Qi who were disturbing the peace and, apprehensive that his majesty would be alarmed, sent him to stand guard. The sources agree that Emperor Gaozu was satisfied by Yuchi Jingde's answer. The Zizhi Tongjian adds that Emperor Gaozu asked his officials what ought to be done as he had not anticipated the events. As described in the text, two of them completely exonerated Li Shimin and spoke highly meritoriously of him, said that the killings of the two princely brothers served as a punishment, and recommended Emperor Gaozu to appoint him as the heir apparent.

Even though Li Shimin came out victorious, he still needed a positive appraisal for his conduct from the emperor to prevent further internal conflict. At Yuchi Jingde's advice, Emperor Gaozu issued an imperial edict ordering the remaining forces to stop their resistance and submit to Li Shimin. In the end, Li Shimin had taken full control over the Tang government. Within three days, Emperor Gaozu named Li Shimin as the heir apparent. On the 9th day of the 8th month, he abdicated in favor for Li Shimin. He became a Taishang Huang, which is a retired emperor, and only sometimes appeared in public to attend ceremonial functions at court.

In 632, Ma Zhou charged that the retired Emperor Gaozu had settled in the Da'an Palace, which he considered an inhospitable place as it was built on low-lying lands at Chang'an that were plagued by dampness and heat during the summer. According to Ma Zhou, ever since Emperor Taizong moved to the countryside during the summers, the retired emperor was left behind in Chang'an to suffer in the summer heat. When Emperor Taizong did invite his father, he would always decline the invitation to spend the summer together. Ma Zhou also charged that Emperor Taizong had not visited his father for a long time even though they lived nearby each other. Ever since the bloody palace coup, it seemed that father and son drifted apart to such an extent that their relationship never healed. In 634, Emperor Taizong launched the construction of the Daming Palace. He ordered the construction of the new summer palace as a residence for his father, but the retired emperor grew ill and never witnessed the palace's completion before his death in the 5th month of 635.