# Zirid dynasty

Historical Berber states and dynasties :
Pre-Islamic Berber confederations and dynasties Mauretania 300 BC–44 AD Numidia 202 BC–25 AD Mauro-Roman kingdom 429 AD–578 AD Kingdom of Ouarsenis 430 AD–735 AD Kingdom of Capsus 440 AD–470 AD Kingdom of the Aurès 484 AD –703 AD Kingdom of Altava 578 AD–708 AD :
Post-Islamic kingdoms and caliphates Zirid dynasty 988–1069 Hammadid dynasty 1014–1152 Almoravid dynasty 1050–1147 Khurasanid dynasty 1058–1159 Almohad Caliphate 1121–1269 Hafsid dynasty 1229–1574 Zayyanid dynasty 1235–1557 Marinid Sultanate 1244–1465 Wattasid dynasty 1472–1554 Principality of Debdou 1430–1563 Kingdom of Beni Abbas 1510–1872 Kingdom of Kuku 1515–1638 Kingdom of Tazeroualt 17th - 19th century :
Western dynasties and taifas Taifa of Alpuente 1009–1106 Taifa of Morón 1010–1066 Taifa of Arcos 1011–1145 Taifa of Granada 1012–1114 Taifa of Albarracín 1013–1090 Taifa of Carmona 1013–1150 Taifa of Ronda 1039–1065 :
vte :
Part of a series on the :
History of Tunisia :
PrehistoricPrehistory :
Ancient Carthage12th C.–146 BC 1st Roman (Province)146 BC–435 Vandal435–534 2nd Roman (Byzantine) / Byzantine North Africa534–698 Prefecture534–590 Exarchate590–698 :
Early Islamic Umayyad698–750 Abbasid750–800 Aghlabid800–909 Fatimid909–973 :
Medieval Zirid973–1148 Norman1148–1160 Almohad1160–1229 Hafsid1229–1574 :
Early modern Ottoman 1574–1705 Husainid 1705–1881 :
Modern French Tunisia 1881–1956 Kingdom of Tunisia 1956–1957 Bourguiba rule 1957–1987 Ben Ali coup 1987 Ben Ali rule 1987–2011 Tunisian revolution 2011 Parliamentary system 2011–present :
Africa portal • History portal :
vte :
The Zirid dynasty (Arabic: الزيريون, romanized: az-zīriyyūn), Banu Ziri (Arabic: بنو زيري, romanized: banū zīrī), was a Sanhaja Berber dynasty from what is now Algeria which ruled the central Maghreb from 972 to 1014 and Ifriqiya (eastern Maghreb) from 972 to 1148.
Descendants of Ziri ibn Manad, a military leader of the Fatimid Caliphate and the eponymous founder of the dynasty, the Zirids were emirs who ruled in the name of the Fatimids. The Zirids gradually established their autonomy in Ifriqiya through military conquest until officially breaking with the Fatimids in the mid-11th century. The rule of the Zirid emirs opened the way to a period in North African history where political power was held by Berber dynasties such as the Almoravid dynasty, Almohad Caliphate, Zayyanid dynasty, Marinid Sultanate and Hafsid dynasty.
Under Buluggin ibn Ziri the Zirids extended their control westwards and briefly occupied Fez and much of present-day Morocco after 980, but encountered resistance from the local Zenata Berbers who gave their allegiance to the Caliphate of Cordoba. To the east, Zirid control was extended over Tripolitania after 978 and as far as Ajdabiya (in present-day Libya). One member of the dynastic family, Zawi ibn Ziri, revolted and fled to al-Andalus, eventually founding the Taifa of Granada in 1013, after the collapse of the Caliphate of Cordoba. Another branch of the Zirids, the Hammadids, broke away from the main branch after various internal disputes and took control of the territories of the central Maghreb after 1015. The main branch of the Zirids, also called the Badisides, occupied only Ifriqiya between 1048 and 1148. They were based in Kairouan until 1057, when they moved the capital to Mahdia on the coast. The Zirids of Ifriqiya also intervened in Sicily during the 11th century, as the Kalbids, the dynasty who governed the island on behalf of the Fatimids, fell into disorder.
The Zirids of Granada surrendered to the Almoravids in 1090, but the Badicides and the Hammadids remained independent during this time. Sometime between 1041 and 1051 the Zirid ruler al-Mu'izz ibn Badis renounced the Fatimid Caliphs and recognized the Sunni Muslim Abbasid Caliphate. In retaliation, the Fatimids instigated the migration of the Banu Hilal tribe to the Maghreb, dealing a serious blow to Zirid power in Ifriqiya. In the 12th century, the Hilalian invasions combined with the attacks of the Normans of Sicily along the coast further weakened Zirid power. The last Zirid ruler, al-Hasan, surrendered Mahdia to the Normans in 1148, thus ending independent Zirid rule. The Almohad Caliphate conquered the central Maghreb and Ifriqiya by 1160, ending the Hammadid dynasty in turn and finally unifying the whole of the Maghreb.

## History
### Origins and establishment

The Zirids were Sanhaja Berbers, from the sedentary Talkata tribe, originating from the area of modern Algeria. In the 10th century this tribe served as vassals of the Fatimid Caliphate, an Isma'ili Shi'a state that challenged the authority of the Sunni Abbasid caliphs. The progenitor of the Zirid dynasty, Ziri ibn Manad (r. 935–971) was installed as governor of the central Maghreb (roughly north-eastern Algeria today) on behalf of the Fatimids, guarding the western frontier of the Fatimid Caliphate.
With Fatimid support Ziri founded his own capital and palace at 'Ashir, south-east of Algiers, in 936. He proved his worth as a key ally in 945, during the Kharijite rebellion of Abu Yazid, when he helped break Abu Yazid's siege of the Fatimid capital, Mahdia. After playing this valuable role, he expanded 'Ashir with a new palace circa 947. In 959 he aided Jawhar al-Siqili on a Fatimid military expedition which successfully conquered Fez and Sijilmasa in present-day Morocco. On their return home to the Fatimid capital they paraded the emir of Fez and the "Caliph" Ibn Wasul of Sijilmasa in cages in a humiliating manner. After this success, Ziri was also given Tahart to govern on behalf of the Fatimids. He was eventually killed in battle against the Zanata in 971.
When the Fatimids moved their capital to Egypt in 972, Ziri's son Buluggin ibn Ziri (r. 971–984) was appointed viceroy of Ifriqiya, spawning a dynasty whose rulers held the title of amir. Buluggin's position was confirmed on 2 October 972 at Sardaniya, a place outside Kairouan where the Fatimid caliph al-Mu'izz was preparing for his departure to Egypt. On 20 December 972, Buluggin took up residence in Sabra al-Mansuriyya, the Fatimid caliph's former palace-city just outside the walls of Kairouan, where his successors continued to reside until the mid-11th century. Buluggin spent much of his time in the west, however. From 974 onward he entrusted the governance of Ifriqiya to Abd Allah ibn Muhammad al-Katib, a secretary with whom he replaced the Fatimid-appointed secretary, Ziyadat Allah. In 974 or 977–978 (364 or 367 AH), he founded another capital and palace complex in Ashir, next to his father's foundation, which he favoured over Kairouan. Ashir continued to be the capital of the Zirids in the central Maghreb, while Kairouan was the capital of Ifriqiya.
Buluggin soon led a new expedition west and by 980 he had conquered Fez and most of the western Maghreb (present-day Morocco), which had previously been retaken by the Umayyads of Cordoba in 973. He also led a successful expedition to Barghawata territory, from which he brought back a large number of slaves to Ifriqiya. In 978 the Fatimids also granted Buluggin overlordship of Tripolitania (in present-day Libya), allowing him to appoint his own governor in Tripoli. In 984 Buluggin died in Sijilmasa from an illness and his successor decided to abandon Morocco in 985.

### Buluggin's successors and the first divisions

After Buluggin's death, he was succeeded by his son Al-Mansur ibn Buluggin (r. 984–996). After his departure to the west in 979, Bulugin had not returned to Kairouan and during this time his appointee, Abd Allah ibn Muhammad al-Katib, had amassed considerable power and influence in Ifriqiya. As a result, al-Mansur became involved in a confrontation with Abd Allah starting in 987. Later Zirid sources portray Abd Allah as a rebel who was aided by the Fatimid Caliphs, because the latter now preferred him over al-Mansur and wished to impose a new arrangement in Ifriqiya. In the end, al-Mansur ordered the successful assassination of Abd Allah and his son. In 989–990 he also suppressed a revolt by the Kutama, the traditional source of the Fatimid army, under the leadership of a pretender named Abu'l-Faraj. Following these challenges, al-Mansur was finally able to reunify the Zirid realm, but he was obliged to move his principal residence from 'Ashir to al-Mansuriyya (Kairouan) in 991, leaving his brother Yattufat to govern 'Ashir.
With al-Mansur's succession, the rule of the Zirid was now being passed on through the son of Buluggin and his descendants. This alienated the other sons of Ziri ibn Manad, who now found themselves excluded from power. In 999 many of these brothers launched a rebellion in 'Ashir against Badis ibn al-Mansur (r. 996–1016), Buluggin's grandson, marking the first serious break in the unity of the Zirids. The rebels were defeated in battle by Hammad ibn Buluggin, Badis' uncle, and most of the brothers were killed. The only remaining brother of stature, Zawi ibn Ziri, led the remaining rebels westwards and sought new opportunity in al-Andalus under the Umayyads Caliphs of Cordoba, the former enemies of the Fatimids and Zirids. He and his followers eventually founded an independent kingdom in al-Andalus, the Taifa of Granada, in 1013.
After 1001 Tripolitania broke away under the leadership of Fulful ibn Sa'id ibn Khazrun, a Maghrawa leader who founded the Banu Khazrun dynasty, which endured until 1147. Fulful fought a protracted war against Badis ibn al-Mansur and sought outside help from the Fatimids and even from the Umayyads of Cordoba, but after his death in 1009 the Zirids were able to retake Tripoli for a time. The region nonetheless remained effectively under control of the Banu Khazrun, who fluctuated between practical autonomy and full independence, often playing the Fatimids and the Zirids against each other. The Zirids finally lost Tripoli to them in 1022.
Badis appointed Hammad ibn Buluggin as governor of 'Ashir and the western Zirid territories in 997. He gave Hammad a great deal of autonomy, allowing him to campaign against the Zanata and control any new territories he conquered. Hammad constructed his own capital, the Qal'at Bani Hammad, in 1008, and in 1015 he rebelled against Badis and declared himself independent altogether, while also recognizing the Abbasids instead of the Fatimids as caliphs. Badis besieged Hammad's capital and nearly subdued him, but died in 1016 shortly before this could be accomplished. His son and successor, al-Mu'izz ibn Badis (r. 1016–1062), defeated Hammad in 1017, which forced the negotiation of a peace agreement between them. Hammad resumed his recognition of the Fatimids as caliphs but remained independent, forging a new Hammadid state which controlled a large part of present-day Algeria thereafter. Qal'at Bani Hammad was retained as the Hammadid capital, while 'Ashir became its second city.

### Apogee in Ifriqiya

The Zirid period of Ifriqiya is considered a high point in its history, with agriculture, industry, trade and learning, both religious and secular, all flourishing, especially in their capital, Qayrawan (Kairouan). The early reign of al-Mu'izz ibn Badis (r. 1016–1062) was particularly prosperous and marked the height of their power in Ifriqiya. In the eleventh century, when the question of Berber origin became a concern, the dynasty of al-Mu'izz started, as part of the Zirids' propaganda, to emphasize its supposed links to the Himyarite kings as a title to nobility, a theme that was taken the by court historians of the period. Management of the area by later Zirid rulers was neglectful as the agricultural economy declined, prompting an increase in banditry among the rural population. The relationship between the Zirids and their Fatimid overlords varied - 20,000 Shiites were killed in the 1016 Ismaili massacre in Ifriqiya, and the Fatimids encouraged the defection of Tripolitania from the Zirids, but nevertheless the relationship remained close. In the 1040s, the Zirids broke away completely by adopting Sunni Islam and recognizing the Abbasids of Baghdad as rightful Caliphs, a move which was popular with the urban Arabs of Kairouan.
In Sicily the Kalbids continued to govern on behalf of the Fatimids but the island descended into political disarray during the 11th century, inciting the Zirids to intervene on the island. In 1025 (or 1021), al-Mu'izz ibn Badis sent a fleet of 400 ships to the island in response to the Byzantines reconquering Calabria (in southern Italy) from the Muslims, but the fleet was lost in a powerful storm off the coast of Pantelleria. In 1036, the Muslim population of the island request aid from al-Mu'izz to overthrow the Kalbid emir Aḥmad ibn Yūsuf al-Akḥal [it], whose rule they considered flawed and unjust. The request also contained a pledge to recognize al-Mu'izz as their ruler. Al-Mu'izz, eager to expand his influence after the fragmentation of Zirid North Africa, accepted and sent his son, 'Abdallah, to the island with a large army. Al-Akhal, who had been in negotiations with the Byzantines, requested help from them. A Byzantine army intervened and defeated the Zirid army on the island, but it then withdrew to Calabria, allowing 'Abdallah to finish off al-Akhal. Al-Akhal was besieged in Palermo and killed in 1038. 'Abdallah was subsequently forced to withdraw from the island, either due to the ever-divided Sicilians turning against him or due to another Byzantine invasion in 1038, led by George Maniakes. Another Kalbid amir, al-Hasan al-Samsam, was elected to govern Sicily, but Muslim rule there disintegrated into various petty factions leading up to the Norman conquest of the island in the second half of the 11th century.

### Hilalian invasions and withdrawal to Mahdia

The Zirids renounced the Fatimids and recognized the Abbasid Caliphs in 1048-49, or sometime between 1041 and 1051. The recognition of the Abbasids was nominal, as the Abbasids themselves were in political decline and could not impose direct authority in the region. In retaliation against the Zirids, the Fatimids sent the Arab tribes of the Banu Hilal and the Banu Sulaym to the Maghreb. The Banu Sulaym settled first in Cyrenaica, but the Banu Hilal continued towards Ifriqiya. The Zirids attempted to stop their advance towards Ifriqiya, they sent 30,000 Sanhaja cavalry to meet the 3,000 Arab cavalry of Banu Hilal in the Battle of Haydaran of 14 April 1052. Nevertheless, the Zirids were decisively defeated and were forced to retreat, opening the road to Kairouan for the Hilalian Arab cavalry. The resulting anarchy devastated the previously flourishing agriculture, and the coastal towns assumed a new importance as conduits for maritime trade and bases for piracy against Christian shipping, as well as being the last holdout of the Zirids. The Banu Hilal invasions eventually forced al-Mu'izz ibn Badis to abandon Kairouan in 1057 and move his capital to Mahdia, while the Banu Hilal largely roamed and pillaged the interior of the former Zirid territories.
As a result of the Zirid withdrawal, various local principalities emerged in different areas. In Tunis, the shaykhs of the city elected Abd al-Haqq ibn Abd al-Aziz ibn Khurasan (r. 1059-1095) as local ruler. He founded the local Banu Khurasan dynasty that governed the city thereafter, alternately recognizing the Hammadids or the Zirids as overlords depending on the circumstances. In Qabis (Gabès), the Zirid governor, al-Mu'izz ibn Muhammad ibn Walmiya remained loyal until 1062 when, outraged by the expulsion of his two brothers from Mahdia by al-Mu'izz ibn Badis, he declared his independence and placed himself under the protection of Mu'nis ibn Yahya, a chief of Banu Hilal. Sfaqus (Sfax) was declared independent by the Zirid governor, Mansur al-Barghawati, who was murdered and succeeded by his cousin Hammu ibn Malil al-Barghawati.
Al-Mui'zz ibn Badis was succeeded by his son, Tamim ibn al-Mu'izz (r. 1062-1108), who spent much of his reign attempting to restore Zirid power in the region. In 1063 he repelled a siege of Mahdia by the independent ruler of Sfax while also capturing the important port of Sus (Sousse). Meanwhile, the Hammadid ruler al-Nasir ibn 'Alannas (r. 1062-1088) began to intervene in Ifriqiya around this time, having his sovereignty recognized in Sfax, Tunis, and Kairouan. Tamim organized a coalition with some of the Banu Hilal and Banu Sulaym tribes and succeeded in inflicting a heavy defeat on al-Nasir at the Battle of Sabiba in 1065. The war between the Zirids and Hammadids continued until 1077, when a truce was negotiated, sealed by a marriage between Tamim and one of al-Nasir's daughters. In 1074 Tamim sent a naval expedition to Calabria where they ravaged the Italian coasts, plundered Nicotera and enslaved many of its inhabitants. The next year (1075) another Zirid raid resulted in the capture of Mazara in Sicily; however, the Zirid emir rethought his involvement in Sicily and decided to withdraw, abandoning what they had briefly held. In 1087, the Zirid capital, Mahdia, was sacked by the Pisans. According to Ettinghausen, Grabar, and Jenkins-Madina, the Pisa Griffin is believed to have been part of the spoils taken during the sack. In 1083 Mahdia was besieged by a chief of the Banu Hilal, Malik ibn 'Alawi. Unable to take the city, Malik instead turned to Kairouan and captured that city, but Tamim marched out with his entire army and defeated the Banu Hilal forces, at which point he also brought Kairouan back under Zirid control. He went on to capture Gabès in 1097 and Sfax in 1100. Gabès, however, soon declared itself independent again under the leadership of the Banu Jami', a family from the Riyahi branch of the Banu Hilal.
Tamim's son and successor, Yahya ibn Tamim (r. 1108-1116), formally recognized the Fatimid caliphs again and received an emissary from Cairo in 1111. He captured an important fortress near Carthage called Iqlibiya and his fleet launched raids against Sardinia and Genoa, bringing back many captives. He was assassinated in 1116 and succeeded by his son, 'Ali ibn Yahya (r. 1116-1121). 'Ali continued to recognize the Fatimids, receiving another embassy from Cairo in 1118. He imposed his authority on Tunis, but failed to recapture Gabès from its local ruler, Rafi' ibn Jami', whose counterattack he then had to repel from Mahdia. He was succeeded by his son al-Hasan in 1121, the last Zirid ruler.

### End of Zirid rule

During the 1130s and 1140s the Normans of Sicily began to capture cities and islands along the coast of Ifriqiya. Jerba was captured in 1135 and Tripoli was captured in 1146. In 1148, the Normans captured Sfax, Gabès, and Mahdia. In Mahdia, the population was weakened by years of famine and the bulk of the Zirid army was away on another campaign when the Norman fleet, commanded by George of Antioch, arrived off the coast. Al-Hasan decided to abandon the city, leaving it to be occupied, which effectively ended the Zirid dynasty's rule. Al-Hasan fled to the citadel of al-Mu'allaqa near Carthage and stayed there for a several months. He planned to flee to the Fatimid court in Egypt but the Norman fleet blocked his way, so instead he headed west, making for the Almohad court of 'Abd al-Mu'min in Marrakesh. He obtained permission from Yahya ibn al-'Aziz, the Hammadid ruler, to cross his territory, but after entering Hammadid territory he was detained and placed under house arrest in Algiers. When 'Abd al-Mu'min captured Algiers in 1151, he freed al-Hasan, who accompanied him back to Marrakesh. Later, when 'Abd al-Mu'min conquered Mahdia in 1160, placing all of Ifriqiya under Almohad rule, al-Hasan was with him. 'Abd al-Mu'min appointed him governor of Mahdia, where he remained, residing in the suburb of Zawila, until 'Abd al-Mu'min's death in 1163. The new Almohad caliph, Abu Ya'qub Yusuf, subsequently ordered him to come back to Marrakesh, but al-Hasan died along the way in Tamasna in 1167.

## Economy

The Zirid period was a time of great economic prosperity. The departure of the Fatimids to Cairo, far from ending this prosperity, saw its amplification under the Zirid and Hammadid rulers. Referring to the government of the Zirid emir al-Mu'izz ibn Badis, the historian Ibn Khaldun reports: "It [has] never [been] seen by the Berbers of that country a kingdom more vast and more flourishing than his own." The northern regions produced wheat in large quantities, while the region of Sfax was a major hub of olive production and the cultivation of the date was an important part of the local economy in Biskra. Other crops such as sugar cane, saffron, cotton, sorghum, millet and chickpea were grown. The breeding of horses and sheep flourished and fishing provided plentiful food. The Mediterranean was also an important part of the economy, even though it was, for a time, abandoned after the departure of the Fatimids, when the priority of the Zirid Emirs turned to territorial and internal conflicts. Their maritime policy enabled them to establish trade links, in particular for the importation of the timber necessary for their fleet, and enabled them to begin an alliance and very close ties with the Kalbid Emirs of Sicily. They did, however, face blockade attempts by the Venetians and Normans, who sought to reduce their wood supply and thus their dominance in the region.
The Arab chronicler Ibn Hawqal visited and described the city of Algiers in the Zirid era: "The city of Algiers is built on a gulf and surrounded by a wall. It contains a large number of bazaars and a few sources of good water near the sea. It is from these sources that the inhabitants draw the water they drink. In the outbuildings of this town are very extensive countryside and mountains inhabited by several tribes of the Berbers. The chief wealth of the inhabitants consists of herds of cattle and sheep grazing in the mountains. Algiers supplies so much honey that it forms an export object, and the quantity of butter, figs and other commodities is so great that it is exported to Kairouan and elsewhere".

## Culture
### Literature

Abd al-Aziz ibn Shaddad was a Zirid chronicler and prince. He wrote Kitab al-Jam' wa 'l-bayan fi akhbar al-Qayrawan (كتاب الجمع والبيان في أخبار القيروان) about the history of Qayrawan. Al-Mu'izz ibn Badis, the Zirid ruler, was also himself an author and wrote an important treatise on the arts of the book, covering subjects such as calligraphy, bookbinding, and illumination.

### Architecture

The Zirid dynasty was responsible for various constructions and renovations throughout the Maghreb. Zirid and Hammadid architecture in North Africa was closely linked to Fatimid architecture, but also influenced Norman architecture in Sicily. The Zirid palace at 'Ashir (near present-day Kef Lakhdar), built in 934 by Ziri ibn Manad (who served the Fatimids), is one of the oldest palaces in the Maghreb to have been discovered and excavated. As independent rulers, however, the Zirids of Ifriqiya seem to have built few structures on a grand scale and there are few surviving major monuments from this period. They reportedly built a new palace at al-Mansuriyya, the former Fatimid capital near Kairouan, but it has not been uncovered by modern archeologists, except for some fragments of carved stucco decoration. At the Zaytuna Mosque in Tunis an elegantly-designed ribbed dome, called the Qubbat al-Bahw, was added to the entrance of the prayer hall in 991 and is attributed to the patronage of Al-Mansur ibn Buluggin. The Great Mosque of Kairouan was restored by Al-Mu'izz ibn Badis in the 11th century. From this restoration some brightly-painted wooden ceilings have survived, featuring arabesques of scrolling vegetal motifs. Under Al-Mu’izz the Zirids also built the Sidi Abu Marwan mosque in Annaba. A major remodeling of the Great Mosque of Sfax, including the construction of a new minaret and an unusually decorated exterior façade, has also been attributed to the Zirid period (probably 10th century) by Georges Marçais and Lucien Golvin.
The Hammadids, for their part, built an entirely new fortified capital at Qal'at Bani Hammad, founded in 1007. Although abandoned and destroyed in the 12th century, the city has been studied by modern archeologists and is one of the best-preserved medieval Islamic capitals in the world. The Zirid branch in Granada was also responsible for turning it into one of the major cities of al-Andalus. Among the surviving remains of the Zirid period in Granada today are a section of its original city walls, an extensive system of cisterns on the Albaicín hill, and the former minaret of a mosque (now part of the Church of San José).

### Art

The Zirids were also patrons of the arts. Important examples of woodwork commissioned for mosques have survived from this period. Buluggin ibn Ziri commissioned the production of a minbar for the Mosque of the Andalusians in Fez. The minbar, whose original fragments are now preserved in a museum, bears an inscription that dates it to the year 980, around the time of Buluggin's military expedition to this region.$^{:249}$ The wooden maqsura in the Great Mosque of Kairouan is believed to date from al-Mu'izz ibn Badis's restoration of the building. It is the oldest maqsura in the Islamic world to be preserved in situ and was commissioned by al-Mu῾izz ibn Badis in the first half of the 11th century (though later restored). It is one of the most significant works of art from the Zirid period, notable for its elaborately carved woodwork featuring arabesque motifs and a Kufic inscription dedicated to al-Mu'izz.
Zirid art is also known for its decorated manuscripts. This art form flourished in Kairouan under Zirid rule and manuscripts from this city were exported throughout the Islamic world. One important example is the so-called "Nurse's Qur'an" (Arabic: مصحف الحاضنة, romanized: Mushaf al-Hadina), a Qur'an manuscript copied in 1020 by 'Ali ibn Ahmad al-Warraq for Fatima, the nursemaid of al-Mu'izz ibn Badis. It is one of many Qur'an manuscripts that were donated to the Great Mosque of Kairouan and it is one of the most important surviving Islamic manuscripts commissioned by a female patron in North Africa. Its folios are now kept in several museums and collections around the world, including the Metropolitan Museum of Art, the Bardo Museum, and the David Collection.
Emblem
According to Historian Hady Roger Idris, the colour of the flags is unknown, but he stressed : "The name of the Fatimids appeared on the flags (a'làm), pennants (rayât), standards (bunûd) and on the edging of ceremonial clothing. Flags and robes of honour do not appear to have been made in Ifrïqiya; they were gifts from the caliph." He added: "Let us recall that the official livery of the Zirids, vassals of the Fatimids, had to be white since we have seen that they adopted black, the colour of the Abbasids, after having broken with Cairo." Michael Brett points out that the Zirid prince Al-Mu'izz ibn Badis renounced his alleigence to the Fatimids by changing his colors from Fatimid white to Abbasid black.

## List of Zirid rulers

The following list includes the Zirid rulers who ruled in the Maghreb:
* Ziri ibn Manad, d. 971 CE (as Fatimid governor)
* Buluggin ibn Ziri, 972–984 (as viceroy of the Fatimids in Ifriqiya and the Maghreb)
* al-Mansur ibn Buluggin, 984–996
* Badis ibn al-Mansur, 996–1016
After 1015, the Hammadid branch ruled in the central Maghreb while the descendants of Badis ibn al-Mansur continued to rule in Ifriqiya:
* al-Mu'izz ibn Badis, 1016–1062
* Tamim ibn al-Mu'izz, 1062–1108
* Yahya ibn Tamim, 1108–1116
* Ali ibn Yahya, 1116–1121
* al-Hasan ibn Ali, 1121–1148
Pedigree of Zirid dynasty and its offshoots :
| Zirid State | Zirid State | Zirid State | Zirid State | Zirid State | Zirid State | | | | | | | | | | | | | | | | | | | | | | | | | | |
| Zirid State | Zirid State | Zirid State | Zirid State | Zirid State | Zirid State | | | | | | | | | | | | | | | | | | | | | | | | | | | Ziri ibn Manad d. 971 | Ziri ibn Manad d. 971 | Ziri ibn Manad d. 971 | Ziri ibn Manad d. 971 | Ziri ibn Manad d. 971 | Ziri ibn Manad d. 971 | | | | | | | | | | | | | | | | | | | Granada Taifa | Granada Taifa | Granada Taifa | Granada Taifa | Granada Taifa | Granada Taifa |
| Buluggin ibn Ziri 972-984 | Buluggin ibn Ziri 972-984 | Buluggin ibn Ziri 972-984 | Buluggin ibn Ziri 972-984 | Buluggin ibn Ziri 972-984 | Buluggin ibn Ziri 972-984 | | | | | | | | | Hammadid dynasty | Hammadid dynasty | Hammadid dynasty | Hammadid dynasty | Hammadid dynasty | Hammadid dynasty | | | | | | | | | | | | |
| Buluggin ibn Ziri 972-984 | Buluggin ibn Ziri 972-984 | Buluggin ibn Ziri 972-984 | Buluggin ibn Ziri 972-984 | Buluggin ibn Ziri 972-984 | Buluggin ibn Ziri 972-984 | | | | | | | | | Hammadid dynasty | Hammadid dynasty | Hammadid dynasty | Hammadid dynasty | Hammadid dynasty | Hammadid dynasty | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Maksen ibn Ziri | Maksen ibn Ziri | Maksen ibn Ziri | Maksen ibn Ziri | Maksen ibn Ziri | Maksen ibn Ziri | Zawi ibn Ziri 1013-1019/20 | Zawi ibn Ziri 1013-1019/20 | Zawi ibn Ziri 1013-1019/20 | Zawi ibn Ziri 1013-1019/20 | Zawi ibn Ziri 1013-1019/20 | Zawi ibn Ziri 1013-1019/20 |
| Al-Mansur ibn Buluggin 984-996 | Al-Mansur ibn Buluggin 984-996 | Al-Mansur ibn Buluggin 984-996 | Al-Mansur ibn Buluggin 984-996 | Al-Mansur ibn Buluggin 984-996 | Al-Mansur ibn Buluggin 984-996 | | | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | Hammad ibn Buluggin 1015-1028 | Hammad ibn Buluggin 1015-1028 | Hammad ibn Buluggin 1015-1028 | Hammad ibn Buluggin 1015-1028 | Hammad ibn Buluggin 1015-1028 | Hammad ibn Buluggin 1015-1028 | | | | | | | Habbus al-Muzaffar 1019/20-1038 | Habbus al-Muzaffar 1019/20-1038 | Habbus al-Muzaffar 1019/20-1038 | Habbus al-Muzaffar 1019/20-1038 | Habbus al-Muzaffar 1019/20-1038 | Habbus al-Muzaffar 1019/20-1038 |
| | | | | | | | | | | | | | | Hammad ibn Buluggin 1015-1028 | Hammad ibn Buluggin 1015-1028 | Hammad ibn Buluggin 1015-1028 | Hammad ibn Buluggin 1015-1028 | Hammad ibn Buluggin 1015-1028 | Hammad ibn Buluggin 1015-1028 | | | | | | | Habbus al-Muzaffar 1019/20-1038 | Habbus al-Muzaffar 1019/20-1038 | Habbus al-Muzaffar 1019/20-1038 | Habbus al-Muzaffar 1019/20-1038 | Habbus al-Muzaffar 1019/20-1038 | Habbus al-Muzaffar 1019/20-1038 | Badis ibn al-Mansur 996-1016 | Badis ibn al-Mansur 996-1016 | Badis ibn al-Mansur 996-1016 | Badis ibn al-Mansur 996-1016 | Badis ibn al-Mansur 996-1016 | Badis ibn al-Mansur 996-1016 | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | Qaid ibn Hammad 1028-1054 | Qaid ibn Hammad 1028-1054 | Qaid ibn Hammad 1028-1054 | Qaid ibn Hammad 1028-1054 | Qaid ibn Hammad 1028-1054 | Qaid ibn Hammad 1028-1054 | Muhammad ibn Hammad | Muhammad ibn Hammad | Muhammad ibn Hammad | Muhammad ibn Hammad | Muhammad ibn Hammad | Muhammad ibn Hammad | Alnas ibn Hammad | Alnas ibn Hammad | Alnas ibn Hammad | Alnas ibn Hammad | Alnas ibn Hammad | Alnas ibn Hammad | Badis ibn Habbus 1038-1073 | Badis ibn Habbus 1038-1073 | Badis ibn Habbus 1038-1073 | Badis ibn Habbus 1038-1073 | Badis ibn Habbus 1038-1073 | Badis ibn Habbus 1038-1073 |
| | | | | | | | | Qaid ibn Hammad 1028-1054 | Qaid ibn Hammad 1028-1054 | Qaid ibn Hammad 1028-1054 | Qaid ibn Hammad 1028-1054 | Qaid ibn Hammad 1028-1054 | Qaid ibn Hammad 1028-1054 | Muhammad ibn Hammad | Muhammad ibn Hammad | Muhammad ibn Hammad | Muhammad ibn Hammad | Muhammad ibn Hammad | Muhammad ibn Hammad | Alnas ibn Hammad | Alnas ibn Hammad | Alnas ibn Hammad | Alnas ibn Hammad | Alnas ibn Hammad | Alnas ibn Hammad | Badis ibn Habbus 1038-1073 | Badis ibn Habbus 1038-1073 | Badis ibn Habbus 1038-1073 | Badis ibn Habbus 1038-1073 | Badis ibn Habbus 1038-1073 | Badis ibn Habbus 1038-1073 | Al-Mu'izz ibn Badis 1016-1062 | Al-Mu'izz ibn Badis 1016-1062 | Al-Mu'izz ibn Badis 1016-1062 | Al-Mu'izz ibn Badis 1016-1062 | Al-Mu'izz ibn Badis 1016-1062 | Al-Mu'izz ibn Badis 1016-1062 | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | Muhsin ibn Qaid 1054-1055 | Muhsin ibn Qaid 1054-1055 | Muhsin ibn Qaid 1054-1055 | Muhsin ibn Qaid 1054-1055 | Muhsin ibn Qaid 1054-1055 | Muhsin ibn Qaid 1054-1055 | Buluggin ibn Muhammad 1055-1062 | Buluggin ibn Muhammad 1055-1062 | Buluggin ibn Muhammad 1055-1062 | Buluggin ibn Muhammad 1055-1062 | Buluggin ibn Muhammad 1055-1062 | Buluggin ibn Muhammad 1055-1062 | Nasir ibn Alnas 1062-1088 | Nasir ibn Alnas 1062-1088 | Nasir ibn Alnas 1062-1088 | Nasir ibn Alnas 1062-1088 | Nasir ibn Alnas 1062-1088 | Nasir ibn Alnas 1062-1088 | Buluggin ibn Badis | Buluggin ibn Badis | Buluggin ibn Badis | Buluggin ibn Badis | Buluggin ibn Badis | Buluggin ibn Badis | | | | | | Al-Mu'izz ibn Badis 1016-1062 | Al-Mu'izz ibn Badis 1016-1062 | Al-Mu'izz ibn Badis 1016-1062 | Al-Mu'izz ibn Badis 1016-1062 | Al-Mu'izz ibn Badis 1016-1062 | Al-Mu'izz ibn Badis 1016-1062 | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | Muhsin ibn Qaid 1054-1055 | Muhsin ibn Qaid 1054-1055 | Muhsin ibn Qaid 1054-1055 | Muhsin ibn Qaid 1054-1055 | Muhsin ibn Qaid 1054-1055 | Muhsin ibn Qaid 1054-1055 | Buluggin ibn Muhammad 1055-1062 | Buluggin ibn Muhammad 1055-1062 | Buluggin ibn Muhammad 1055-1062 | Buluggin ibn Muhammad 1055-1062 | Buluggin ibn Muhammad 1055-1062 | Buluggin ibn Muhammad 1055-1062 | Nasir ibn Alnas 1062-1088 | Nasir ibn Alnas 1062-1088 | Nasir ibn Alnas 1062-1088 | Nasir ibn Alnas 1062-1088 | Nasir ibn Alnas 1062-1088 | Nasir ibn Alnas 1062-1088 | Buluggin ibn Badis | Buluggin ibn Badis | Buluggin ibn Badis | Buluggin ibn Badis | Buluggin ibn Badis | Buluggin ibn Badis | Tamim ibn al-Mu'izz 1062-1108 | Tamim ibn al-Mu'izz 1062-1108 | Tamim ibn al-Mu'izz 1062-1108 | Tamim ibn al-Mu'izz 1062-1108 | Tamim ibn al-Mu'izz 1062-1108 | Tamim ibn al-Mu'izz 1062-1108 | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | Al-Mansur ibn al-Nasir 1088-1105 | Al-Mansur ibn al-Nasir 1088-1105 | Al-Mansur ibn al-Nasir 1088-1105 | Al-Mansur ibn al-Nasir 1088-1105 | Al-Mansur ibn al-Nasir 1088-1105 | Al-Mansur ibn al-Nasir 1088-1105 | | | | | | | Abdallah ibn Buluggin 1073-1090 | Abdallah ibn Buluggin 1073-1090 | Abdallah ibn Buluggin 1073-1090 | Abdallah ibn Buluggin 1073-1090 | Abdallah ibn Buluggin 1073-1090 | Abdallah ibn Buluggin 1073-1090 |
| | | | | | | | | | | | | | | Al-Mansur ibn al-Nasir 1088-1105 | Al-Mansur ibn al-Nasir 1088-1105 | Al-Mansur ibn al-Nasir 1088-1105 | Al-Mansur ibn al-Nasir 1088-1105 | Al-Mansur ibn al-Nasir 1088-1105 | Al-Mansur ibn al-Nasir 1088-1105 | | | | | | | Abdallah ibn Buluggin 1073-1090 | Abdallah ibn Buluggin 1073-1090 | Abdallah ibn Buluggin 1073-1090 | Abdallah ibn Buluggin 1073-1090 | Abdallah ibn Buluggin 1073-1090 | Abdallah ibn Buluggin 1073-1090 | Yahya ibn Tamim 1108-1116 | Yahya ibn Tamim 1108-1116 | Yahya ibn Tamim 1108-1116 | Yahya ibn Tamim 1108-1116 | Yahya ibn Tamim 1108-1116 | Yahya ibn Tamim 1108-1116 | | | | | | | | | | | | | | | | | | | | | | | | |
| | | | | | | | | | | | | | | Badis ibn Mansur 1105 | Badis ibn Mansur 1105 | Badis ibn Mansur 1105 | Badis ibn Mansur 1105 | Badis ibn Mansur 1105 | Badis ibn Mansur 1105 | Abd al-Aziz ibn Mansur 1105-1121 | Abd al-Aziz ibn Mansur 1105-1121 | Abd al-Aziz ibn Mansur 1105-1121 | Abd al-Aziz ibn Mansur 1105-1121 | Abd al-Aziz ibn Mansur 1105-1121 | Abd al-Aziz ibn Mansur 1105-1121 | | | | | | | | |
| Ali ibn Yahya 1116-1121 | Ali ibn Yahya 1116-1121 | Ali ibn Yahya 1116-1121 | Ali ibn Yahya 1116-1121 | Ali ibn Yahya 1116-1121 | Ali ibn Yahya 1116-1121 | Abu al-Futuh ibn Yahya | Abu al-Futuh ibn Yahya | Abu al-Futuh ibn Yahya | Abu al-Futuh ibn Yahya | Abu al-Futuh ibn Yahya | Abu al-Futuh ibn Yahya | | | | | | | | | | | | | | | | | | | | |
| Ali ibn Yahya 1116-1121 | Ali ibn Yahya 1116-1121 | Ali ibn Yahya 1116-1121 | Ali ibn Yahya 1116-1121 | Ali ibn Yahya 1116-1121 | Ali ibn Yahya 1116-1121 | Abu al-Futuh ibn Yahya | Abu al-Futuh ibn Yahya | Abu al-Futuh ibn Yahya | Abu al-Futuh ibn Yahya | Abu al-Futuh ibn Yahya | Abu al-Futuh ibn Yahya | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Yahya ibn Abd al-Aziz 1121-1152 | Yahya ibn Abd al-Aziz 1121-1152 | Yahya ibn Abd al-Aziz 1121-1152 | Yahya ibn Abd al-Aziz 1121-1152 | Yahya ibn Abd al-Aziz 1121-1152 | Yahya ibn Abd al-Aziz 1121-1152 | | | | | | | | | | | | | |
| Abu'l-Hasan al-Hasan ibn Ali 1121-1148 | Abu'l-Hasan al-Hasan ibn Ali 1121-1148 | Abu'l-Hasan al-Hasan ibn Ali 1121-1148 | Abu'l-Hasan al-Hasan ibn Ali 1121-1148 | Abu'l-Hasan al-Hasan ibn Ali 1121-1148 | Abu'l-Hasan al-Hasan ibn Ali 1121-1148 | Abbas ibn Abi al-Futuh Fatimid vizier 1153-1154 | Abbas ibn Abi al-Futuh Fatimid vizier 1153-1154 | Abbas ibn Abi al-Futuh Fatimid vizier 1153-1154 | Abbas ibn Abi al-Futuh Fatimid vizier 1153-1154 | Abbas ibn Abi al-Futuh Fatimid vizier 1153-1154 | Abbas ibn Abi al-Futuh Fatimid vizier 1153-1154 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Yahya ibn Abd al-Aziz 1121-1152 | Yahya ibn Abd al-Aziz 1121-1152 | Yahya ibn Abd al-Aziz 1121-1152 | Yahya ibn Abd al-Aziz 1121-1152 | Yahya ibn Abd al-Aziz 1121-1152 | Yahya ibn Abd al-Aziz 1121-1152 | | | | | | | | | | | | |
| | | | | | | Nasr ibn Abbas | Nasr ibn Abbas | Nasr ibn Abbas | Nasr ibn Abbas | Nasr ibn Abbas | Nasr ibn Abbas | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |

## Offshoots of the Zirid dynasty
### Zirids of Granada

After the rebellion of Buluggin's brothers failed in 999, Zawi ibn Ziri sought to move to al-Andalus, which was under Umayyad control. The hajib of Caliph Hisham II (r. 976–1009) and de facto ruler of the Caliphate of Córdoba at the time, Ibn Abi ʿAmir al-Mansur (also known as Almanzor), initially refused to allow Zawi's immigration to al-Andalus, believing his reputation as a troublemaker. However, his son and successor, 'Abd al-Malik al-Muẓaffar (r. 1002–1008), seeking able military commanders, granted Zawi and his followers permission to come to Cordoba, where they subsequently became an important part of al-Muzaffar's army. The Caliphate of Córdoba fragmented after 1008, a period known as the fitna of al-Andalus. Zawi initially played a role, along with other Berber factions, in the siege of Córdoba between 1010 and 1013. By the end of the siege they succeeded in installing their own puppet caliph in Córdoba, Sulayman al-Musta'in, but by this point Zawi and other factions were seeking political fortunes elsewhere in al-Andalus. The new caliph granted Zawi and his faction the province of Ilbira (Elvira) to settle in 1013. After moving the capital from Madinat Ilbira to the hilltop settlement of Gharnāṭa (Granada) that year, Zawi founded the Taifa kingdom of Granada. Arab sources consider him to be the founder of the present-day city of Granada, a designation also repeated by some modern historians like Helen Rodgers, Stephen Cavendish, and Brian Catlos.
In 1018 the Umayyad pretender al-Murtada attempted to conquer Granada but was soundly defeated by the Zirids. In 1019 or 1020 Zawi left al-Andalus and returned to Ifriqiya, resuming his ambitions within the Zirid state there. His fate is not known for certain: according to Ibn Hayyan he died of the plague years later, while Abdallah ibn Buluggin's memoirs claim he was poisoned not long after arriving in North Africa, but neither gives the date of his death. In Granada, Zawi's nephew Habbus ibn Maksan was invited by the qadi of the city, Abu 'Abdallah ibn Abi Zamanin, to take control of the new kingdom instead of one Zawi's sons. Under the reign of Habus (1019–1038), the Taifa of Granada was consolidated and evolved into one of the most important political forces of al-Andalus during this period. During the reign of Badis Ibn Habus the Zirids of Granada defeated an attack by the Taifa of Almeria in 1038, annexing much of that kingdom's territory and turning Almeria into a vassal state for several years, before they defeated the Abbadids of Seville in battle in 1039, gaining some territory in turn to the west. In 1056 they annexed the Taifa of Malaga. The Taifa of Granada was eventually conquered by the Almoravids of North Africa in 1090, putting an end to the independent kingdom.

### Hammadid dynasty

Hammad ibn Buluggin, the son of Buluggin and uncle of Badis ibn al-Mansur, was appointed governor of 'Ashir in 997 and given a great deal of autonomy, even going so far as to build a new capital for himself, known as the Qal'a Bani Hammad. The split between Hammad and his nephew came when Badis declared his son as heir and attempted to designate a part of Hammad's territory as a new principality to be governed by the crown prince. Hammad refused to let this happen and responded by ordering the name of the Fatimid caliph to be replaced with the Abbasid caliph in the khutba (Friday sermon) in mosques, a clear departure from Zirid political allegiances. A closely-fought war ended with Hammad and al-Mu'izz ibn Badis concluding a peace agreement which allowed Hammad to retain his effective independence.
The Hammadid state reached its apogee under the reign of al-Nasir ibn 'Alannas (r. 1062-1088) during which it was briefly the most important state in the Maghreb. The Hammadid capital attracted scholars and artists from Kairouan, growing its cultural and economic importance. The Hammadids initially weathered the Banu Hilal invasions much better than their Zirid counterparts to the east and sometimes even allied with the new Arab tribes. Al-Nasir exploited the partial collapse of Zirid rule in Ifriqiya to have his own authority recognized in many of the main cities there, including Sfax, Kairouan, and Tunis. Pressures from the Banu Hilal tribes eventually forced al-Nasir's successor, al-Mansur (r. 1088-1105), to move the capital to Bijaya (Béjaïa or Bougie), a city founded earlier by al-Nasir. Hammadid rule was eventually ended by the Almohads, led by 'Abd al-Mu'min, who captured Bijaya in 1152. Soon after, 'Abd al-Mu'min's son captured Constantine, where the last Hammadid ruler, Yahya, had fled. Yahya was given a pension and allowed to retire in Marrakesh and then Sala (Salé), where he died in 1161 or 1162.