Suleiman Shah quickly demonstrated that he was incapable of dealing with the Ghuzz and fled; the amirs then set up the Karakhanid Mahmud Khan in his place, but he did little better.
Ai-Taq received assistance from the Bavandids of Tabaristan, but was nevertheless defeated by the armies of Ai-Aba and Mahmud Khan and was compelled to make peace with them in 1158.
He then began a purge against individuals who he considered to be responsible for the internal strife that had plagued the cities for several years, such as the head of the Nishapur Alids.
In 1161, meanwhile, Mahmud Khan attempted to abandon his alliance with the Ghuzz and make peace with Ai-Aba, who however seized and blinded him before imprisoning him and his son.
In the same year, the amir of Herat died and local citizenry handed over the city to Ai-Aba, in the hopes that he could protect them from the Ghuzz.
Ai-Aba, fearing that they would eventually move against him, wrote of the matter in 1167 to his friend Ildeniz, the Atabeg of Azerbaijan and the "protector" of the Hamadan Seljuks.
[9] In 1174, Ai-Aba led an expedition into Khwarezm following an appeal for help by the recently displaced Khwarezmshah, Sultan Shah, who had lost his throne to his brother Tekish.