Li Yuanji
In summer 626, the Göktürks were making another attack, and under Li Jiancheng's suggestion, Emperor Gaozu, instead of sending Li Shimin to resist the Göktürks 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 Jingde 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. Li Jiancheng's and Li Yuanji's sons were killed, and Li Shimin took Li Yuanji's wife Princess Yang as a concubine. Two months later, with Li Shimin firmly in control of power, Emperor Gaozu yielded the throne to him (as Emperor Taizong).