The Battle of Qianshuiyuan (), northwest of present-day Changwu, Shaanxi, was fought in 618 between the Tang Dynasty and the state of Qin. The battle ended in victory for the Tang, whose armed forces were led by the future emperor Li Shimin. Background In 618 AD, Xue Ju, who occupied Longxi and made Tianshui his capital, styled himself as the Qin emperor (). He possessed an army of 300,000 soldiers and intended to capture Chang'an. The battle In 618 AD, Emperor Gaozu of Tang appointed Li Shimin as the marshal to meet the Qin forces head-on. At first, they were defeated in Qianshuiyuan and were forced back to Chang'an. Gaozhi () was annexed. After Xue Ju's death, his son Xue Rengao succeeded to the throne and continued to attack the Tang army. Li Yuan tried to get support from Li Gui, who occupied Liangzhou (in present-day Wuwei, Gansu), and he ordered Li Shimin to press on towards Gaozhi at the same time. Xue Rengao dispatched his elite general Zong Luohou (), leading more than 100,000 soldiers to resist. Li Shimin thought the Tang army was frustrated while the enemies were inspiring. So he switched from attacking to defending. The two sides were locked in a stalemate for about 60 days. When the Xue army were short of provisions, Li Shimin took great advantage of physical features of Qianshuiyuan and started attacking. Finally, the Xue army was badly defeated and surrendered. The Tang Dynasty suppressed Longxi and ensured the safety of Guanzhong. Sources 618 Qianshuiyuan 610s conflicts Transition from Sui to Tang Military history of Shaanxi Emperor Taizong of Tang