Mu'ayyid al-Mulk spent the first ten years of Malik-Shah I's reign (r. 1072–1092) in Baghdad and Jazira, where he was the deputy of his father and the sultan in almost the same manner as that of a viceroy.[1] In 1078, deadly riots took place in Baghdad due to religious differences between Islamic sects. Mu'ayyid al-Mulk, who was in the city at the time, quelled the riots with the help of the amid (Seljuk governor of Baghdad) and the prefect.[4] After the downfall of Abu'l-Mahasin Sayyid al-Ru'asa' in 1083/4, Mu'ayyid al-Mulk succeeded him as the tughra'i (administrative secretary). However, he was not happy with this post, and thus asked to be dismissed.