# Zirid conquest of the western Maghreb

The Zirids conquered the western Maghreb in 979 when Buluggin Ibn Ziri led a campaign to expand his territory. He captured most of present-day Morocco by 980, which remained briefly under Zirid control until his death in 984.

## Background

Throughout much of the 10th century, authority over the western Maghreb was contested between the Fatimids (based in Ifriqiya) and the Umayyads of Córdoba (based in al-Andalus), each assisted by local allies. The Umayyads held two garrisoned forts along the coast, Ceuta and Mellila, while their main allies in the interior were Zenata tribes. Between 958 and 960, the Fatimid general Jawhar succeeded in submitting most of the region to Fatimid authority, aided by Ziri ibn Manad, another Fatimid commander from Ashir.
In 969, Jawhar conquered Egypt and in 973 the Fatimid caliph al-Mu'izz moved his court to Cairo, the new Fatimid capital. Before leaving, he appointed Buluggin ibn Ziri, the son and successor of Zirid ibn Manad, as his viceroy in the Maghreb. This spawned the Zirid dynasty which ruled the region officially in the name of the Fatimid caliphs. Meanwhile, the Umayyads took advantage of the Fatimid focus on Egypt to reassert their authority in the Maghreb. In 973, the Umayyad general Ghalib reconquered Fez and brought local factions back under their control.
After the death of the Umayyad caliph al-Hakam II in 976, de facto control of the Umayyad state was seized by Ibn Abi ‘Amir, known as al-Mansur (or Almanzor in Christian sources). He continued a pro-Zenata policy and greatly fortified Ceuta. The Umayyads in North Africa were placed under the command of Ja'far ibn Ali ibn Hamdun and his brother Yahya, though by 978 Ja'far had returned to al-Andalus, leaving Yahya in sole command. The authority of the Umayyad commanders was recognized by the main Zenata factions, including the chiefs of the Maghrawa, Ziri ibn Atiyya and his brother Muqatil, the chief of the Banu Ifran, Yaddu ibn Ya'la, and the Miknasa.
Towards 978, another powerful Maghrawa chief and Umayyad vassal, Hazrun ibn Fulful ibn Hazar al-Zanati, captured Sijilmasa from the Ibadis and executed their Midrarid caliph, bringing the city under Umayyad authority for the first time.

## Campaign

The resurgence of the Zenata provoked Buluggin's response. He left Ifriqiya on 27 March 979 at the head of his army and marched on Fez, which he captured with relative ease. He executed one of the city's two governors while the other, Abd al-Karim, accompanied him on the rest of the campaign. While staying in the city, Buluggin commissioned the creation of a wooden minbar for the Mosque of the Andalusians, a part of which has been preserved and includes an inscription dated to 980.
Buluggin then marched on Sijilmasa and defeated the Zenata gathered there, executing one of the Maghrawa leaders, Ibn Khazar. The remaining Umayyad, Maghrawa, and Ifranid governors retreated towards Ceuta. Buluggin pursued them. When he reached the coastal city he found that the Zenata had rallied there in large numbers and that the city was well-defended by reinforcements from al-Andalus. Ibn Abi ‘Amir al-Mansur had been alerted by the Maghrawa chief, Muhammad ibn al-Khayr, and had brought an army in person to Algeciras, on the northern shore of the Strait of Gibraltar. From there, the army had crossed to Ceuta under the command of Ja'far (Yahya's brother). Buluggin, reportedly after seeking the advice of Abd al-Karim from Fez (whom he later executed), decided that battle would be too costly and too dangerous, especially without a supporting fleet that could stop the reinforcements arriving from al-Andalus. He refrained from attacking the city.
On the way back, Buluggin captured the northern trade center of Basra al-Hamra', which had also been Yahya's base before he fled. He most likely captured Asilah as well, though the sources do not mention this. He then led an expedition against the Barghawata, a Berber faction in western Morocco led by a mystic named Salih ibn Isa ibn Abi al-Ansar. After fierce fighting, Buluggin defeated them, killed their leader, and sent a large number of enslaved women and children to Ifriqiya, where they arrived in 981. The slaves were paraded in the streets of Kairouan by Abd Allah ibn Muhammad al-Katib, the governor of Ifriqiya in Buluggin's absence. Buluggin left the lands of the Barghawata in 982–983 (372 AH) and began his return journey to Ifriqiya.

## Aftermath

Historical sources report that Ibn Abi ‘Amir al-Mansur, to appease Buluggin, ordered the assassination of his general, Ja'far ibn Ali ibn Hamdun, who had been responsible for the death of Buluggin's father, Ziri. Ja'far was killed on 21 January 983 and his head sent to Buluggin. Yahya was aware of this treachery and confronted al-Mansur, who expelled him to North Africa. He avoided Buluggin and instead fled to Cairo, where he was welcomed into the service of the Fatimid caliph al-'Aziz, to Buluggin's apparent frustration.
As Buluggin marched eastward back to Ifriqiya, the Maghrawa and the Banu Ifran began to reclaim the towns and territories which he had just conquered. Wannuddin, the son of Hazrun ibn Fulful ibn Hazar al-Zanati, returned to Sijilmasa and expelled the Zirid governor there. This caused Buluggin to double back and march again on Sijilmasa, but he fell ill on the way. He died on 25 May 984, somewhere between Sijilmasa and Tlemcen, possibly around the Taza gap. After Buluggin's death, Zirid policy in the west was restricted to preventing the eastward expansion of the Zenata tribes into their territories.