Emperor Taizong's campaign against the Western Regions

In 648, the ethnically Turkic Tang general Ashina She'er who was the second son of Shibi Khan, attacked both Karasahr and Kucha in the northern Tarim, conquering both.

In turn, both the Western Turkic Khaganate itself and its vassal-allies in the region at times nominally submitted to Tang overlordship.

For example, in 619, soon after Emperor Gaozu established the dynasty in 618 and was still battling for supremacy over China against a number of rival rulers, both the Western Turkic Khaganate's Tongyehu Khan Ashina Tong and Gaochang's king Qu Boya sent tributes to him.

Qu Wentai also entered into an alliance with Ashina Bobu against a Tang ally, Yiwu (伊吾), in modern Hami, Xinjiang), as well as Yanqi.

Qu Wentai further incensed Emperor Taizong by trying to persuade Xueyantuo's Zhenzhu Khan Yi'nan to take a more independent stance from Tang.

Emperor Taizong began planning an invasion against Gaochang, and Yi'nan offered to assist, although historical records did not indicate any actual Xueyantuo participation.

He furthered established the Protectorate General to Pacify the West at the fortress of Jiaohe (交河, near Gaochang as well) to keep a military presence.

The rebels sought aid from Tang, and Emperor Taizong created Ashina Moheduo's son as Yipishekui Khan.

Meanwhile, Yanqi had remained friendly with Tang, but in or before 644, the Western Turkic general Ashina Quli (阿史那屈利) had taken the Yanqi king Long Tuqizhi's daughter to be his brother's wife, and, in response, Long Tuqizhi began to favor the Western Turkic Khaganate and decreased its tributes to Tang.

Emperor Taizong agreed—but ordered him to submit, as dowry, five states that were the Western Turkic Khaganate's vassals, Kucha, Yutian, Shule, Zhujupo (朱俱波, in modern Kashgar, Xinjiang) and Congling.

Emperor Taizong became angered, and around the new year 648, he commissioned Ashina She'er, a general who was formerly an Eastern Turkic prince, as the commander of an army to attack Kucha, with the generals Qibi Heli (契苾何力) and Guo Xiaoke assisting Ashina She'er, and also requisitioned soldiers from the Tiele tribes, the Eastern Turkic people, Tibet, and Tuyuhun.

In fall 648, Ashina She'er first advanced into the Dzungarian Basin and attacked the Chuyue (possibly Chigil) and Chumi tribes, forcing them to surrender.

Intimidated by the Tang advance, Long Xuepoanazhi abandoned Yanqi and took up position in eastern Kucha, but Ashina She'er captured and executed him.

Haripushpa sent his chancellors Nali (那利) and Jieliedian (羯獵顛) to resist Ashina She'er's forward commander Han Wei (韓威).

Ashina She'er had Guo take up position at Yiluolu and continued pursuing Haripushpa, who by this point had fled to Bohuan (撥換, also in modern Aksu).

Ashina She'er besieged it for 40 days and captured it, taking Haripushpa and Jieliedian, but Nali escaped and led remaining Kucha troops and relief forces from Western Turkic to attack Yiluolu, catching Guo by surprise and killing him in battle.

Ashina She'er made a younger brother of Haripushpa the new king, and after receiving tributes from the Western Turkic Khaganate, Yutian (Khotan), and An (安, Bukhara), withdrew.

The Tang established the Four Garrisons of Anxi in the Tarim Basin after defeating Ashina Helu's subordinate Duman at Kasghar in 659.

Tang's campaigns against Western Regions and Western Tujue
Chinese officer of the Guard of Honour. Tomb of Princess Changle (长乐公主墓), Zhao Mausoleum , Shaanxi province. Tang Zhenguan year 17, i.e. 644 CE