Liu Heita
The former Xia territory did not remain in Tang hands for long. In the winter of 621, the Xia general Liu Heita rose against Tang rule, claiming to be avenging Dou, whom Emperor Gaozu had executed against Li Shimin's wishes after he had been brought back to Chang'an. Liu was allied with Xu Yuanlang, a former agrarian rebel general who was nominally under Wang Shichong and who had submitted to Tang after Wang's defeat. Liu dealt successive defeats to Emperor Gaozu's cousin Li Shentong (), the Prince of Huai'an; Li Xiaochang (), the Prince of Yi'an; and Li Shiji. By the end, he had recovered almost all of the former Xia territory, established his capital at Mingzhou, and proclaimed himself the Prince of Handong. Emperor Gaozu finally sent Li Shimin and Li Yuanji against him in 622 and, after some indecisive battles, Li Shimin defeated him by first erecting a dam across the Ming River and then destroying it, with the resultant flood destroying the rebel army. Liu fled to the Eastern Turks, while Li Shimin then headed east and defeated Xu. After leaving Li Shiji, Li Shentong, and Ren Gui () to continue attacking Xu, Li Shimin returned to Chang'an.