of the Umayyad Caliphate, which had put an end to the Rashidun Caliphate. A certain Simak ibn 'Ubayd al-'Absi served as the governor of the metropolis in 663, and another person named Ishaq ibn Mas'ud served as its governor in 685. The Azariqa, a faction of the Kharijites, attacked al-Mada'in in 687/8, and massacred its inhabitants. The city was then governed by Kardam ibn Martad ibn Najaba, and some time later by Yazid ibn al-Harith al-Shaybani. In 696, the Kharjite leader Shabib ibn Yazid al-Shaybani briefly occupied al-Mada'in. In 697, Mutarrif ibn al-Mughira was made the governor of al-Mada'in, and later in 701, Hanzala ibn al-Warrad and Ibn 'Attab ibn Warqa' were appointed as the combined governors of the metropolis. Some time later, the governorship of al-Mada'in was abolished. Abbasid period In 750, the Abbasid family captured al-Mada'in and the rest of Iraq, and declared themselves as the new caliphate. In 754, the Abbasid caliph al-Mansur briefly held his court at Rumiya (which was included in al-Mada'in). He also had his prominent military officer Abu Muslim Khorasani killed at the same place. In 755, the White Palace of al-Mada'in was destroyed under the orders of al-Mansur, who wanted to create a new city, which would later get completed in 762, and would be known as Baghdad, and would become the new capital of the Abbasid Caliphate (although he ordered the White Palace to be restored, it remained in decay). After the foundation of Baghdad, the decline of al-Mada'in became faster, and many of the inhabitants resettled in Baghdad, while the Nestorian patriarch and the exilarch were forced to move to the city. Nevertheless, the patriarch Timothy I founded a hospital at al-Mada'in in 790. During the Great Abbasid Civil War (809–813) between Caliph al-Amin (r. 809–813), and his brother al-Ma'mun (r. 813–833), al-Mada'in was captured in 812 by al-Ma'mun's general Tahir ibn Husayn, who then marched towards Baghdad. In 817, the people of Baghdad revolted, and proclaimed the Abbasid prince Ibrahim ibn al-Mahdi as their leader. The rebels also managed to capture Baghdad's surrounding regions, which included al-Mada'in. One year later, al-Mada'in was recaptured by al-Ma'mun's Persian officer al-Hasan ibn Sahl, and by the next year, Iraq was once again under the control of al-Ma'mun. During the Caliphal Civil War (865–866), Abi'l-Saj Devdad, a relative of the Iranian prince Afshin, was put charge in the defense of al-Mada'in in 865.