The Hafsids ( ) were a Sunni Muslim dynasty of Berber descent who ruled Ifriqiya (western Libya, Tunisia, and eastern Algeria) from 1229 to 1574. History Almohad Ifriqiya The Hafsids were of Berber descent, although to further legitimize their rule, they claimed Arab ancestry from the second Rashidun Caliph Omar. The ancestor of the dynasty and from whom their name is derived 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. Hafsid Kingdom and Caliphate In 1229 Ifriqiyas governor, Abu Zakariya returned to Tunis after conquering Constantine and Béjaïa the same year and 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 the city of Tunis up as the economic and cultural centre of the empire. At the same time, many Muslims from Al-Andalus fleeing the Christian Reconquista of Iberia were absorbed. He subsequently annexed Tripoli in 1234, Algiers in 1235, Chelif River 1236, and subdued important tribal confederations of the Berbers from 1235 to 1238. He also conquered the Kingdom of Tlemcen in July 1242 forcing the Sultan of Tlemcen his vassals. In December of that year, caliph Abd al-Wahid II, died, leaving Abu Zakariya as the most powerful ruler of Maghreb. At this time the Hafsids also occupied the Berber emirate of Siyilmasa which they retained for 30 years. By the end of his reign, the Marinid Dynasty of Morocco and several Muslim princes in Al-Andalus paid him tribute and