In 626, Emperor Gaozu's son Li Shimin the Prince of Qin, in an intense rivalry with his brother Li Jiancheng the Crown Prince, ambushed Li Jiancheng and another brother, Li Yuanji the Prince of Qi (who supported Li Jiancheng) at Xuanwu Gate and killed them, and then effectively forced Emperor Gaozu to create him crown prince. He also took effective rein of the government and reorganized it. As part of the reorganization, Yang was removed from his posts, but remained a general.