Mahmud II
Al-Mustarshid achieved more independence as a ruler while the Seljuk sultan Mahmud II was engaged in war in the East. In 1122, al-Mustarshid deposed and imprisoned his vizier Amid al-dawla Jalal al-Din Hasan ibn Ali. Mahmud II then imposed Ahmad ibn Nizam al-Mulk as his vizier.