and subdued Central Asia during the 640s and 650s. During Emperor Taizong's reign alone, large campaigns were launched against not only the Göktürks, but also separate campaigns against the Tuyuhun, and the Xueyantuo. Taizong also launched campaigns against the oasis states of the Tarim Basin, beginning with the annexation of Gaochang in 640. The nearby kingdom of Karasahr was captured by the Tang in 644 and the kingdom of Kucha was conquered in 649. The expansion into Central Asia continued under Taizong's successor, Emperor Gaozong, who invaded the Western Turks ruled by the qaghan Ashina Helu in 657 with an army led by Su Dingfang. Ashina was defeated and the khaganate was absorbed into the Tang empire. The territory was administered through the Anxi Protectorate and the Four Garrisons of Anxi. Tang hegemony beyond the Pamir Mountains in Afghanistan ended with revolts by the Turks in 665, but the Tang retained a military presence in Kyrgyzstan, Tajikistan, Uzbekistan and Kazakhstan. These holdings were later invaded by the Tibetan Empire to the south in 670. Tang rivalry with the Tibetan Empire The Tang Empire competed with the Tibetan Empire for control of areas in Inner and Central Asia, which was at times settled with marriage alliances such as the marrying of Princess Wencheng (d. 680) to Songtsän Gampo (d. 649). A Tibetan tradition mentions that after Songtsän Gampo's death in 649 AD, Chinese troops captured Lhasa. The Tibetan scholar Tsepon W. D. Shakabpa believes that the tradition is in error and that "those histories reporting the arrival of Chinese troops are not correct" and claims that the event is mentioned neither in the Chinese annals nor in the manuscripts of Dunhuang. There was a long string of conflicts with Tibet over territories in the Tarim Basin between 670–692 and in 763 the Tibetans even captured the capital of China, Chang'an, for fifteen days during the An Shi Rebellion. In fact, it was during this rebellion that the Tang withdrew its western garrisons stationed in what is now Gansu and Qinghai, which the Tibetans then occupied along with the territory of Central Asia. Hostilities between the Tang and Tibet continued until they signed a formal peace treaty in 821. The terms of this treaty, including the fixed borders between the two countries, are recorded in a bilingual inscription on a stone pillar outside the Jokhang temple in Lhasa. Arrival of Islam In