The Sanhaja or Senhaja (also Zenaga, Znaga or Sanhadja; Berber: Aẓnag, Iẓnagen; Arabic (from Berber): صنهاجة Ṣanhājah) were once one of the largest Berber tribal confederations of the Maghreb, along with the Zanata and Masmuda. Many tribes and regions in the Berber world bore and still bear this name, especially in its Berber form.
After the arrival of Islam, the Sanhaja spread out to the borders of the historic Sudan as far as the Senegal River and the Niger. From the 9th century, Sanhaja tribes were established in the Middle Atlas range, in the Rif Mountains and on the Atlantic coast of Morocco. A part of the Sanhaja, such as the Kutama, settled in central/eastern Algeria and northern Niger. They played an important part in the rise of the Fatimids. The Sanhaja dynasties of the Zirids and Hammadids controlled Ifriqiya until the 12th century.
In the mid-11th century, a group of Sanhaja chieftains returning from the Hajj invited the theologian ibn Yassin to preach among their tribes. Ibn Yasin united the tribes in the alliance of the Almoravids in the middle of the 11th century. This confederacy subsequently established Morocco, and conquered western Algeria and Al-Andalus (part of present-day Spain).
The descendents of the Sanhaja are still found today in the Middle-Atlas and eastern Morocco. They also include the Tuaregs Kutama in northern Niger and Mali across the Sahara, in addition to the Kutama of Kabylie in Algeria.
The Zenaga people, a group believed to be descendents of the Gudala (the southernmost Sanhaja tribe) are found today in southwestern Mauritania and in parts of northern Senegal, though in few numbers.