The Banu Ghaniya were an Almoravid Sanhaja Berber dynasty. Their first leader, Muhammad ibn Ali ibn Yusuf, descendant of 5th almoravid emir Ali ibn Yusuf, was appointed as governor of the Balearic Islands in 1126. Following the collapse of the Almoravid power at the hand of the Almohads in the 1140s, the Banu Ghaniya continued to govern the Balearic Islands as independent emirs until about 1203, with a brief interruption in the 1180s. Later leaders (Ali ibn Ishaq and Yahya) made a determined attempt to reconquer the Maghreb (and in particular Ifriqiya), taking Bougie, Constantine and Algiers, and conquering most of modern Tunisia from about 1180 onwards.
They were influential in the downfall of the Almohad Empire in Eastern Maghrib. In Tunisia Ali ibn Ishaq adhered to the Abbasid Caliphate and was formally appointed by Al-Mustadi with the title of "heir of the Almoravids".