In 800, the Abbasid Caliph Harun al-Rashid appointed Ibrahim I ibn al-Aghlab, son of a Khurasanian Arab commander from the Banu Tamim tribe, as hereditary Emir of Ifriqiya as a response to the anarchy that had reigned in that province following the fall of the Muhallabids. At that time there were perhaps 100,000 Arabs living in Ifriqiya, although the Berbers still constituted the great majority.
Ibrahim was to control an area that encompassed eastern Algeria, Tunisia and Tripolitania. Although independent in all but name, his dynasty never ceased to recognise Abbasid overlordship. The Aghlabids paid an annual tribute to the Abbasid Caliph and their suzerainty was referenced in the khutba at Friday prayers.
After the pacification of the country Ibrahim ibn al Aghlab established a residence at a new capital, al-Abbasiyya, which was founded outside Kairouan, partly to distance himself from the opposition of the Malikite jurists and theologians, who condemned what they saw as the luxurious life of the Aghlabids, and disliked the unequal treatment of the Muslim Berbers. Additionally, border defenses (Ribat) were set up in Sousse and Monastir. The Aghlabids also built up the irrigation of the area and enhanced the public buildings and mosques ofal-Abbasiya. It was recorded that 5,000 black Zanj slaves were used which were supplied from Trans Sahara trade route
One unique feature of the Aghlabids is that despite the political differences and rivalry between Aghlabids who served under Abbasid and the Umayyad Emirate of Cordoba, the Muslims in Spain were also sent a fleet under Asba' ibn Wakil to aid the Aghlabids conquest of Sicily. Ibn Kathir recorded that a joint force of 300 Umayyad and Aghlabid ships were present. the Aghlabid garrison at Mineo managed to get into contact with the Andalusian Umayyads whom immediately agreed to the alliance, provided that Asbagh was recognized as the overall commander, and together with fresh troops from Ifriqiya they marched on Mineo. Theodotus retreated to Enna and the siege of Mineo was broken (July or August 830). The combined Ifriqiyan and Andalusian army then torched Mineo and laid siege to another town, possibly Calloniana (modern Barrafranca). However, a plague broke out in their camp causing the death of Asbagh and many others. The town fell later, in autumn, but the Arabs' numbers were depleted subsequently they had to abandon it and retreat west. Theodotus launched a pursuit and inflicted heavy casualties, so that most of the Andalusians departed the island. However, Theodotus too was killed at this time, possibly in one of these skirmishes.
Under Ziyadat Allah I (817-838) came the crisis of a revolt of Arab troops in 824, which was not quelled until 836 with the help of the Berbers. The conquest of Byzantine Sicily from 827 under Asad ibn al-Furat was an attempt to keep the unruly troops under control - it was only achieved slowly, and only in 902 was the last Byzantine outpost taken. Plundering raids into mainland Italy, which included the sack of the Roman basilicas in 846, took place until well into the 10th century. Gradually the Aghlabids lost control of the Arab forces in Sicily and a new dynasty, the Kalbids, emerged there.
The Aghlabid kingdom reached its high point under Ahmad ibn Muhammad al-Aghlabi (856-863). Ifriqiya was a significant economic power thanks to its fertile agriculture, aided by the expansion of the Roman irrigation system. It became the focal point of trade between the Islamic world and Byzantium and Italy, especially the lucrative slave trade. Kairuan became the most important centre of learning in the Maghreb, most notably in the field of Theology and Law, and a gathering place for poets. The Aghlabid Emirs also sponsored building projects, notably the rebuilding of the Mosque of Uqba and the kingdom developed an architectural style which combined Abbasid architecture and Byzantine architecture.
The decline of the dynasty began under Ibrahim II ibn Ahmad (875-902). An attack by the Tulunids of Egypt had to be repelled and a revolt of the Berbers put down with much loss of life. In addition, in 893 there began amongst the Kutama Berbers the movement of the ShiiteFatimids to overthrow the Aghlabids. Ubaydalla Said captured the cities of Qairawan and Raqqada and took an oath of allegiance from the people. By 909, the Aghlabid Dynasty was overthrown and replaced with the Fatimids.