The Hammudid dynasty () were an Arab dynasty of Idrisid origin in al-Andalus during the Taifa period (1016-1057). they ruled over Málaga and Ceuta and extended their domain to Algeciras. The first three members of the dynasty took the title of caliph in Córdoba, competing with the last Umayyads. The dynasty disappeared after the absorption of its territory by the Zirids of Granada (1057). They are most notable for being the only known Shi'a dynasty to emerge in al-Andalus. The dynasty The dynasty is named after their ancestor, Hammud, a descendant of Idris ibn Abdallah, founder of the Idrisid dynasty and great-grandchild of Hasan, son of Fatimah and Ali and grandson of the Islamic prophet, Muhammad. 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 Hammudid governor of Ceuta Ali ibn Hammud al-Nasir marched upon Córdoba in the year 1016, where he was crowned Caliph. In 1056, the last Hammudid Caliph was dethroned, losing Málaga to the Zirids of Granada, who had previously been the Hammudids' most important supporters. The Hammudi family was then forced to settle in Ceuta. History When the troops of the Umayyad Caliph Al-Hakam al-Mustansir, commanded by the vizier Almanzor, defeated the Idrisids in Morocco, the Ghomara tribes swore allegiance to the Caliph. The Idrissids were dispersed among the Berber tribes where they hid. Hammūd the eponym of the dynasty who claimed Idrisid ancestry was mixed with the Berbers recruited by the vizier Almanzor. Hammūd's two sons, `Alī ben Hammūd and Al-Qāsīm then distinguished themselves at the head of the Berber troops that overthrew the caliph Hichām in favor of his distant nephew Sulayman (1013). The new caliph, who took the title of Al-Musta'īn, was only the puppet of the vizier Almanzor, who held all the powers. Sulayman distributes commands to those who helped him in his seizure of power. `Alī ben Hammūd receives Tangier and northern Morocco. His older brother Al-Qāsīm al-Ma'mūn receives Algeciras. `Alī ben Hammūd Alī ben Hammūd was at first a faithful servant of the caliph, then he revolted and moved to Spain. Taking advantage of the Caliph's weakness, he proclaimed himself independent and seized