Following the end of An Lushan rebellion in 763 the Tang military was debilitated and never recovered. The Tang Empire started to fragment as the military of the Tibetan Empire invaded China. The Tibetan army also concurred territory in the Hindu Kush and Pamir Mountains from Indian kingdoms and assisted the establishment of the Pala Empire in eastern India in the latter half of the 8th century. It was only under the fifth Abbasid caliph Harun al-Rashid that a formal military alliance between the Tang, the Uighur Turks and the Abbasid engaged the Tibetan army on the western Tibetan frontier with the Arabs. At the same time the Uighur Turks fought the Tibetans along the Central Asian Silk Roads. The Karluks expanded their settlements around the Tian Shan mountains and also settled westwards in Abbasid controlled Fergana and Tukharistan. Iron weapons continued to be exported to Tibet and China on the Silk Roads between Kuqa and Aksu near the Tarim basin. Arab sources record that in the 10th century Aksu and Fergana had markets for arms traders.