Hisham II
In 1009, after Muhammad II ibn Hisham had led a revolt against caliph Hisham II al-Hakam and imprisoned him, taking advantage of the fact that the kingdom's strongman, Abd al-Rahman Sanchuelo, was fighting in León against the Christian king Alfonso V, Sulayman took command of an army of Berbers who had abandoned Muhammad; by an alliance with count Sancho García of Castile, he was able to defeat Muhammad on November 1, 1009, in the battle of Alcolea. While Muhammad took refuge in Toledo, Sulayman entered Córdoba, which he allowed to be sacked by Berbers and Castillans; he freed and recognized caliph Hisham II, only to depose him after a few days. He was thus elected caliph by his Berber troops, assuming the title (laqab) of al-Musta'in bi-llah ("He Who Seeks for God's Help").