Official Languages: Berber, Maghrebi, Arabic
Established: 1229 AD/CE
Disestablished: 1574 AD/CE
The ancestor of the dynasty was Abu Hafs Umar ibn Yahya al-Hintati, a Berber from the Hintata tribal confederation which belonged to the greater Masmuda confederation of Morocco. He was a member of the council of ten and a close companion of Ibn Tumart. His original Berber name was "Faskat u-Mzal Inti", which later was changed to "Abu Hafs Umar ibn Yahya al-Hintati" (also known as "Umar Inti") since it was a tradition of Ibn Tumart to rename his close companions once they had adhered to his religious teachings. His son Abu Muhammad Abd al-Wahid ibn Abi Hafs, was appointed by the Almohad caliph Muhammad an-Nasir as governor of Ifriqiya (present day Tunisia), where he ruled from 1207 to 1221
The Hafsids as governors on behalf of the Almohads faced constant threats from Banu Ghaniya who were descendants of Almoravid princes which the Almohads had defeated and replaced as a ruling dynasty. The Hafsids were Ifriqiya governors of the Almohads until 1229, when they declared independence. After the split of the Hafsids from the Almohads under Abu Zakariya (1228–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 Al-Andalus fleeing the Spanish Reconquista of Castile and Aragon were absorbed. He also conquered the Kingdom of Tlemcen in 1242 and made the Abdalwadids his vassals. His successor Muhammad I al-Mustansir (1249–1277) took the title of Caliph.
He extended the boundaries of his State by subjugating the central Maghreb, going so far as to impose his overlordship over the Kingdom of Tlemcen, northern Morocco and the Nasrids of Granada Spain. The Hafsids become completely independent in 1264. The successor of Abû Zakariya' Yahya, Abu ' Abd Allah Muhammad al-Mustansir, proclaimed himself Caliph in 1256 and continued the policies of his father. It was during his reign that the failed Eighth Crusade took place, led by St. Louis. After landing at Carthage, the King died of dysentery in the middle of his army decimated by disease in 1270.
In the 14th century the empire underwent a temporary decline. Although the Hafsids succeeded for a time in subjugating the empire of the Abdalwadids of Tlemcen, between 1347 and 1357 they were twice conquered by the Marinids of Morocco. The Abdalwadids 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). In 1429, the Hafsids attacked the island of Malta, and took 3000 slaves although they did not conquer the island. 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. The Ottomans conquered Tunis in 1534 (see Conquest of Tunis (1534)) and held it for one year, driving out the Hafsid ruler Muley Hassan. A year later the King of Spain and Holy Roman Emperor Charles I and V seized Tunis, drove the Ottomans out and restored Muley Hassan as a Hapsburg tributary (see Conquest of Tunis (1535)). Due to the Ottoman threat, the Hafsids were vassals of Spain after 1535. The Ottomans again conquered Tunis in 1569 and held it for four years. Don Juan of Austria recaptured it in 1573. The Ottomans reconquered Tunis in 1574, and Muhammad VI, the last Caliph of the Hafsids, 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.