The Hammudid dynasty (Arabic: بنو حمود, Banū Ḥammūd) was a Berberised Arab Muslim dynasty that briefly ruled the Caliphate of Córdoba and the taifas of Málaga and Algeciras and nominal control in Ceuta. Their Idrisid ancestors were Zaydi, which would explain why the Hammudids were described as Shi'ite whilst not displaying any of the unorthodox tendencies of the Imamiyyah.
Hammudid dynasty Wikipedia
The dynasty is named after their ancestor, Hammud, a descendant of Idris ibn Abdallah, whose ancestors had established themselves among the Berber tribes of northern Morocco. When Sulayman ibn al-Hakam carved out Andalusian land for his Berber allies, two members of the Hammudid family were given the governorship of Algeciras, Ceuta and Tangier. The Hammudids thus gained control of the traffic across the Straits of Gibraltar, suddenly becoming a powerful force. Claiming to act on behalf of the dethroned Hicham II, the Hammudi governor of Ceuta Ali ibn Hammud al-Nasir marched upon Córdoba in the year 1016, where he was crowned Caliph.
In the aftermath of the fall of Córdoba and the following civil conflicts, the Hammudids were part of the shi'at al-Barbariya (the Berber faction), while still being able to claim Chorfa descent. Thus their Berber heritage gave them the nominal support of the Berber emirs (and that of a large North-African army), while their Chorfa heritage made a Caliphal claim acceptable to many in the Arab and Andalusian elite. In 1056, the last Hammudid Caliph was dethroned, losing Malaga to the Zirids of Granada, who had previously been the Hammudids' most important supporters. The Hammudi family was then forced to settle in Ceuta, Spain.