In a campaign in early 1347, Abu al-Hassan's Moroccan army swept through Ifriqiya and entered Tunis in September, 1347.
•
The ruler of Tlemcen, Ibn Tashufin (r. 1318-1337), initiated hostilities against Ifriqiya, besieged Béjaïa, and sent an army into Tunisia that defeated the Hafsid king Abu Yahya Abu Bakr II, who fled to Constantine while the Zayyanids occupied Tunis.
As spearheads of the western conquest, the al-Fihris were probably the leading aristocratic Arab family of Ifriqiya and Al-Andalus in the first half of the 8th century.
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.
Several of them were drawn from the core of followers that Ibn Tumart had picked up in Ifriqiya (esp. while holding camp at Mallala, outside of Bejaia, in 1119-20); others were local leaders drawn from the local Masmuda Berbers who had proven early adherents.
From its capital at Tunis, the Hafsid dynasty made good its claim to be the legitimate successor of the Almohads in Ifriqiya, while, in the central Maghrib, the Zayyanids founded a dynasty that ruled the Kingdom of Tlemcen.
Above all, it demonstrated his superiority over his great rivals, the Fatimids of Ifriqiya in Northern Africa.
Muhammad I Abu 'l-Abbas (died 856), fifth emir of the Aghlabidss in Ifriqiya
Because of his father's victories against the Christians in the Iberian Peninsula (Al-Andalus), he was temporarily relieved from serious threats on that front and able to concentrate on combating and defeating Banu Ghaniya attempts to seize Ifriqiya (Tunisia).