The deposed king fled to Kucha (seat of Anxi Protectorate), and sought Chinese intervention. The Chinese sent 10,000 troops under Zhang Xiaosong to Ferghana. He defeated Alutar and the Arab occupation force at Namangan and reinstalled Ikhshid on the throne.[3] In 717 AD the Arabs attacked Transoxiana again hoping to capture the Tang dynasty's Four Garrisons of Anxi district.[3]