||This article needs additional citations for verification. (December 2009)|
Flag of Tunis under the Hafsids according to the Catalan Atlas c.1375
Realm of the Hafsid dynasty in 1400 (orange)
|Part of a series on the|
|History of Tunisia|
|Early Islamic Era|
|Early modern period|
|Ottoman Era (1574–1881)|
|French Era (1881–1956)|
|Modern Era (1956–present)|
The Hafsids (Arabic: الحفصيون / ALA-LC: al-Ḥafṣiyūn) were a Berber dynasty ruling Ifriqiya (modern Tunisia) from 1229 to 1574. Their territories were stretched from east of modern Algeria to west of modern Libya during their zenith.
The dynasty was named after Muhammad bin Abu Hafs a Berber from the Masmuda tribe of Morocco. He was appointed governor of Ifriqiya (present day Tunisia) by Muhammad an-Nasir, Caliph of the Almohad empire between 1198-1213. The Banu Hafs, were a powerful group amongst the Almohads; their ancestor is Omar Abu Hafs al-Hentati, a member of the council of ten and a close companion of Ibn Tumart. His original name was "Fesga Oumzal", which later changed to "Abu Hafs Omar ibn Yahya al-Hentati" (also known as "Omar Inti") since it was a tradition of Ibn Tumart to rename his close companions once they had adhered to his religious teachings.
The Hafsids as governors on behalf of the Almohads faced constant threats from Banu Ghaniya who were descendents of Almoravid princes which the Almohads had defeated and replaced as a ruling dynasty.
Hafsids were Ifriqiya governors of Almohads until 1229, when they declared independence. After the split of the Hafsids from the Almohads under Abu Zakariya (1229–1249), Abu Zakariya organised the administration in Ifriqiya (the Roman province of Africa in modern Maghreb; today's Tunisia, eastern Algeria and western Libya) and built Tunis up as the economic and cultural centre of the empire. At the same time, many Muslims from Andalucia fleeing the Spanish Reconquista of Castile and Aragon were absorbed. He also conquered the Kingdom of Tlemcen in 1242 and took Abdalwadids as his vassal. His successor Muhammad I al-Mustansir (1249–1277) took the title of Caliph.
In the 14th century the empire underwent a temporary decline. Although the Hafsids succeeded for a time in subjugating the empire of the Abdalwids of Tlemcen, between 1347 and 1357 they were twice conquered by the Merinids of Morocco. The Abdalwids however could not defeat the Bedouin; ultimately, the Hafsids were able to regain their empire. During the same period plague epidemics caused a considerable fall in population, further weakening the empire.
Under the Hafsids, commerce with Christian Europe grew significantly, however piracy against Christian shipping grew as well, particularly during the rule of Abd al-Aziz II (1394–1434). The profits were used for a great building programme and to support art and culture. However, piracy also provoked retaliation from Aragon and Venice, which several times attacked Tunisian coastal cities. Under Utman (1435–1488) the Hafsids reached their zenith, as the caravan trade through the Sahara and with Egypt was developed, as well as sea trade with Venice and Aragon. The Bedouins and the cities of the empire became largely independent, leaving the Hafsids in control of only Tunis and Constantine.
In the 16th century the Hafsids became increasingly caught up in the power struggle between Spain and the Ottoman Empire-supported Corsairs. Ottomans conquered Tunis in 1534 and held one year. Due to Ottoman threat, Hafsids were vassal of Spain after 1535. Ottomans again conquered Tunis in 1569 and held 4 years. Don Juan of Austria recaptured it in 1573. The latter conquered Tunis in 1574 and the Hafsids accepted becoming a Spanish vassal state to offset the Ottoman threat. Muhammad IV, the last Caliph of the Hafsid was brought to Constantinople and was subsequently executed due to his collaboration with Spain and the desire of the Ottoman Sultan to take the title of Caliph as he now controlled Mecca and Medina. The Hafsid lineage survived the Ottoman massacre by a branch of the family being taken to the Canary Island of Tenerife by the Spanish.
Hafsid rulers 
- Abd al-Wahid (1207–1216)
- Abd-Allah (1224–1229)
- Abu Zakariya (1229–1249)
- Muhammad I al-Mustansir (1249–1277)
- Yahya II al-Watiq (1277–1279)
- Ibrahim I (1279–1283)
- Abd al-Aziz I (1283)
- Ibn Abi Umara (1283–1284)
- Abu Hafs Umar I (1284–1295)
- Muhammad I (1295–1309)
- Abu Bakr I (1309)
- Aba al-Baqa Khalid an-Nasir (1309–1311)
- Aba Yahya Zakariya al-Lihyani (1311–1317)
- Muhammad II (1317–1318)
- Abu Bakr II (1318–1346)
- Abu Hafs Umar II (1346–1349)
- Ahmad I (1349)
- Ibrahim II (1350–1369)
- Abu al-Baqa Khalid (1369–1371)
- Ahmad II (1371–1394)
- Abd al-Aziz II (1394–1434)
- Muhammad III (1434–1436)
- Uthman (1436–1488)
- Abu Zakariya Yahya (1488–1489)
- Abd al-Mu'min (Hafsid) (1489–1490)
- Abu Yahya Zakariya (1490–1494)
- Muhammad IV (1494–1526)
- Muhammad V (1526–1543)
- Ahmad III (1543–1569)
- Ottomans Conquered (1569–1573)
- Muhammad VI (1573–1574)
See also 
- C. Magbaily Fyle, Introduction to the History of African Civilization: Precolonial Africa, (University Press of America, 1999), 84.
- Berry, LaVerle. "Hafsids". Libya: A Country Study. Library of Congress. Retrieved 5 March 2011.
- Kitab al-Ansab fi Marifat al-Ashab, al-Baydaq reviewed by Abdelwahab Benmansour 1971, pp32