The principality of Farghana was under Western Turk rule until it was destroyed by Tang China in 657 and after that under the Anxi Protectorate.
In cities such as Panjikant and Pai, the Sogdians revolted; the most dangerous being the rebellion of 720-722 under Divashtich and Karzanj, who gained the support of the ikhshid of Ferghana, known as at-Tar (also spelled Alutar).
Al-Harashi quickly marched towards Khujand, where he defeated the army of Karzanj, brutally massacring over 3,000 Sogdian inhabitants in the city.
[3][4] In 723, a Umayyad army under Muslim ibn Sa'id al-Kilabi invaded Ferghana, and devastated the countryside.
However, an army under the Turgesh khagan Suluk came to the rescue for their Ferghanian allies, and won a crushing victory over the Arabs in the so-called "Day of Thirst".