HistoryData
Historical EmpireTunis

Hafsid
dynasty

Active Reign Period
12291574AD
Calculated Duration
345 Years

The Hafsid dynasty ruled Ifriqiya for over three centuries, fostering intellectual life including Ibn Khaldun and building the first madrasas in the Maghreb.

Key Facts

Duration
1229–1574 (≈345 years)
Region governed
Modern Tunisia, western Libya, eastern Algeria
Founding ruler
Abu Zakariya Yahya (declared independence c. 1229)
Capital
Tunis
Notable cultural legacy
First madrasas in the Maghreb; birthplace of Ibn Khaldun

Imperial Zenith Metrics

Capital
Tunis
Duration
345yrs
Historical Capitals
Tunis1229–1574BéjaïaWestern branch, 13th–14th c.ConstantineWestern branch, 13th–14th c.

Historical Trajectory

Phase I: Rise

Abu Zakariya Yahya, appointed Almohad governor of Ifriqiya, declared independence around 1229 and founded the Hafsid dynasty. He and his successor al-Mustansir consolidated authority over modern Tunisia, western Libya, and eastern Algeria, establishing Tunis as the capital. Abu Zakariya encouraged Andalusi migrants and refugees, enriching urban culture and laying foundations for later intellectual flourishing across the region.

Phase II: Zenith

Reunified under Abu Yahya Abu Bakr II after earlier dynastic splits, the Hafsids reached their apex under Abu al-Abbas Ahmad II, Abu Faris Abd al-Aziz II, and Abu 'Amr 'Uthman between the late 14th and late 15th centuries. This era saw robust cultural and intellectual patronage, including the construction of the first madrasas in the Maghreb and the career of historian Ibn Khaldun, who was born in Tunis during Hafsid rule.

Phase III: Decline

After the death of Abu 'Amr 'Uthman in 1488, Hafsid power declined steadily amid internal rivalries and external pressures. Ottoman expansion into the region accelerated their vulnerability, and Spain temporarily propped up the weakened dynasty during the 16th century to counter Ottoman influence. The dynasty ended definitively when Ottoman forces completed their conquest of Tunis in 1574, incorporating Ifriqiya into the Ottoman Empire as the Regency of Tunis.

Notable Imperial Reigns

Selected rulers mapping the empire’s trajectory

Ruler
Start
End
Duration
Abu Zakariya Yahya I
1229
1249
20Y
Al-Mustansir
1249
1277
28Y
Abu Yahya Abu Bakr II
1318
1346
28Y
Abu al-Abbas Ahmad II
1370
1394
24Y
Abu Faris Abd al-Aziz II
1394
1434
40Y
Abu 'Amr 'Uthman
1435
1488
53Y