# Banu Ghaniya

The Banu Ghaniya were a Massufa Sanhaja Berber dynasty and a branch of the Almoravids. Their first leader, Muhammad ibn Ali ibn Yusuf, a son of Ali ibn Yusuf al-Massufi and the Almoravid Princess Ghaniya, 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".

## History
### Origins

The Banu Ghaniya clan were relatives of the ruling Almoravid dynasty. Yusuf ibn Tashfin, the Almoravid emir (d. 1161), gave one of his daughters in marriage to Ali ibn Yusuf, the head of Ghaniya clan. He had two sons with her: Yahya and Muhammad. These two became important governors and commanders during the 1120s, under the reign of Ali ibn Yusuf, the son of Yusuf ibn Tashfin who succeeded him as emir (r. 1106–1143). Muhammad was appointed governor of the Balearic Islands in 1126. His brother Yahya was governor of Murcia up to 1133 and then transferred to Valencia in 1134.
For much of the 1130s, Tashfin ibn Ali and Yahya led the Almoravid forces to a number of victories over Christian forces and reconquered some towns, holding back the decline of Almoravid power in al-Andalus (the Iberian Peninsula). The most significant victory was the Battle of Fraga in 1134, where the Almoravids, led by Yahya, defeated an Aragonese army besieging the small Muslim town of Fraga. Notably, Alfonso I El Batallor was wounded and died shortly after.
The Ghaniya brothers were among the last commanders to hold out as Almoravid power collapsed in al-Andalus. In 1144 or 1145, Yahya was transferred from eastern al-Andalus to Seville in order to counter the rebellion of Ibn Qasi in the west. Starting in 1146, the Almohads arrived in al-Andalus, but Yahya continued to organize resistance against them from Córdoba. Eventually, faced with attacks by the Christian kingdoms to the north and the Almohad invasion, Yahya attempted to reach an agreement with his enemies to remain as lord of Jaén, but he was soon expelled from there too by Alfonso VII of León and Castile. He retreated to Granada, the last outpost of Almoravid rule, where he persuaded the governor to surrender to the Almohads. He died here in late 1148 or early 1149.
Meanwhile, his brother Muhammad remained lord of the Balearics and many remaining members of the Almoravid faction joined him there. He became an independent ruler and founded a new dynasty.

### Rule in the Balearics

Following the fall of the last Almoravid ruler in Marrakesh in 1147, the Banu Ghaniya maintained control of the Balearics and held off several Almohad attacks on the islands. Muhammad remained in power until 1156, when a palace coup replaced him with his son, Ishaq. The details of the coup are not entirely clear, with some historical sources stating that Muhammad had appointed his son Abdallah as crown prince and that this motivated Ishaq to overthrow him. The sources also do not agree on when exactly Muhammad was killed and on whether Abdallah was killed before or after him.
Under Ishaq's reign, the kingdom derived revenues through piracy generally aimed at Christian ships. The Almohad caliph Abu Yaqub Yusuf (r. 1163–1184) sent him an emissary demanding his submission, but Ishaq continued to formally recognize the Abbasid caliphs and attempted to assuage the Almohad caliph with lavish gifts instead. Ishaq died during a pirate expedition in 1183.
He was initially succeeded by his oldest son, Muhammad. Faced with hostility from both the Christians and Almohads, Muhammad sent a message to Marrakesh expressing his agreement to submit to the Almohad caliphs. An Almohad fleet under Ibn Reberter (a mercenary of Christian origin) was sent to take control of the islands. Before it arrived, Muhammad was deposed by the other Almoravid chiefs, who placed his brother 'Ali in power instead. Ali was opposed to Almohad rule and was further pressured to resist them by the Almoravid refugees who lived on the islands. Thus, when the Almohad fleet arrived, he repelled it and captured its commander. Instead of waiting to face an Almohad counter-attack and possible blockade of the islands, Ali decided to take the offensive and attack the Almohads directly in the eastern Maghreb.

### Invasion of North Africa

The Banu Ghaniya undertook military campaigns against the Almohads in North Africa from November 1184 to 1237/1238, in hopes of re-establishing Almoravid rule.

## Leaders
### Balearic Islands

| Name | Years as leader | Notes and citations |
| Muhammad ibn Ali ibn Yusuf | 1126–1156 | Initially the Almoravid governor of the Balearic islands, then remained independent there. Deposed in 1156. Also the brother of Yahya ibn Ghaniya, Almoravid governor and commander in al-Andalus until 1148–9. |
| Abdallah ibn Muhammad | (1155) | May have ruled briefly in 1155, after Muhammad's death, but details of the events are unclear in historical sources. |
| Ishaq ibn Muhammad | 1155/1156–1183 | |
| Muhammad ibn Ishaq | 1183–1184 | Submitted to the Almohads but overthrown in 1184. |
| Ali ibn Ishaq | 1184–1185 | Replaced Muhammad, then invaded the eastern Maghreb in 1184. In his absence, the Almohads retook the islands in 1185. |
| Muhammad ibn Ishaq | 1185–? | Re-installed as amir of the islands under Almohad suzerainty. Deposed and replaced by the islands' Muslim troops shortly after. He was probably visiting the Almohad caliph in Marrakesh when Abdallah ibn Ishaq recaptured the islands and so the Almohads gave him Denia in al-Andalus to govern afterwards. |
| Tashfin ibn Ishaq | ?–1187 | Installed as amir under Almohad suzerainty. |
| 'Abdallah ibn Ishaq | 1187–1203 | Recaptured the islands from the Almohads by 1187. Defeated and executed by the Almohads in 1203, who installed their own governors on the islands after this. |

### Eastern Maghreb

| Ali ibn Ishaq | 1184–1187/1188 | Invaded the eastern Maghreb in 1184 and campaigned there until his death in 1187 or 1188. He likely remained the overall leader of the Banu Ghaniya while his brother Abdallah recaptured and governed the Balearic Islands. |
| Yahya ibn Ishaq | 1187/1188–1235/1236 | Brother of Ali, took over the Banu Ghaniya in North Africa after his death and remained active in Ifriqiya until driven out in 1226. Remained active as a raider in the region until his death sometime between 1233 and 1237. |