Turkic settlement of the Tarim Basin

Turkic peoples began settling in the Tarim Basin in the 7th century. The area was later settled by the Uyghur people, who founded the Qocho Kingdom there in the 9th century. The historical area of what is modern-day Xinjiang consisted of the distinct areas of the Tarim Basin (also known as Altishahr) and Dzungaria. The area was first populated by Indo-European Tocharian and Saka peoples, who practiced Buddhism. The Tocharian and Saka peoples came under Xiongnu    and then Chinese rule during the Han dynasty as the Protectorate of the Western Regions due to wars between the Han dynasty and the Xiongnu. The First Turkic Khaganate conquered this region in 560, and in 603 after a series of civil wars the First Turkic Khaganate was separated into the Eastern Turkic Khaganate and the Western Turkic Khaganate, with Xinjiang coming under the Western Turkic Khaganate. The region then became part of the Tang dynasty as the Protectorate General to Pacify the West after the Tang campaigns against the Western Turks. The Tang dynasty withdrew its control of the region in the Protectorate General to Pacify the West and the Four Garrisons of Anxi after the An Lushan Rebellion, after which the Turkic peoples and the other native inhabitants living in the area gradually converted to Islam.

Tarim Basin


The Tarim Basin, populated by the Indo-European Tocharian and Saka, became the place of settlement by two different Turkic Kingdoms, the Buddhist Turkic Uyghur Kingdom of Qocho and the Muslim Turkic Karluk Kara-Khanid Khanate.

The Turfan and Tarim Basins were populated by speakers of Tocharian languages, with "Europoid" mummies found in the region. The oases were populated by Iranian and Tocharian language speakers. Different historians suggest that either the Sakas or Tokharians made up the Yuezhi people who lived in Xinjiang. The northern Tarim Basin is where Tokharian language records were found.

The inhabitants of the Tarim Basin consisted of Buddhist Indo-Europeans, divided between Tocharians and Eastern Iranian Sakas.

Goktürks
From 560 the Tarim Basin was controlled by the Göktürks.

Han and Tang rule


During the Han dynasty, the Tocharians and Sakas of Xinjiang came under a Chinese protectorate in 60 BC, with the Chinese protecting the Tocharian and Saka city states from the nomadic Xiongnu who were based in Mongolia.

Arab sources claim that first recorded incursion into the Tarim Basin by an Islamic force is the alleged attack on Kashgar by Qutayba ibn Muslim in 715 but some modern historians entirely dismiss this claim.

The Tang dynasty Chinese defeated the Arab Umayyad invaders at the Battle of Aksu (717). The Arab Umayyad commander Al-Yashkuri and his army fled to Tashkent after they were defeated.

Uyghur migration into the Tarim Basin


Tang China lost control of Xinjiang after it was forced to withdraw its garrisons during the An Lushan Rebellion. During the rebellion China received aid from the Uyghur Khaganate in crushing An Lushan's rebels, however, multiple provocations by the Uyghurs such as selling bad quality horses to China, practicing usury when lending to Chinese, and sheltering Uyghurs who committed murder resulted in a major deterioration in relations between China and the Uyghur Khaganate. Tang China then allied with the Yenisei Kirghiz and defeated and destroyed the Uyghur Khaganate in a war, triggering the collapse of the Uyghur Khaganate which caused Uyghurs to migrate from their original lands in Mongolia southwestwards into Xinjiang.

Protected by the Taklamakan Desert from steppe nomads, elements of Tocharian culture survived until the 7th century, when the arrival of Turkic immigrants from the collapsing Uyghur Khaganate of modern-day Mongolia began to absorb the Tocharians to form the modern-day Uyghur ethnic group.

Kara-Khanid conquest of Khotan
By the 10th century, the area was ruled by the Kingdom of Khotan and Shule Kingdom when the first Turkic began migrating into the area. The Saka Kings were still culturally-influenced by the Buddhist homeland of Northern India, with their rulers adopting Sanskrit names and titles. The rulers of Khotan grew anxious of hostilities with Turkish khanates, as evidenced by the Mogao grottoes, were they commissioned painting number of divine figures along with themselves. By the time the Uyghurs and the Kara-Khanids invaded, Khotan was the only state in the area that had not come under Turkic rule. The Kara-Khanids formed from several Turkic groups that had increasingly settled portions of the Kashgar area. The tribes are thought to have converted to Islam following the conversion of Sultan Satuq Bughra Khan in 934. Khotan conquered Kashgar in 970, after which a long war ensued between Khotan and the Kara-Khanids. The Karakhanids fought Khotan until sometime before 1006 when the Kingdom was conquered by Yusuf Qadir Khan. The attacks likely related to Khotanese requests for aid when China. Relations with China factored heavily in the war. In 970, after the Khotanese capture of Kashgar, an elephant was sent as tribute by Khotan to Song dynasty China. After the Qara Khanid Turkic Muslims defeated the Khotanese under Yusuf Qadir Khan at or before 1006, China received a tribute mission in 1009 from the Muslims.

Following the war, a Buddhist revival occurred in the Tangut Empire, located in contemporary Western Xia, following the attacks on the Buddhist states in the region. The Empire became a safe haven for Indian Buddhist monks who were attacked and forced to flee to Tangut.

Legacy
Many of the Muslim soldiers who died fighting the region's Buddhist kingdoms are regarded as martyrs (shehit), and are visited by pilgrims at shrines called mazar. For instance, the killing of the martyr Imam Asim led to his grave being worshiped in a massive annual ceremony called the Imam Asim Khan festival. According to Michael Dillon, the conquest of the region is still recalled in the forms of the Imam Asim Sufi shrine celebration. However, due to the ongoing persecution of Uyghurs in China, the pilgrimage has no active participants, and the mosque at the shrine has been demolished.

Taẕkirah is literature written about Sufi Muslim saints in Altishahr. Written sometime in the period from 1700 to 1849, the Eastern Turkic language (modern Uyghur)  Taẕkirah of the Four Sacrificed Imams provides an account of the Muslim Kara-Khanid war against the Khotanese Buddhists. The Taẕkirah uses the story of the Four Imams as a device to frame the chronicle, the Four Imams being a group of Islamic scholars from Mada'in city (possibly in modern-day Iraq), who travelled to help the Islamic conquest of Khotan, Yarkand, and Kashgar by the Kara-Khanid leader Yusuf Qadir Khan. The legend of the conquest of Khotan is also given in the hagiology known as the Tazkirat or "Chronicles of Boghra". Extracts from the Tazkiratu'l-Bughra on the Muslim war against the Khotan was translated by Robert Barkley Shaw.

Contemporary poems and attitudes are recorded in the dictionary of the Turkic lexicographer Mahmud al-Kashgari and in the text Hudud al-'Alam. Kashgari's dictionary contains disparaging references to Buddhists. The antagonistic attitude towards Dharmic religions is striking in comparison to several earlier Islamic texts that portrayed Buddhism in a more charitable light, such as the works of Yahya ibn Khalid. Elverskog states that the attitudes in Hudud al-'Alam are dissonant, containing both accurate and libelous descriptions of Khotanese Buddhists (including a claim that the Khotanese are cannibals). He argues that these accounts were a way to dehumanize the residents of Khotan and encourage the conquest of the region.



The conquest of Khotan led to the destruction of Buddhist art, motivated by Islamic iconoclasm. The iconoclastic fervor is captured by a poem or folk song recorded in Mahmud al-Kashgari's Turkic dictionary. Robert Dankoff believes the poem refers to the Qarakhanids' conquest Khotan's despite the text's claim that it refers to an attack on the Uyghur Khaganate.

Khizr Khoja's attack on Turfan and Qocho
In the 1390s, the Chagatai ruler Khizr Khwaja launched a holy war against the Kingdom of Qocho and Turfan. Although Khizr Khwaja claimed to have converted to these kingdoms to Islam, the conversion was more gradual. Travellers passing through the area in 1420 remarked on the rich Buddhist temples, and only after 1450 were substantial numbers of mosques reported. As a consequence of the imposition of Islam, the city of Jiaohe was abandoned in the 15th century. Buddhist presence in Turfan is thought to have ended by the 15th century.

Kara Del was a Mongolian ruled and Uighur populated Buddhist Kingdom. The Muslim Chagatai Khan Mansur invaded and used force to make the population convert to Islam. It was reported that between Khitay and Khotan the Sarigh Uyghur tribes who were "impious" resided, and they were targeted for ghazat (holy war) by Mansur Khan following 1516.

After converting to Islam, the descendants of the previously Buddhist Uyghurs in Turfan failed to retain memory of their ancestral legacy and falsely believed that the Dzungars were the ones who built Buddhist monuments in their area. Buddhist influences still remain among the Turfan Muslims. Since Islam reached them much after Altishahr, personal names of un-Islamic Old Uyghur origin are still used in Qumul and Turfan while people in Altishahr use mostly Islamic names of Persian and Arabic origin.

Buddhist murals at the Bezeklik Thousand Buddha Caves were damaged by local Muslim population whose religion proscribed figurative images of sentient beings, the eyes and mouths in particular were often gouged out. Pieces of murals were also off for use as fertilizer by the locals.