The Fatimids, an Arab Shi'a dynasty, have ruled over varying areas of the Maghreb since 910.
The leaders of the dynasty, who belong to the Ismaili branch of Shi'ism, are also Shia Ismaili Imams, hence, they have a religious significance to Ismaili Muslims.
They are also part of the chain of holders of the office of Caliph, as recognized by most Muslims, the only period in which the Shia Imamate and the Caliphate have been united to any degree, excepting the Caliphate of Ali himself.
After the Fatimids, under their third caliph, Ismail al-Mansur, had defeated the Kharijite rebellion of Abu Yazid, the man on the donkey, they began, under his son al-Mu'izz li-Din Allah, to turn their attentions back to their ambition of establishing their caliphate throughout the Islamic world and overthrowing the Baghdad Abbasid Caliphate.
Although the Fatimids are primarily concerned with Egypt and the Near East, there have nevertheless been campaigns fought by General Jawhar as-Siqilli against the Berbers of Morocco and the Umayyads of Spain.
At the same time, Fatimid raids on Italy have enabled naval superiority in the Western Mediterranean to be affirmed, at the expense of Constantinople.
The family of Jawhar had originated from the Emirate of Sicily (hence Gawhar’s epithet, “the Sicilian”), and he had come as a slave to North Africa and been sent to the Caliph Ismail al-Mansur on account of his intelligence and cunning.
Under his son al-Muizz, he had gained his freedom and become his personal secretary.
Soon he was Vizir and the highest-ranking military commander of the Fatimids.
In this role he had resumed the expansion of the Fatimids and, together with the Zirids, a Berber dynasty originating in Petite Kabylie among the Kutama tribe, had conquered Fez in Northern Morocco, and pushed towards the Atlantic.
Only the strongholds of Ceuta and Tangier could be retained by the Umayyads of Córdoba.