Excerpt: Berber Dynasties of Ifriqiya and the Maghreb - Fayik Saadeddine, Falconbird Press, AD 1997
The Late 10th and Early 11th Centuries
The Maghrawa and the Zirids
When Maghrawa cavalrymen shipped north into Iberia to fight alongside the Umayyad caliphate against the coup of the usurper Muhammad ibn Abi 'Amir in 996, their leader, Ziri ibn Atiya, was among them.
Ziri, who was no appreciator of the Umayyad chamberlain al-Mughira but held the Caliph Hisham II with the respect due to the nominal protector of the faith, had served largely as the Umayyads' man in the Maghreb. But when he returned home to his seat of power in Fes in 997, he received unwelcome word that the city had been besieged and captured by the Banu Ifran.[1]
Like the Maghrawa, the Banu Ifran were Zenata Berbers and had allied with Ziri's tribe in many matters in the past, but most of them were devout Kharijites known for their zeal in religious affairs. They held court at the city of Salé on the Atlantic coast, much to the consternation of the Barghawata tribe in the area, and from there sought to project their power across the Maghreb at a time when the region was still not really unified under any one dynasty. While Ziri's tribal group was the dominant one in the region, other tribal kinglets - like Yaddu of the Banu Ifran - contested the region with them.
An irritated Ziri returned to Fes in 997 with a large army, among them a detachment of Andalusians sent over with the consent of Hisham. Over the course of three months, the Maghrawa waged a bloody war for the city. Ultimately they breached the gates and drove out the Banu Ifran by the sword. Yaddu was killed in the fighting, and Ziri had his head cut off and mounted on a stake above the city gate for all to see.
The conflict with the Banu Ifran hardly ended there; pushing westward, again with explicit Caliphal backing, Ziri pressed his war against that tribe, overrunning the settlement of Tiflet before launching an attack on Salé in 998, resulting in a bloody clash outside the city as the Maghrawa army suffered from constant harrying raids from expert Ifranid cavalry as they tried to mass outside the walls.
Nevertheless Ziri's men managed to inflict serious losses on the Ifranids, and ultimately turned the battle in his favour, exacting tribute from the Banu Ifran later that year. He went on to turn his attention to the remnants of the hated Idrisid dynasty, holed up in the fort of Tiaret years after their authority in the Maghreb had been broken by al-Hakam
al-Mustansir in 974. Still under the protection of the Umayyads, he drove the Idrisids out of Tiaret and expanded his relative zone of control eastward to encompass Tlemcen.
Battle wasn't Ziri's only concern. Sometime before his trip to Andalusia, he had begun building a city at Oudja in the Rif.[2] Some of the oldest buildings still standing in Oudja today date from about this time period, and a dedication stone has been found honouring Ziri.
While the authority of the Maghrawa over the region was never really complete - tribal loyalties alone ensured Ziri would spend most of his days battling the likes of the Banu Ifran, the Barghawata and various tribes of the Sanhaja - the tribe continued to consolidate what hold it had, rounding into by far the most robustly-positioned group in the Maghreb at the time. This stood in contrast, though, to happenings in the east, in Ifriqiya.
When the Fatimid Caliphate moved their capital to Egypt in 969, they had left Ifriqiya under the viceroyalty of the Zirid dynasty, in the hands of Buluggin ibn Ziri. When he passed in 985, he left control of the region to his son, al-Mansur.[3] His inheritance was divided to an extent, with control over the central Maghreb being entrusted by al-Mansur to his brother, Hammad. The Zirids couldn't press their old claims over Fes and Sijilmasa, those cities being lost to the Maghrawa, but they bent their will upon the Kutama Berbers in the central Maghreb between 986 and 989, consolidating their control on that stretch of the continent.
Al-Mansur went on to do battle with some of the loose tribes of Zenata Berbers in the area. The Zenata and Sanhaja groups had been traditional rivals, and al-Mansur was able to push many of these tribesmen out of Zirid territory and into that controlled by the Maghrawa in name at least. The lands they once held were placed under Sanhaja governors, but much of the expance between Zirid and Maghrawid territory remained lawless and tribalized.
The Zirids would face their own instability soon enough. Spurned in the division of Buluggin's realm was his brother, Zawi ibn Ziri, the uncle of al-Mansur. Recognized as a fine warrior from Cairo to Córdoba and with a large body of tribesmen under his purview, Zawi agitated within the Zirid realm, seeking to secure some sort of his brother's inheritance for himself.
In 995, al-Mansur took ill with what seems to have been pneumonia,[4] holing up in his palace in Kairouan. Zawi took the opportunity to launch a sweeping revolt against his nephew. Records of the actual war are scarce owing to the low levels of literacy and organization in the region at the time, but the fighting raged until at least 998, when the Zirids successfully forced Zawi and his loyalists westward, with Zawi himself holding the reins of that exiled tribal group.
Al-Mansur perished in 999, and Zawi appealed to his son Badis in the hopes of reconciling - perhaps in the hope of securing power for himself. Badis seems to have ignored these entreaties.
Evidently seeing no future for himself and his tribe in Ifriqiya, Zawi sent appeal to Caliph Hisham II of Córdoba, swallowing his contempt for the old enemies of the Sanhaja and seeking the protection of a leader he rightly despised. However, Zawi's appeal, in 1000 or thereabouts, was rejected outright on the advice of the chamberlain al-Mughira, who advised Hisham that a rogue element like Zawi would cause nothing but trouble. Most of the Berbers employed by the Umayyads were Zenata, and Zawi was Sanhaja, creating the potential for enormous factional unrest between his tribe and the likes of Ziri ibn Atiya - and al-Mughira feared as well that importing an entire large tribe at once would cause even more unrest. Tribal Berbers often had trouble adapting to urban life in al-Andalus, and many did not even speak Arabic, much less adapt easily to living in cities.[5]
Rejected by the Andalusians, and with Hisham at the time still in his thirties and unlikely to die any time soon, Zawi cast about for a place to bring his people. Ultimately he sent appeal to Ja'far al-Kalbi, the Emir of Sicily at the time. Ja'far, new to the throne and suffering from a shortage in manpower as Sicilian Muslims chose to pay a tax rather than contribute to the
jihad as warriors, saw in Zawi an opportunity to bring a powerful force in on his side, and in 1002 he acceded to Zawi's wishes, permitting him to cross to Sicily.
It's debatable whether Ja'far realized how dangerous an element he had just introduced to the island.[6]
[1] The Maghrawa feuded with these guys OTL, too.
[2] The coastal area east of the point of Tangier/Ceuta.
[3] Not the same guy as the Almanzor of Iberia.
[4] OTL, al-Mansur died in this year.
[5] Even Almanzor was uneasy about bringing in Zawi; he put him off and put him off, and ultimately it was his son who allowed him to come in. Of course, OTL the Zawids settled in Elvira and became one of the most powerful and destabilizing influences in the area as the Taifa of Granada.
[6] Someone in the comments wanted Kalbid Sicily butterflies. Here they are. Instead of al-Andalus getting the Zawids, Sicily gets them.
SUMMARY:
997: In the Maghreb, Ziri ibn Atiya retakes Fes from the Banu Ifran. He goes on to wring submission from them en route to strengthening the Maghrawa tribe's hold in the region.
998: Al-Mansur ibn Buluggin of Ifriqiya successfully stamps out a rebellion by his uncle, Zawi ibn Ziri.
1002: The Zawids arrive in Kalbid Sicily at the invitation of Ja'far al-Kalbi.