He was the Almohad governor of Gabès and then of Tunis by 1229, having inherited this position in Tunisia from his father and then was appointed in Gabès by his brother.
Abu Zakariya would rebel on the central authority after he heard that the Almohad caliph in Marrakesh al-Ma'mun, has overthrown and killed two of his brothers and that he cancelled the creed of Ibn Tumart. Additionally, al-Ma'mun instructed the Imams to insult Ibn Tumart in the mosques and cancelled the call to prayer in Berber. Abu Zakariya, then declared himself independent late in 1229. He subsequently captured Constantine and Bougie in 1230 and annexed Tripolitania in 1234, Algiers in 1235 and subdued important tribal confederations of the Berbers from 1235 to 1238.
In 1242 he captured Tlemcen, forcing the Sultan of Tlemcen to become his vassal. In the December of that year, caliph Abd al-Wahid II, died, leaving Abu Zakariya as the most powerful ruler of Maghreb. By the end of his reign, the Marinid Dynasty of Morocco and several Muslim princes in Al-Andalus paid him tribute and acknowledged his nominal authority. A skillful general, his ability to utilize the military power of the tribesmen enabled him to establish a strong state. His Hafsid dynasty brought peace, prosperity, and stability to Tunisia.