# Mu'ayyid al-Din Ai-Aba

Mu'ayyid al-Din Ai-Aba (died July 1174) was the amir of Nishapur from c. 1154 until his death. Although nominally subservient to the Seljuks of Khurasan, he acted as an independent ruler. Due to his control of much of Khurasan, the historian Ibn Funduq called him "Emperor of Khurasan, King of the East."

## Establishment of Authority

Ai-Aba had once been a ghulam of the Seljuk Sultan Sanjar, who ruled in Merv. After Sanjar was captured by a band of Ghuzz nomads in 1153 his empire quickly fell into chaos as Ghuzz tribes overran much of the sedentary areas. Sanjar's amirs attempted to restore order by recognizing Suleiman Shah as sultan. 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.
With the central government unable to restore order on its own, Ai-Aba was free to pursue a largely independent policy in Khurasan. He first drove the Ghuzz out of Nishapur, Tus, Damghan, and several other cities. By lowering taxes and placating the landowners, he was able to build up a good reputation and expand his influence over much of Khurasan. After Mahmud Khan was appointed as sultan, Ai-Aba initially resisted submitting to him; after prolonged negotiations he was convinced to become Mahmud's vassal, although he retained his autonomous rule of the cities he administered.

## Under Mahmud Khan

Sanjar had escaped from Ghuzz captivity in 1156, but died a year later; before his death he confirmed Mahmud Khan as his successor. In spite of this, Mahmud Khan was incapable of establishing any effective control over Ai-Aba and was forced to deal with him as an equal. The latter had gone to war after Sanjar's death against Ikhtiyar al-Din Ai-Taq, another amir who had formerly been one of Sanjar's ghulams. 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.
After the war with Ai-Taq, Ai-Aba and Mahmud Khan attempted to quell the Ghuzz bands that had set themselves up in various parts of Khurasan. The Ghuzz, however, managed to defeat them and then went on the offensive. After occupying Merv, they moved against Ai-Aba's territories and raided Sarakhs and Tus. Furthermore, they offered their services to Mahmud Khan, who considered them to be a useful check on Ai-Aba's power and accepted.
The Ghuzz continued to push against Ai-Aba, even managing to temporarily occupy Nishapur in 1159. Ai-Aba's fortunes were soon revived, however, and he was able to retake his capital that same year. 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. For two years after this he made the khutba out for himself only.

## Expansion and Death

Following the imprisonment of Mahmud Khan, Ai-Aba rigorously attempted to expand his domain. In 1163 he received gifts and an investiture patent from the Seljuk sultan of Hamadan, Arslan Shah, and Ai-Aba hereafter inserted his name in the khutba, although the Seljuk had no effective authority over him. During this time he engaged in border disputes with the Ghurids. He also seized Qumis from the Bavandids, although they were able to take back the province in 1164. 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. Campaigns against the Ghuzz in Merv and Sarakhs were also undertaken.
In the mid 1160s, Khwarezmid armies began raiding into Khurasan. 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. Ildeniz responded by writing to the Khwarezmshah, warning him that Khurasan comprised part of the territories of the Seljuks.
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. Unfortunately for Ai-Aba, his army was defeated by Tekish's forces and he himself was captured and killed. In Nishapur he was succeeded by his son Toghan-Shah.