Establishment From its founding until the death of Prince Muhsin ibn Qa'id, the Hammadid state encompassed the following cities and regions: :
Qal'at Bani Hammad,
Msila,
Tobna, Mzab,
Ashir,
Tiaret,
Mers El Hadjadj, Balad al-Zawawa,
Magra, Dakama, Balzma, and Souk Hamza. During the reign of Buluggin ibn Muhammad, the city of
Fez in the far west of
Morocco came under Hammadid rule. In 987 and 989,
al-Mansur ibn Buluggin, the
emir of the
Berber Zirid dynasty, appointed his uncle
Hammad ibn Buluggin as governor of Ashir and western
Zirid lands. Hammad subsequently defended the territory against Zenata incursions and was granted additional lands by al-Mansur's successor
Badis ibn Mansur. In 1007 and 1008, forces under Hammad left Ashir and built a new citadel-capital,
Qal'at Bani Hammad (also called ''Al Qal'a of Beni Hammad''), in
M'Sila Province in the
Hodna Mountains; a thriving city sprang up around the fortress. In 1014, Hammad declared his independence from Zirid
suzerainty and switched his spiritual allegiance from the
Shi'a Fatimid caliphs to the
Sunni Abbasid caliphs of
Baghdad. The
Zirids failed to quash the rebellion and recognized Hammadid legitimacy in 1017, in a peace with
al-Mu'izz that was sealed by Hammad's son and successor
Qaid ibn Hammad (). Al-Mu'izz subsequently also broke with the Fatimids and changed his allegiance to the Abbasids. The Fatimid caliph,
al-Mustansir, sent
Bedouin Arab allies, the
Banu Hilal and
Banu Sulaym, into a mass migration and invasion of the lands in what is now Libya, Tunisia, and Algeria, culminating in al-Mu'izz's defeat in 1053 and the subsequent reduction of the Zirids to a small, insignificant territory based in
Mahdia. A common pattern was for Hammadids and Zirids to support "rival coalitions of Arab tribes to fight their
proxy wars." The Hammidid–Zirid rivalry also influenced the choice of which
caliph to recognize; historian Amar S. Baadj writes, "It would appear that the principle which the Hammadids followed in the course of their relations with Baghdad and Cairo was that of opposing the Zirids. Whenever the Zirids recognized one of two rival caliphs, the Hammadids would declare their submission to the other."
Apogee Buluggin ibn Muhammad (r. 1055–1062), a subsequent Hammadid ruler,
invaded northern Morocco in 1062 and briefly took
Fez for a few months, but was then assassinated by his paternal cousin
An-Nasir ibn Alnas, who succeeded him as emir. The Hammadid dynasty peaked during al-Nasir's reign. At the request of local
shaykhs, he was also able to install a loyal governor in Tunis until 1067. In the 11th century, the Hammadids came under increasing pressure from the Banu Hilal, who had settled in the Plains of Constantine and increasingly threatened Qal'at Bani Hammad. Renamed al-Nasiriya to honor the emir, Béjaïa developed into a sophisticated trading city; under al-Nasir and his son and successor
al-Mansur ibn Nasir, large gardens, palaces,
a Great Mosque, and other landmarks were constructed in the town. In Béjaïa Fibonacci was introduced to the Arabic numerical system and computational method; he later introduced this numerical system to Europe. He was also introduced to a book of
algebra written by
al-Khwarizmi.
Decline In 1103–1104 the Hammadids defeated the
Almoravids and took control of Tlemcen. During the reign of al-Mansur's son
Abd al-Aziz ibn Mansur (r. 1105–1121), Béjaïa had about 100,000 people, and the Hammadids consolidated their power in the city. The dynasty suffered a decline after this point; efforts to develop more sea power in the
Mediterranean were foiled by the
Normans, who by the 12th century had
conquered Sicily and had also occupied a number of settlements on the coast of Tunisia and Algeria. However, Abd al-Aziz did expel the Hilalians from
Hodna and capture
Jerba. Yahya tried to establish good relations with the Fatimids in the early 1140s, but ultimately he recognized the Abbasids instead and minted coins in
al-Muqtafi's name. Yahya fled to Constantine, but surrendered several months later, on 10 November 1152 (10 Sha'ban 547 AH). He died in comfortable exile in
Salé, Morocco, in 1163. Abd al-Mu'min
enslaved the women and children of Hammadid loyalists who had fought against him, but did not sack Béjaïa because the city had surrendered. Some 30 years after the collapse of the Hammadids, the dynasty had a brief revival in 1184, when 'Ali ibn Ghaniya—a member of the
Banu Ghaniya branch of the Almoravid dynasty, which had established a
corsair kingdom in the
Balearic Islands—seized control of Béjaïa, recruited a mixed force of "dispossessed Hammadids,
Sanhaja Berbers, and Hilalian tribes" opposed to Almohad rule, and quickly captured Algiers,
Miliana, Ashir, and al Qal'a, with the goal of establishing a new Almoravid polity in the Maghreb. Less than a year later, the Almohad had recaptured all the towns. The Banu Ghaniya did retain, through the end of the Almohad period, some influence in
Tripolitania, southern Tunisia, and the Algerian plains, where Hammadid loyalists numbered among their allies. == Territories ==