Sulayman ibn al-Hakam

Sulayman ibn al-Hakam or Sulayman al-Musta'in bi-llah (; died 1016) was the fifth Umayyad Caliph of Córdoba, ruling from 1009 to 1010, and from 1013 to 1016 in Al-Andalus.
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").
Sulayman was however unable to conquer Toledo. In May 1010 Muhammad, who had reorganized his troops of "slave" mercenaries from all over Europe and had allied with Count Ramon Borrell of Barcelona, defeated Sulayman and conquered Córdoba, which was plundered by the Catalans. Muhammad was made again caliph, but his mercenaries assassinated him in July and restored Hisham II.
After he had withdrawn to Algeciras, Sulayman managed to reconquer Cordoba in 1013 with Berber help and depose Hisham II. His policy of concessions to Berbers, Arab and "slave" troops and leaders, effectively reduced the caliphate's authority to only Córdoba. In the meantime the Zirids of Granada formed an independent dynasty. In 1016 Córdoba was attacked by a large Berber army under the Hammudid governor of Ceuta, Ali ibn Hammud al-Nasir, who conquered it on 1 July 1016. Sulayman was imprisoned and, shortly afterwards, beheaded.