In contrast to the
Eastern Turkic Khaganate, the
Western Turkic Khaganate did not pose a major threat to the
Tang dynasty in the early years of the dynasty's existence, as it was farther from Tang-held territory and had a general indifference towards Chinese ambitions. Moreover, the Western Turkic Khaganate constantly suffered from internal conflict and was unable to focus itself against external threats. Because of this pacifism, the Khaganate's tributaries in the Tarim basin remained unmolested by Tang forces. 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. In 625, Ashina Tong sought marriage with a Tang princess, and Emperor Gaozu initially agreed, but the Eastern Turkic Khaganate's
Illig Qaghan Ashina Duobi was displeased about the potential of a Tang-Western Turkic alliance and warned Ashina Tong against it, ensuring that the marriage never took place. In 626, Emperor Gaozu's son
Li Shimin the Prince of Qin, who had been in an intense rivalry with his older brother
Li Jiancheng the
crown prince, ambushed and killed Li Jiancheng and
Li Yuanji, the Prince of Qi, at
Xuanwu Gate. He then forced Emperor Gaozu to first enfeoff him as crown prince and then abdicate the throne, leaving it open for Li Shimin to take the throne as Emperor Taizong. After Taizong ascended to power in 628, Ashina Tong was killed by his uncle,
Ashina Moheduo, who seized the throne as Qulipiqie Khan. However, some key Turks supported Ashina Tong's son
Ashina Dieli as
khan. Both sought aid and marriages from Tang China, and Emperor Taizong declined both. Eventually, in 630, Ashina Dieli was able to defeat and kill Ashina Moheduo, again reuniting the Western Turkic Khaganate. Meanwhile, Gaochang's king
Qu Wentai made a visit to Chang'an in 630, and was received warmly by the Tang court. In 632, Ashina Dieli, who had lost the support of his people due to his cruel rule, lost a campaign against the
Khazars, which caused the tribes Shebeidaguan () and
Nushibi who had formerly supported him to rebel and force him to flee to
Kangju. Bereft of a leader, the Turks chose
Ashina Nishu as Duolu Khan, and Ashina Nishu nominally submitted to the Tang dynasty and received Tang titles. The enmity continued, however, even after Nishu died and was succeeded by his brother, Ashina Tong'e. By 638, it was said that Ashina Tong'e had lost the hearts of the people, and the northern half of the khanate supported an Eastern Turkic prince,
Ashina Yugu as Yipiduolu Khan. There were major battles between Ashina Tong'e and Ashina Yugu, but neither side was able to prevail, and therefore divided the khanate in two, with the
Ili River serving as their boundary. The division continued after Ashina Tong'e died in 639 and was succeeded by his nephew
Ashina Bobu (as Shaboluoyehu Khan). == Campaign against Gaochang ==