The Tang campaigns against the Western Turks, were a series of military campaigns conducted by the Tang dynasty against the Western Turkic Khaganate in the 7th century. Early military conflicts were a result of the Tang interventions in the rivalry between the Western and Eastern Turks to weaken both. Under Emperor Taizong, campaigns were dispatched in the Western Regions against Gaochang in 640, Karasahr in 644 and 648, and Kucha in 648.
The wars against the Western Turks continued under Emperor Gaozong, and the khaganate was annexed after General Su Dingfang defeated Qaghan Ashina Helu in 657. The Western Turks attempted to capture the Tarim Basin in 670 and 677, but were repelled by the Tang. The Second Turkic Empire defeated the fragmented Western Turks in 712, and absorbed the tribes into their new empire.
The areas controlled by the Tang Empire came under the dynasty's cultural influences and the Turkic influence of the ethnically Turkic Tang soldiers stationed in the region. Indo-European prevalence in Central Asia declined as the expeditions accelerated Turkic migration into what is now Xinjiang. By the end of the 657 campaign, the Tang had reached its largest extent. The Turks, Tibetans, Muslim Arabs and the Tang competed for control over Central Asia until the collapse of the Tang in the 10th century.
The First Turkic Khaganate split into the Western and Eastern Turkic Khaganates after a civil war. Allied with the Byzantine Empire, the Western Turks fought in wars against the Sasanian Empire. The Western Turks expanded as the Eastern Turks declined.
Under Shikui Qaghan (r. 611–619), the Western Turks took advantage of the collapsing Sui dynasty to embark on a slew of conquests. The Western Turks reached their apex under Tong Yabghu Qaghan (r. 619–628) when their influence stretched from the Altai Mountains in the northeast to the Aral Sea in the west and covering the Tarim Basin oasis states in the south. They extracted resources such as salt and fish from Yanqi (Karashahr) and developed a friendly relashionship with the kingdom of Gaochang (Karakhoja) west of modern day Turpan. In the west, the Western Turks subjugated Tashkent (Shiguo), the Tiele people, Fergana, and Maimargh. They also attacked Persia and Tokharistan in the southwest. During these military campaigns, the Western Turks cultivated friendly relations with the Tang dynasty in the hope that they would not interfere with their expansionist activity.
Eventually, the Western Turks and the Tang dynasty came into conflict over control of the oasis states in the Tarim Basin. In 627, the Karluks rebelled against the Western Turks and in 628, Külüg Sibir murdered his nephew, Tong Yabghu Qaghan, and took the title of qaghan for himself. Tong Yabghu's son, Sy Yabghu Qaghan, fought against Külüg Sibir, splitting the Western Turks into the western Nushibi confederation and the eastern Duolu confederation.
Seven oasis states around Yiwu County in present day Hami City defected to the Tang dynasty in 630 and the Western Yi Prefecture was created to administer the area. In 632, Western Yi Prefecture was upgraded to a regular prefecture called Yi Prefecture. Meanwhile, Sy Yabghu had defeated Külüg Sibir, but he became embroiled in another internal dispute after a failed campaign against the Xueyantuo, which forced him to flee to Samarkand in 632. Duolu Qaghan succeeded him as the new ruler only to die soon after in 634, further weakening the Western Turks' control over their subjects. The oasis states of Shule (Kashgar), Suoche (Yarkant County), and Yutian (Khotan) submitted to the Tang in 632 and 635.
The Western Turks continued to suffer from instability under Duolu's successor, Ishbara Tolis (r. 634–638). He was compelled to divide the people live around the Chu River into two sections, both of which chose their own qaghans.
Tang influence on the Western Turks
Gaozu's successor, Emperor Taizong, in his war against the Western and Eastern Turks, employed the Chinese strategy of "using barbarians to control barbarians". In 641, he instigated a civil war between the eastern and western confederations of the Western Turks by supporting Isbara Yabghu Qaghan. The qaghan in the east, Tu-lu Qaghan, invaded the oasis states controlled by Isbara Yabghu in the west. He assassinated his rival and unified the Western Turkic Khaganate.
Following the reunification, Tu-lu Qaghan began orchestrating raids against Chinese cities. In 642, Emperor Taizong once again intervened by assisting a revolt against Tu-lu's reign. Disaffected Western Turkic tribes had requested the support of Taizong in Chang'an, who enthroned a new qaghan Irbis Seguy. Irbis Seguy was able to exert control over the Turkic tribes and the former qaghan fled in exile. The Tang court and the Western Turks began negotiating over the control of five oasis states in the Tarim Basin. Irbis Seguy wanted to strengthen his ties with the Tang through a royal marriage to a Tang princess. Although the oasis states were vassals of the Turks, Irbis Seguy did not have the power to simply cede them to the Tang. The possibility of further diplomatic exchanges ended when Taizong began his campaign against Yanqi and Qiuci in 648.
Gaochang (Karakhoja) was the first of the oasis states to be negatively impacted by the expansion of the Tang dynasty. Gaochang was a centralized kingdom organized under a Chinese form of government. It was the most sinicized of the oasis states, used Chinese writing as its official script and the Chinese language as its administrative language, studied the Chinese classics, and Han people made up a large portion of its population. Gaochang had a monopoly over trade between Chang'an and merchants from the west, generating massive tax revenue and enriching the Gaochang court.
Gaochang had been ruled by the Qu family since 498 and had entered a marriage alliance with the Sui dynasty. In 630, its king Qu Wentai visited Chang'an to pay homage to the Tang, but relations between the two states soured after 632 or 638 when another trade route was opened north of present-day Lop Nur, bypassing Gaochang. Gaochang retaliated by raiding Yanqi, who had requested the opening of the new trade route, and intercepting travelers to China. Qu Wentai entered a military alliance with the Western Turk ruler Tu-lu Qaghan.
With the help of the Western Turks, Gaochang seized Yanqi's territory in 638 and plotted to attack Yi Prefecture as well. In 639, Emperor Taizong reprimanded Qu Wentai and threatened to attack Gaochang if he did not change course. An edict was issued summoning Qu Wentai to the Tang court. The king of Gaochang ignored these demands with the excuse that he was sick. He did not believe that the Tang would be able to mount a successful attack against Gaochang because of the Gobi Desert and the difficulty of supplying a large army. Taizong appointed Hou Junji to lead an expeditionary force against Gaochang. When news arrived in 640 that the Tang army was fast approaching Gaochang, Qu Wentai was caught completely by surprise. With no way to defend against the impending attack, the king fell sick and died suddenly. The Western Turks sent a relief force but they fled as the Tang army approached. Qu Wentai's son, court officials, and a large number of tribal chieftains were captured and taken to Chang'an.
Gaochang was annexed and transformed into Xi Prefecture in modern day Gaochang, Turpan under direct administration. Xi Prefecture was treated like a normal part of the Tang dynasty and land was redistributed based on the equal-field system, household registers were updated every three years, and taxes were levied in the form of corvée labor, grain, and cloth. According to household registers in 640, there were 37,700 people in 8,000 households in Xi Prefecture. Xi Prefecture became the seat of the Protectorate General to Pacify the West, a combined civil and military administration backed by an army.
In 632, Yanqi (Karasahr) submitted to the Tang as a tributary state, as did the nearby kingdoms of Shule (Kashgar) and Yutian (Khotan). Tensions between the Tang and Yanqi grew as the Chinese expanded further into Central Asia. After the Tang annexed Gaochang, the Tang army was stationed there only a short distance away from Yanqi, and posed a direct threat to the oasis state.