Xuanwu Gate Incident The Xuanwu Gate Incident ( ) refers to a palace coup on 2 July 626 , when the Chinese dynasty Tang Dynasty ' s Prince Li Shimin ( Prince of Qin ) and his followers assassinated 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 older brother Li Jiancheng and younger brother Li Yuanji . He took control and set up an ambush at Xuanwu Gate , the northern gate leading to the Palace City of the imperial capital Chang ' an . There , Li Jiancheng and Li Yuanji were assassinated by Li Shimin and his men . Within three days after the coup , Li Shimin was installed as the crown prince . Emperor Gaozu abdicated another sixty days later and passed the throne to Li Shimin , who would become known as Emperor Taizong . Background . After the founding of the Tang Dynasty , Li Jiancheng was created the heir apparent . Even though Li Jiancheng was designated as the heir apparent , he was often overshadowed by his younger brother Li Shimin . 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 amongst 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 the other nobility . He also placed Li Shimin in charge of the civil and military administration of the eastern plain with Luoyang as its headquarter . 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 with a staff of eighteen scholars to serve as his advisors on state affairs . This may have brought forth the suggestion that Li Shimin could harbor the ambition to ascend to the throne of the Tang empire . 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 . For his support , he relied on Luoyang where he could successfully build strong support among military and civil officials . Meanwhile 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 also 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 Wen ' gan ( 楊文幹 ) was raising troops , so Li Jiancheng — who was left in charge of the capital while Emperor Gaozu was away in his summer palace — could commit a coup for the Tang Dynasty throne . Although , there is still a matter of dispute on whether Li Jiancheng was actually involved amongst historians . Yang Wen ' gan was the regional commander of Qingzhou ( 慶州 ) in Gansu and a former guard of Li Jiancheng at the East Palace . However , the forementioned plot was disclosed to the authorities . Li Jiancheng was summoned from Chang ' an and Yang Wen ' gan was summoned from his garrison post . Li Jiancheng went to seek forgiveness against the advice of a subordinate to seize the throne . However , Yang Wen ' gan rebelled in the 6th month of 624 . Emperor Gaozu sent Li Shimin to put down the rebellion , but Yang ' 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 ' 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 of Li Shimin ' s staff member . Prior to the coup , Prince 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 6th 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 . Although , it ' s still disputed when or whether it had happened . Crown Prince Li Jiancheng and Prince Li Yuanji successfully plotted the dismissal of Fang Xuanling and Du Ruhui ( Li Shimin ' s principal advisors ) from service . Yuchi Jingde ( Li Shimin ' s general ) escaped an assassination attempt , which was ordered by the two princes . Later , he was slandered by the two princes at court and came near execution if it was not 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 . Early 626 , the Tujue attacked the frontier of the Tang empire . Usually , Li Shimin would be sent against Tujue forces . However , at Li Jiancheng ' s recommendation , Li Yuanji was commissioned for the military campaign , 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 advise of especially Zhangsun Wuji , Fang Xuanling , Du Ruhui , Yuchi Jingde , and Hou Junji . Li Shimin sent Zhangsun to recall his two most important advisors Fang Xuanling and Du Ruhui to help plan the course of action . After being summoned in secrecy , Fang Xuanling and Du Ruhui traveled to Li Shimin ' s camp , while disguised as Taoist priests , to discuss the strategy . Li Shimin also bribed Chang He , who at the time was the military commander of Xuanwu Gate , in following his orders . Few years prior , Chang had been an officer under Li Shimin , but he was eventually reassigned to a key position at the Xuanwu Gate in 624 . Eventually , Li Shimin submitted a message to 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 . However , 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 excuse themselves due to illness and prepare the troops , so they could 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 . While Li Jiancheng and Li Yuanji left at dawn to consult Emperor Gaozu personally , Li Shimin and his followers had taken control over Xuanwu Gate . Coup d ' état . On the dawn of 2 July 626 , Prince Li Shimin and his followers arrived at the Xuanwu Gate ( 玄武門 ) , where they awaited the arrival of Crown Prince Li Jiancheng and Prince Li Yuanji . Chang He ( ) , a military officer stationed at Xuanwu Gate , also led his troops in support of Li Shimin on the day of the coup . 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 fire his arrows at Li Shimin , but he did not managed to draw it . Li Shimin started to fire his arrows at Li Jiancheng and killed him . Yuchi Jingde ( ) and 70 horsemen caught up with Li Yuanji and shot at him , causing Li Yuanji to fall from his horse . However , 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 him , thus Li Yuanji fled on foot to Wude Hall ( ) . Nevertheless , he 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 . speculates that the emperor was alarmed by impending crisis , thus he withdrew himself from the situation . He also surrounded himself with senior officials who were friendly to Li Shimin , because he possibly realized that Li Shimin was the cause of this and had better military connections that provided him with the advantage . The officials were Pei Ji , Xiao Yu , Chen Shuda , Feng Lun , Yan Shigu , Dou Dan ( 竇誕 ) , and Yuwen Shiji . All , but Chen Shuda and Dou Dan , are said to have taken up important positions in the future government of Prince Li Shimin when he became emperor . During the ongoing battle , Li Shimin sent Yuchi Jingde — who was still fully armed — into the Palace City to announce the news of the situation to Emperor Gaozu . Emperor Gaozu asked what was disturbing the peace and why he has come . Yuchi Jingde replied : " The Crown Prince and the Prince of Qi committed treason . The Prince of Qin mobilized his troops and executed them . He feared that Your Imperial Majesty would be shocked and he sent me to protect you . " Emperor Gaozu accepted the answer that he received from Yuchi Jingde . Subsequently , as the " Zizhi Tongjian " states , Emperor Gaozu turned to his officials and asked of them : " I did not anticipate that today I should see such a thing as this . What ought to be done about it ? " Two of them spoke highly meritoriously of Li Shimin and said that the two princely brothers were punished by Li Shimin . They also recommended Emperor Gaozu to appoint Li Shimin as the heir apparent . At Yuchi ' s advice , Emperor Gaozu issued an imperial edict ordering the remaining forces to stop their resistance and to submit to Li Shimin . In the end , Li Shimin had taken full control over the Tang government . Within three days , Emperor Gaozu created Li Shimin the heir apparent . On the 9th day of the 8th month , he abdicated in favor for Li Shimin . He became a " Taishang Huang " ( Retired Emperor ) himself , only appearing in public sometimes to attend ceremonial functions at court . In 632 , Ma Zhou charged that the retired Emperor Gaozu had settled in Da ' an Palace ( 大安宮 ) , which he considered an inhospitable place as it was built on low - lying lands at Chang ' an that was plagued by dampness and heat during the summer . According to him , ever since Emperor Taizong moved to the countryside during the summers , his retired father was left behind in Chang ' an to suffer in the summer heat . However , his father would always decline any invitation to spend the summer together when Emperor Taizong eventually did invite him . 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 had 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 for his retired father as an act of filial piety . However , Emperor Gaozu grew ill and never bore witness to the palace ' s completion before his death in the 5th month of 635 .