ハフス朝
Medieval events in Ifriqiya and al-Maghrib often have tribal associations. Linked to the Kabyle "Sanhaja" were the Kutama tribes, whose support worked to establish the Fatimid Caliphate (909–1171, only until 1049 in Ifriqiya); their vassals and later successors in Ifriqiya the Zirids (973-1160) were also "Sanhaja". The Almoravids (1056–1147) first began far south of Morocco, among the Lamtuna "Sanhaja". From the "Masmuda" came Ibn Tumart and the Almohad movement (1130–1269), later supported by the "Sanhaja". Accordingly, it was from among the "Masmuda" that the Hafsid dynasty (1227–1574) of Tunis originated.