هشام المؤيد بالله
When Abd al-Rahman went on an expedition against King Alfonso V of León (February 1009), the citizens of Córdoba rose against him. They were led by Muhammad II al-Mahdi, a member of the Umayyad dynasty. Muhammad II al-Mahdi removed his relative Hisham II from the throne, became the new caliph and destroyed Abd al-Rahman's residence, al-Madina al-Zahira ("the flourishing city"). On receiving this news Abd al-Rahman returned to Córdoba, but his troops abandoned him. He was arrested and later assassinated on the orders of al-Mahdi.