Li Shimin defeats Liu Heita in spring…
622 CE
Li Shimin defeats Liu Heita in spring 622, forcing him to flee to the Eastern Turks, but Liu Heita soon returns with Turkish reinforcements and kills Emperor Gaozu's nephew Li Daoxuan the Prince of Huaiyang in battle, again seizing former Xia territory, although by this point Li Shimin and Li Yuanji have also defeated Xu Yuanlang and reduced his territory to a few cities.
Meanwhile, an intense rivalry has developed between Li Jiancheng and Li Shimin, as, while Li Jiancheng has made some contributions toward Tang's reunification of China, Li Shimin has been the one defeating and capturing the major rivals Xue Rengao, Liu Wuzhou, Dou Jiande, and Wang Shichong, causing him to possess the greater reputation among the army.
Li Yuanji, who is also often relied on by Emperor Gaozu as a general, supports Li Jiancheng in this rivalry, and often pushes Li Jiancheng toward a more hardline position against Li Shimin, wanting to be crown prince when Li Jiancheng becomes emperor.
Li Jiancheng and Li Yuanji have better relations with Emperor Gaozu's favored young concubines than does Li Shimin (as their mother Duchess Dou had died before Tang's establishment), and those concubines help rehabilitate Li Jiancheng's standing before Emperor Gaozu, causing him to no longer consider making Li Shimin crown prince instead, as he had at one point considered.
By winter 622, Liu Heita poses the only remaining major threat against Tang rule.
At the suggestion of his staff members Wang Gui and Wei Zheng, who argue that Li Jiancheng needs some personal victories to establish his reputation, Li Jiancheng volunteers to command the army against Liu Heita.
Emperor Gaozu thus sends Li Jiancheng, assisted by Li Yuanji.