Tang campaigns against the Western Turks

The Tang campaigns against the Western Turks, known as the Western Tujue in Chinese sources, were a series of military campaigns conducted by the Tang dynasty against the Western Turkic Khaganate in the 7th century AD. Early military conflicts were a result of the Tang interventions in the rivalry between the Western and Eastern Turks in order 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's defeat of 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 the new empire.

The areas controlled by 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.

Background
The Gokturks split into the Western and Eastern Turkic Khaganates after a civil war. Allied with the Byzantine Empire, the Western Turks were mired in wars against the Sassanid Persians. The Western Turks expanded as the khaganate of the Eastern Turks declined.

Early military conflicts
Emperor Gaozu, Taizong's predecessor, allowed the assassination of a Western Turk khan by Eastern Turkic rivals on November 2, 619. Eastern Turk was the suzerain of Tang from 618 to 620. Throughout the reign of Tong Yabghu Qaghan (618–628), Western Turks and Tang had a very close relation.

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 with 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 invasion of the Tarim Basin.

Campaign against Karakhoja
Karakhoja had been ruled by the Qu family since 498. The most Sinicized of the oasis states, Karakhoja had adopted Chinese script as its official script, the Chinese classics as a subject for study, and an imperial bureaucracy. As the oasis state nearest to Tang China, the Chinese constituted a large portion of Karakhoja's population. Karakhoja also served as China's main Silk Road trade route into Central Asia. The route was severed when the Western Turk Tu-lu Qaghan, enthroned in 638, promised Karakhoja military support.

Campaigns against Karasahr
In 632, Karasahr submitted to the Tang as a tributary state, as did the nearby kingdoms of Kashgar and Khotan. Tensions between Tang and Karasahr grew as the Chinese expanded further into Central Asia, and peaked when the Tang defeated and annexed Gaochang. The Chinese forces stationed in Gaochang, a short distance away from Karasahr, posed a direct threat to the oasis state.

Karasahr allied with the Western Turkic Khaganate and ceased sending tributes to the Tang court. A military campaign was dispatched by the Tang emperor against Karasahr. Led by Commander Guoxiao Ke, protectorate-general of the Anxi Protectorate, the army marched towards Karasahr from Yulduz. The Tang forces mounted a surprise attack at dawn, resulting in the annexation of Karasahr and the capture of its king. The Western Turk army sent to retake Karashar was defeated by the Tang.

Karasahr was controlled by proxy through a Tang loyalist, Long Lipozhun, brother of the captured ruler. He was deposed in 644 by his cousin, with the support of the kingdom of Kucha, nominally a Tang vassal, and the Western Turks. In 648, the Tang conducted a second military campaign against Karasahr, commanded by Ashina She'er, a member of the Turkic Ashina royal family. Karasahr fell, the usurper was beheaded, and Tang rule was re-established under another Tang loyalist. A Chinese military garrison was established in the kingdom, the first of the Four Garrisons of Anxi.

Campaign against Kucha
After the fall of Karasahr, Ashina Sh'er's army marched towards the neighboring kingdom of Kucha. She'er's decoy horsemen led the defending Kucha forces, numbering 50,000 soldiers, into an ambush. The Kucha soldiers retreated to the nearby city of Aksu after their defeat. The Tang army besieged the city for forty days. Kucha surrendered on 19 January 649 and She'er captured the king. By employing diplomacy, the surrounding tribes loyal to Kucha submitted to the Tang.

Campaign against the Western Turks
Ashina Helu, a former Tang general in Gansu, fled west and declared himself qaghan of the Western Turks, unifying the Turkic tribes under a single khaganate. Helu invaded the kingdoms of the Tarim Basin and led frequent raids against bordering Tang cities. Emperor Gaozong sent an army led by Su Dingfang to defeat the Western Turks. The Turkic commanders Ashina Mishe and Ashina Buzhen, rivals of Helu, led the side divisions.

Ten thousand Uyghur horsemen participated in the campaign as allies of the Tang. Porun, a Uyghur leader enthroned by Emperor Taizong, oversaw the Uyghur cavalry as a vice commander. He served under the leadership of the Yanran Protector-General and Vice Protector-General, administrators of the Yanran Protectorate. The army departed from Ordos in march and traversed through 3,000 miles of steppes and desert, without stopping by the oasis kingdoms for supplies. Along the way, tribes like the Chumkun and Su offered additional reinforcements. The troops reached the Kyrgyzstan by November, enduring the harsh conditions of the winter.

Su Dingfang defeated Helu's army of 100,000 cavalry at the battle of Irtysh River, fought along the Irtysh River in the Altai Mountains region. Helu had been caught off guard by Su's ambush and suffered a large number of casualties. The qaghan attempted to flee to Tashkent, but was caught the next day and sent to the Tang capital as a prisoner. The remaining tribes of the Western Turks surrendered. Gaozong pardoned Helu, but the qaghan died the following year.

Further campaigns
The dissolution of the khaganate fragmented the Western Turkic tribes. In 670, a Western Turkic tribe allied with the Tibetan Empire and invaded the Tarim Basin. The Anxi protectorate was abandoned and the Tang withdrew back to Turfan. Control of the oasis states returned to the Tang between 673 and 675, and the protectorate was re-established.

In 677, the Western Turks conducted a second military expedition with the Tibetans against the Tang in the Tarim Basin. The Turks were repelled by the Tang and defeated in 679. Tang forces captured the leader of the Western Turks and annexed Tokmak, which was transformed into a military base.

Ilterish Qaghan founded the Second Turkic Empire after a successful revolt in 682. The expansion of the khaganate continued under Ilterish's brother, Qapaghan Qaghan. In 712, Kul Tigin, son of Ilterish, defeated the remnants of the Western Turks, members of the Turgis confederation. Now defeated, the Western Turks were absorbed into the new empire.

Historical significance
The Tang campaigns marked the end of Indo-European Xinjiang. As the Turkic empire disintegrated, Turkic linguistic and cultural influences spread into Xinjiang and throughout Central Asia. Tang China was also responsible for the influx of Turkic migrants, because of the number of Turks that served in the Tang military as soldiers and generals during the dynasty's military expeditions.

Tang influence in the Central Asia encompassed art, trade, and politics. Chinese coinage remained in use in Xinjiang after the Tang withdrew from the region. Central Asian art adopted many Tang Chinese stylistic elements, like the sancai three color glaze used for ceramics. According to Chinese sources, Turkic states and polities still valued ties with the courts of dynasties in northern China as a form of prestige. The Qarakhan and Qarakhitay khans held titles that identified them as Tabghach or Khitay, named after kingdoms in northern China. Tang architectural influences are apparent in the Buddhist architecture in Dunhuang.