The Aghlabid dynasty of emirs, members of the Arab tribe of Bani Tamim, ruled northern Africa, nominally on behalf of the Abbasid Caliph, for about a century, until overthrown by the new power of the Fatimids.

Al-Qayrawan city, founded by Uqba ibn Nafi in 670, and home to Al-Qayrawan mosque, known as Jamii Uqba, was built between 670 to 680. The mosque was the first to be built in the region between north central and north western Africa and it underwent several rebuilding and embellishments. The Jamii witnessed its greatest embellishments of sculpted wooden columns and glazed tiles in the prayer hall area during the reign of Ziyadat Allah.

Malik, who died in 795 considered Al-Qayrawan in Tunisia, in addition to Kuffa in Iraq and Medina in Arabia as the three major capitals of Muslim learning. Yahia ibn Salam Al-Basri (745-815) wrote and taught his tafsir (interpertation of Quran) in Al-Qayrawan. And Assad ibn Al-Furat (759-828) synthesized the teaching of all his teachers and taught in Al-Qayrawan. It was during Aghlabid rule, that the city attracted the largest amount of students from all Muslim land, including Spain.

At the end of the 9th century, a Bayt Al-Hikmah (house of wisdom) was built, emulating and rivaling the same Bayt Al-Hikmah in Baghdad. Bayt Al-Hikmah in Al-Qayrawan excelled in the study of medicine, astronomy, engineering, and translation. Public education was widespread and women actively participated in the pursuit of knowledge. Scholars, nobility, and men from all walks of life eagerly supported the libraries in the mosques.

The study of medicine was presented by Ziad Khalfun, Ishak Imran, and Ishak Sulayman. Their works were translated by Costantine the African in the 11th century, and were later taught in Salerno, subsequently becoming one of the first European universities with specialization in medicine. Under the Aghlabid, Islam reached the Mediterranean islands, among them Sicily.

In 827 a base has been established in Sicily. From the Aghlabid base Mazara in the western coast of Sicily, a force of 10,000 multi ethnic men composed of Arabs, Berbers, Spaniards, and Sudanese marched and conquered Palermo in 831, Messina in 843, and Enna in 859, placing the island under effective Muslim control.

Aghlabid rulers