Li Yuanji
In summer 626, the Eastern Turkish 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).