The Xuanwu Gate Incident was the coup of 626 at the Xuanwu Gate, the north gate of the Taiji Palace in Chang'an, by which Li Yuan's second son Li Shimin fixed his succession. Through the founding wars of the Tang, Li Shimin had beaten Xue Ju, Liu Wuzhou, Wang Shichong and Dou Jiande in turn — the greatest record of the house — and his contest with the heir apparent Li Jiancheng sharpened into open faction against faction. In the summer of 626, with the Turks raiding the frontier, Jiancheng moved to send Prince Yuanji against them and strip the Qin palace of its troops; Li Shimin struck first — on the fourth day of the sixth month his ambush at the gate shot Li Jiancheng dead, Yuchi Gong shot Li Yuanji, and the palace passed into his control. Li Yuan had no choice but to name Li Shimin heir, yielded the throne that eighth month — Taizong on the throne, the era Zhenguan from the next year — while Jiancheng's and Yuanji's sons were killed at the same hour. The incident closed in fratricide; yet the twenty-odd years of Li Shimin's reign opened the Zhenguan era of good government and the Tang's rise — and the coup's course has been argued by historians ever since.