In fall 619, Dou Jiande, then with the title of Prince of Xia, launched a major offensive, set to affirm his control of the territory north of the Yellow River, as a number of cities there had submitted to Tang. After a number of Xia victories, Li Shentong () the Prince of Huai'an, Emperor Gaozu's cousin who was in charge of Tang operations north of the Yellow River, withdrew to Liyang and joined forces with Li Shiji. When Dou then was on the way to attack Tang's Wei Prefecture (, roughly modern Weihui, Henan), Li Shiji tried to ambush him, and his officer Qiu Xiaogang () nearly killed Dou before Dou's guards killed him. In anger, Dou turned his attack around and attacked Liyang instead, capturing it and seizing Li Shentong, Li Gai, Wei Zheng, and Emperor Gaozu's sister Princess Tong'an. Li Shiji was able to fight his way out, but several days later, because his father Li Gai had been captured, surrendered to Dou. Dou made Li Shiji a general and still kept him in charge of Liyang, but took Li Gai back to the Xia capital Ming Prefecture (, in modern Handan, Hebei) to serve as a hostage. He also put Li Shentong under house arrest, as an honored guest.