لما توفي باديس بويع لابنه المعز بالمهدية وعمره ثماني حجج وذلك في ذي الحجة سنة 406 ه وباشرت جدته أمور الدولة إلى أن توفيت وسنذكر خبرها في الخاتمة. والمعز هذا هو واسطة عقد ملوك بني زيري توفرت في أيامه أسباب العز والثروة والعمران وكان حسن السيرة محمود الآثار أديبا مجتنبا سفك الدماء إلا في حق. حديد الذهن. له معرفة بكثير من الصنائع وله شعر جيد محبا للعلماء معظما لأرباب الفضائل حتى قصدته الشعراء من الآفاق على بعد الدار يجيز الجوائز السنية ويعطي العطاء الجزيل. ومن شعراء دولته ابن شرف وابن رشيق. هاداه ملوك السودان والروم واستقامت أموره وكانت بإفريقية مذاهب الشيعة والصفرية والأباضية والنكارية والمعتزلة وكانت بها من مذاهب أهل السنة مذهب أبي حنيفة النعمان ومذهب مالك فظهر له حمل الناس على التمسك بمذهب مالك وقطع ما عداه حسما لمادة الخلاف بالمذاهب واستمر بذلك الحال إلى احتلال العساكر العثمانية إفريقية وسنذكره في محله إن شاء الله. وفي أيامه اشتدت شوكة زناتة وكانت له معهم حروب ثم إن المعز قطع العلائق مع دولة بني عبيد بمصر ودعا وخطب باسم دولة بني العباس ولذلك أضمر بنو عبيد الشر والانتقام منه فوجهوا في سنة 441 ه قبائل من عرب الصعيد كبني هلال وبني سليم وغيرهم معروفين بالطيش وشدة البطش للتشفي من المعز وإفريقية وانتشروا كالجراد ودخلوا إفريقية وعثوا فيها بالبغي والفساد وأذاقوا أهلها لباس الجوع والخوف بما لم يعهد. قال ابن خلدون: وصارت خرابا كلها بعد أن كانت ما بين السودان والبحر الرومي كلها عمرانا تشهد بذلك آثار العمران فيه من المعالم وتماثيل البناء وشواهد القرى والمدائن. وقال البكري: كان بالقيروان ثمانية وأربعون حماما وأحصى ما ذبح بالقيروان في بعض أيام عاشوراء خاصة فانتهى تسعمائة وخمسين رأسا من البقر وجباية سواحل القيروان سوسة والمهدية وصفاقس وتونس لبيت المال خاصة غير الدخل والخرج الذي لغير بيت المال ثمانون ألف مثقال من الذهب وفي سنة 452 ه سبيت القيروان وأخليت ولم يبق فيها إلا ضعفاء أهلها. انتهى. وقال ابن عذاري: كانت القيروان من أعظم مدن المغرب طرا وأكثرها بشرا وأيسرها أموالا وأوسعها أحوالا وكان الغالب على أهلها التمسك بالخير والتخلي عن الشبهات واجتناب المحرمات إلى أن توالت
When Badis died, allegiance was given to his son al-Muʿizz at al-Mahdiyya at the age of eight years, in Dhu l-Hijja of the year 406 AH. His grandmother took charge of the affairs of the state until she died; we shall mention her story in the Conclusion. This al-Muʿizz is the centrepiece of the necklace of the kings of the Banu Ziri. In his days the means of power, wealth and prosperity abounded. He was of good conduct and praiseworthy works, a man of letters, avoiding the shedding of blood except by right, sharp of mind, with knowledge of many crafts, and he had good poetry; he loved scholars and honoured people of merit, so that poets came to him from distant horizons despite the remoteness of their homes; he gave splendid prizes and bestowed abundant gifts. Among the poets of his reign were Ibn Sharaf and Ibn Rashiq. The kings of the Sudan and of the Byzantines exchanged gifts with him, and his affairs became settled. In Ifriqiya there were the schools of the Shiʿa, the Sufriyya, the Ibadiyya, the Nukkariyya and the Muʿtazila, and of the schools of the people of the Sunna there were the school of Abu Hanifa al-Nuʿman and the school of Malik. He resolved to make people hold to the school of Malik and to cut off everything else, to put an end to the cause of disagreement over the schools, and that state continued until the occupation of Ifriqiya by the Ottoman troops; we shall mention it in its place, God willing. In his days the power of Zanata grew strong, and he had wars with them. Then al-Muʿizz cut his ties with the dynasty of the Banu ʿUbayd in Egypt, and made the invocation and the sermon in the name of the dynasty of the Banu l-ʿAbbas. For that the Banu ʿUbayd harboured evil and vengeance against him, so in the year 441 AH they sent tribes of the Arabs of Upper Egypt, such as the Banu Hilal, the Banu Sulaym and others, known for recklessness and violence, to take revenge on al-Muʿizz and Ifriqiya. They spread like locusts, entered Ifriqiya and wrought outrage and corruption in it, and made its people taste the garment of hunger and fear as had never been known. Ibn Khaldun said: It became entirely ruined, after all of it, between the Sudan and the Roman Sea, had been cultivated land, as the remains of habitation in it bear witness: landmarks, statues of buildings and traces of villages and cities. Al-Bakri said: In al-Qayrawan there were forty-eight bathhouses. What was slaughtered in al-Qayrawan on one of the days of ʿAshuraʾ alone was counted, and it came to nine hundred and fifty head of cattle. The revenue of the coasts of al-Qayrawan — Susa, al-Mahdiyya, Safaqus and Tunis — for the treasury alone, apart from the income and expenditure that did not belong to the treasury, was eighty thousand mithqals of gold. In the year 452 AH al-Qayrawan was plundered and emptied, and none remained in it but the weak among its people. End. Ibn ʿIdhari said: Al-Qayrawan was among the greatest cities of the whole Maghrib, with the most people, the most wealth and the most ample circumstances. Holding to good, abandoning doubtful things and avoiding forbidden things prevailed among its people, until there followed one after another