View on Explorer →Race its rivals →

Egypt & North Africa

Idrisid dynasty

Peak828 CE
Duration186 yrs
Period788 CE – 974 CE
CapitalVolubilis (Walili), then Fez (al-'Aliya, from 809); Hajar an-Nasr after 927
FounderIdris I (Idris ibn Abdallah), made imam by the Awraba Berbers of Volubilis in 788
Preceded byThe Berber tribes and principalities of Morocco, independent of the caliphs since the Kharijite revolts of 739–40; the Awraba of Volubilis
Succeeded byThe Umayyad Caliphate of Córdoba in northern Morocco (974); then the Zenata Maghrawa and Banu Ifran

7 min read · Last reviewed October 2026

At a glance

Rise & Fall

Peak 828 CE1788: Idris ibn Abdallah, fleeing the Abbasids after the Battle of Fakhkh, settles at Volubilis, where the Awraba Berbers make him their imam.2791: Idris I is poisoned by an Abbasid agent; his posthumous son Idris II is brought up under the regency of the freedman Rashid.3809: Idris II has the Awraba leader Ishak killed and moves his seat from Walili to Fez, founding the settlement of al-'Aliya.4828: Idris II dies; the state reaches from western Algeria to the Sous, and his son Muhammad divides it among seven brothers.5836–863: Ali ibn Muhammad and Yahya I rule in stability; the al-Qarawiyyin and al-Andalusiyyin mosques are founded in Fez.6868: The Sufri Kharijite tribes of Madyuna, Ghayata and Miknasa defeat Ali ibn Umar and occupy Fez until Yahya III retakes it.7927: Musa ibn Abul 'Afiya of the Miknasa captures and kills Hassan I al-Hajam: the Idrisids never again hold Fez.8974: The Umayyad general Ghalib expels the Idrisids from their lands and takes al-Hasan and other Idrisids as hostages to Córdoba.788 CE974 CE
Relative power on the Institute's 0–10 scale (each profile scaled to its own peak). Numbers mark the key events below.
  1. 788Idris ibn Abdallah, fleeing the Abbasids after the Battle of Fakhkh, settles at Volubilis, where the Awraba Berbers make him their imam.
  2. 791Idris I is poisoned by an Abbasid agent; his posthumous son Idris II is brought up under the regency of the freedman Rashid.
  3. 809Idris II has the Awraba leader Ishak killed and moves his seat from Walili to Fez, founding the settlement of al-'Aliya.
  4. 828Idris II dies; the state reaches from western Algeria to the Sous, and his son Muhammad divides it among seven brothers.
  5. 836–863Ali ibn Muhammad and Yahya I rule in stability; the al-Qarawiyyin and al-Andalusiyyin mosques are founded in Fez.
  6. 868The Sufri Kharijite tribes of Madyuna, Ghayata and Miknasa defeat Ali ibn Umar and occupy Fez until Yahya III retakes it.
  7. 927Musa ibn Abul 'Afiya of the Miknasa captures and kills Hassan I al-Hajam: the Idrisids never again hold Fez.
  8. 974The Umayyad general Ghalib expels the Idrisids from their lands and takes al-Hasan and other Idrisids as hostages to Córdoba.

Foundation

Volubilis
VolubilisSubhros, CC BY-SA 3.0

By the second half of the 8th century the far Maghreb had been effectively independent of the caliphs since the Kharijite-led Berber revolts of 739–40, and neither the Umayyads nor the Abbasids after 750 regained control of Morocco. The land was held by local Berber tribes and principalities such as the Barghwata Confederacy on the Atlantic coast and the Midrarid Emirate in Sijilmasa. Into this country came Idris ibn Abdallah, a great-grandson of Hasan ibn Ali and so a descendant of Ali ibn Abi Talib and Fatima, the daughter of the prophet Muhammad. After the Battle of Fakhkh, near Mecca, between the Abbasids and the supporters of Muhammad's descendants, he fled west, reached Tangier and by 788 had settled at Volubilis, Walili in Arabic.

The powerful Awraba Berbers of Volubilis, Muslims in a land where most tribes were Christian, Jewish, Kharijite or pagan, took Idris in and made him their imam, seeing in a Sharifi leader a way to strengthen their own position. Idris I asserted his authority, worked to subdue the Christian and Jewish tribes, and in 789 founded Medinat Fas south-east of Volubilis. In 791 he was poisoned by an Abbasid agent. He left no male heir, but his wife Lalla Kanza bint Uqba al-Awrabi bore his only son shortly after his death; his Arab freedman Rashid raised the boy and held the regency for the Awraba until the Abbasids killed him in 801. The next year Idris II, aged eleven, was proclaimed imam.

Socioeconomy

Qarawiyyin Mosque
Qarawiyyin MosqueAbdel Hassouni, CC BY-SA 4.0

The Idrisids were principally rulers of towns and had little power over most of the country's people, who went on speaking Berber languages and often following heterodox Islamic doctrines. Their achievement was urban. Idris I had founded Fez as a Berber market town; Idris II developed it, moved his government there in 809 and founded the settlement of al-'Aliya, and welcomed two waves of Arab immigration, one from Córdoba in 818 and another from Aghlabid Tunisia in 824, which gave Fez a more Arab character than other Maghrebi cities. Under his successors Islamic and Arabic culture took hold in the towns, more Arab immigrants arrived in the reign of Yahya I (849–863), and the famous mosques of al-Qarawiyyin and al-Andalusiyyin were founded. Fez flourished and became an important religious centre.

Morocco profited in these years from the trans-Saharan trade, which came to be dominated by Muslim, mostly Berber, traders. The Idrisid towns formed part of the wider network that linked the Maghreb with the Sahara and the Sudan to the south, and the Muslim merchants who controlled it in the 9th century carried Islam with their goods. Beyond the walls, the countryside remained the Berbers' own: the vast majority of the population lived outside the Arabized cities, and the Idrisid state never brought the principalities of Sijilmasa, Barghawata and Nekor under its control.

Military

Idris II
Idris IIUnknown author, CC BY-SA 2.5

Idris I spread his authority across much of northern Morocco, as far as Tlemcen, but he was wholly dependent on the Awraba leadership. Idris II broke that dependence by welcoming Arab settlers at Walili and appointing Arabs as his vizier and qadi; when the Awraba leader Ishak plotted against his life with the Aghlabids of Tunisia, Idris had his former protector killed and in 809 left Walili for Fez. The wars that followed his death in 828 were mostly fought within the family. Isa rose against his brother Muhammad and was driven into refuge at Chellah by Umar, who then turned on al-Qasim for refusing to join them and was rewarded with the governorship of Tangier.

The dynasty's enemies multiplied in the late 9th century. In 868 the Berber Khariji Sufri tribes of Madyuna, Ghayata and Miknasa of the Fez region, led by Abd al-Razzaq, formed a common front, defeated Ali ibn Umar from their base at Sefrou and occupied Fez, though the city refused to submit and Yahya III retook it and went on attacking the Sufris. Yahya III himself died in battle in 905 against his kinsman Yahya ibn Idris ibn Umar. In the 10th century the Idrisids became the quarry of Zenata armies fighting for the Fatimids and the Umayyads of Córdoba: the Miknasa under Masala ibn Habus took Fez in 917, Musa ibn Abul 'Afiya besieged the family at the fortress of Hajar an-Nasr, and after breaking the siege the Idrisids defeated the Miknasa troops and later pursued and killed Musa himself.

Governance & Law

Chellah
ChellahThis Photo was taken by Timothy A. Gonsalves. Feel free to use my photos, but please mention me as the author. …, CC BY-SA 4.0

The Idrisid ruler bore the title of imam, conferred on Idris I by the Awraba and on his son by the same tribe in 802. Whether the dynasty was Shi'i is disputed. Idris I had Shi'ite sympathies and, as Encyclopædia Britannica puts it, the state founded by his son was Sunni in matters of religious doctrine; primary sources and contemporary scholars describe the Idrisids as Sunni, while others have called them Shi'a or Zaydi because of their political opposition to the Abbasids. The Awraba who welcomed Idris were Mu'tazila, and he relied widely on Mu'tazila Berber tribes, though how far his community kept that character is unclear.

Succession was the dynasty's weakness. On Idris II's death in 828 his son Muhammad divided the kingdom among seven of his brothers, forming eight Idrisid statelets in Morocco and western Algeria: Muhammad ruled Fez with only nominal power over the rest, al-Qasim Tangier, 'Umar the Sanhaja and Ghumara of the Rif, Isa the Tamesna coast around Chellah, Yahya Hisn Dai, Hamza Walili and 'Ubayd Allah the south with the Lamta tribes and Tamdult, while Agadir, later Tlemcen, remained with the Sulaymanid cousins. Ali ibn Muhammad (836–849) and Yahya I (849–863) ruled competently and the state was stable, but Yahya II divided the realm again and died in uncertain circumstances in 866 after fleeing his palace. The ruling line passed from the sons of Muhammad to Umar's son and then to al-Qasim's.

Global & Regional Impact

The Idrisid period played an important part in the Islamization of Morocco, carrying Islam from the northern coast, where the first Muslim presence had been concentrated, to the Berber tribes of the interior. Fez became a centre of Arabization, and through the trans-Saharan trade that the Idrisid towns joined, and the Muslim merchants who came to dominate it, Islam spread onward to the Sudan. The tombs of Idris I at Moulay Idriss, near Volubilis, and of Idris II in Fez grew into important religious complexes and pilgrimage sites, such as the Zawiya of Moulay Idris II.

The dynasty's deepest legacy was the precedent of Sharifian rule, government by descendants of the Prophet, which inspired the rise of Sharifism in Morocco in the 15th century and is maintained by the country's present ruling dynasty, the 'Alawis. The Idrisids spawned many sharifian families; in the 11th century one branch descended from Umar, the Hammudids, won power in several cities of northern Morocco and southern Spain. From the 14th century local writers portrayed the Idrisids as the starting point of an Islamic Maghrib al-Aqsa, the Furthest West; Ibn Abi Zar's Rawd al-Qirtas promoted continuity between Idrisid and Marinid rule, and both the Marinids and the Wattasids sought at times to associate themselves with the dynasty. In modern Morocco's national narratives the Idrisids are often the first Moroccan dynasty and the beginning of an unbroken tradition of monarchy.

Decline & Fall

The dynasty's power declined slowly from Idris II's death in 828 and the division of his realm. Ali ibn Umar, who took power after Yahya II's death in 866, was beaten in 868 by the Sufri Kharijite front, which held Fez until Yahya III retook it. Yahya III fell in battle in 905 against Yahya IV, a grandson of Umar. In 917 the Miknasa under Masala ibn Habus, acting for their Fatimid allies, attacked Fez and forced Yahya IV to recognize Fatimid suzerainty, then deposed him in 919 or 921. Hassan I al-Hajam, a grandson of al-Qasim, held Fez from 925, but in 927 Musa ibn Abul 'Afiya returned, captured and killed him; the Idrisids never held Fez again.

The family took refuge at Hajar an-Nasr in the north. When Musa turned to the Umayyads of Córdoba in 931 and the Fatimids sent Humayd ibn Yasal against him, the Idrisids broke the siege and later killed Musa. Settled among the Jbala tribes of the Rif, they partly rebuilt their power, acknowledging now Córdoba, now the Fatimids: al-Qasim al-Gannun ruled for the Fatimids from 938 to 948; his son Abul-'Aysh turned to the Umayyads and left for al-Andalus in 954; Jawhar's invasion of 958 restored Fatimid overlordship. In 973 the Umayyad general Ghalib invaded Morocco, expelled the Idrisids and in 974 took al-Hasan ibn al-Qasim al-Gannun and many of his kin as hostages to Córdoba. Al-Hasan's return with Fatimid support in 985 ended in defeat and his assassination on the road to Córdoba.

The Idrisid dynasty, founded when the Alid refugee Idris I was made imam by the Awraba Berbers of Volubilis in 788, built Fez into the Arab and Islamic centre of Morocco and ruled most of the country until division among Idris II's heirs, Kharijite revolt and the proxy wars of the Fatimids and the Umayyads of Córdoba ended its power in 974.

Test yourself

5 questions on this page, from its key events and facts.

The questions open here once the page has loaded.

References

  • Ibn Abi Zar, Rawd al-Qirtas (14th-century chronicle)
  • Charles-André Julien, Histoire de l'Afrique du Nord, des origines à 1830 (Payot, 1994)
  • C. El Briga, "Idrisides", Encyclopédie berbère, vol. 24 (Edisud, 2001)