In 1009, while Abd al-Rahman Sanchuelo was waging war against Alfonso V in León, Muhammad II al-Mahdi usurped the throne from Hisham II then held him hostage in Cordoba. In November of the same year, just months after initiating his control as the ruler of the Caliphate, Muhammad II al-Mahdi was overthrown by a primarily Berber army (that he had previously commanded, but by which he was later abandoned) which was led by Sulayman ibn al-Hakam in the battle of Alcolea. After the battle, Abd al-Malik al-Muzaffar was exiled to Toledo at which point Sulayman laid siege to Cordoba freeing Hisham II from the imprisonment that took place under the rule of Muhammad II al-Mahdi. Sulayman ibn al-Hakam was appointed to Caliph by his Berber army and maintained that position until Muhammad II al-Mahdi re-conquered the territory in May, 1010. Finally the Slavic troops of the Caliphate under al-Wahdid restored Hisham II as Caliph (1010–1013). Hisham II was now under the influence of al-Wahdid, who was nevertheless unable to gain control of the Berber troops – these still supported Sulayman, and the civil war continued. In 1013 the Berbers took Cordoba with much plundering and destruction. What happened to Hisham after that is uncertain – supposedly he was killed on 19 April 1013 by the Berbers. In any case, Sulayman al-Mustaʿin (1013–1016) became Caliph. Due to his disappearance, and hence his possible survival, Hisham II was revived as a symbol of legitimacy by the taifa kings who appeared following the definitive collapse of the caliphate: in 1035, the ruler of the Taifa of Seville, Abu al-Qasim Muhammad ibn Abbad, announced that Hisham had reappeared, and declared his allegiance to him. Other taifas falling under Seville's sway during the following years followed suit. It was not until 1060 that the Sevillan ruler Abbad II al-Mu'tadid acknowledged that this supposed Hisham had died in 1044 without a successor, but the "convenient fiction" of his survival lasted until at least 1082/83, when his name still appears in the coins of the Taifa of Zaragoza.