The Tang army was subjected to a devastating defeat. The Tang dynasty's defeat was due to the defection of Karluk mercenaries and the retreat of Ferghana allies who originally supported the Chinese. The Karluk mercenaries, two-thirds of the Tang army, defected to the Abbasids during the battle; Karluk troops attacked the Tang army from close quarters while the main Abbasid forces attacked from the front. The Tang troops were unable to hold their positions, and the commander of the Tang forces, Gao Xianzhi, recognized that defeat was imminent and managed to escape with some of his Tang regulars with the help of Li Siye. Out of an estimated 10,000 Tang troops, only 2,000 managed to return from Talas to their territory in Central Asia. Despite losing the battle, Li did inflict heavy losses on the pursuing Arab army after being reproached by Duan Xiushi. After the battle, Gao was prepared to organize another Tang army against the Arabs when the devastating An Shi Rebellion broke out in 755. When the Tang capital was taken by rebels, all Chinese armies stationed in Central Asia were ordered back to China proper to crush the rebellion.