became the Caliphate's main military commander, and de facto regent, during the rule of his brother, al-Mu'tamid (r. 870–892). Al-Muwaffaq's power relied on his close ties with the ghilmān, the foreign-born "slave-soldiers" that now provided the professional mainstay of the Abbasid army. The ghilmān were highly proficient militarily, but also very expensive, and a potential political danger, as their first priority was securing their pay; alien to the mainstream of Muslim society, the ghilmān had no compunctions about overthrowing a vizier or even a caliph to secure their aims, as demonstrated during the "Anarchy at Samarra" (861–870), when five caliphs succeeded one another. Caliphal authority in the provinces collapsed during the "Anarchy at Samarra", with the result that by the 870s the central government had lost effective control over most of the Caliphate outside the metropolitan region of Iraq. In the west, Egypt had fallen under the control of Ahmad ibn Tulun, who also disputed control of Syria with al-Muwaffaq, while Khurasan and most of the Islamic East had been taken over by the Saffarids, who replaced the Abbasids' loyal governor Muhammad ibn Tahir. Most of the Arabian peninsula was likewise lost to local potentates, while in Tabaristan a radical Zaydi Shi'a dynasty took power. Even in Iraq, the rebellion of the Zanj slaves threatened Baghdad itself, and further south the Qarmatians were a nascent threat. Until his death in 891, al-Muwaffaq was engaged in a constant struggle to avert complete collapse, but managed to suppress the Zanj and repel the Saffarids. Upon his death, his son assumed his powers, and when Caliph al-Mu'tamid died in 892, he usurped the throne from his sons. Al-Mu'tadid would prove to be the epitome of the "warrior-caliph", spending most of his reign on campaign. He managed to overthrow the local dynasts who had seized power during the Anarchy and restore control over the Jazira, the frontier towns of the Thughur, and the Jibal, but his attempts to capture Fars and Kirman were unsuccessful. In other areas, however, the fragmentation of the Islamic world continued: the Sajid dynasty was established in Adharbayjan, the Armenian princes became de facto independent, Yemen was lost to a local Zaydi dynasty, and a new radical sect, the Qarmatians, emerged and in 899 seized Bahrayn. His successor, al-Muqtadir's older half-brother al-Muktafi, was a more sedentary figure but continued al-Mu'tamid's policies, and was able to score a major victory over