Career
He was named governor of Ceuta after 1013 by caliph Sulayman ibn al-Hakam. Taking advantage of the anarchy then existing in the reign, he conquered Tangiers, also in Africa, then, after occupying the Iberian port of Algeciras, he moved to Málaga. After conquering also the latter, he moved with his North-African army to the capital, Córdoba, capturing it on 1 July 1016.
Caliph Suleyman was first imprisoned and then beheaded, when news arrived of the death of the former caliph, Hisham II al-Hakam.
Ali was elected caliph, adopting the title (laqab) of al-Nasir li-din Allah ("Defender of the Religion of God"). Initially the population welcomed him for his impartiality.
However, later both his severity and the appearance of a pretender from the previous ruling dynasty of the Umayyads, Abd ar-Rahman IV, his popularity fell down and he was assassinated on 22 March 1018. Abd ar-Rahman was elected caliph, but he was in turn ousted by Ali"s brother, al-Qasim al-Ma"mun, governor of Seville.