Skip to main content
🌍Realms10 min read

Idrisid Dynasty

The first Moroccan state—an Arab Muslim dynasty of Hasanid Alid descent that ruled from 788 to 974 CE, founding the city of Fez and establishing the sharifian tradition in Morocco.

Idrisid Dynasty

The Idrisid dynasty (al-Adārisah) was the first independent Islamic state in Morocco, founded in 788 CE by Idris I ibn Abdallah, a Hasanid sharif who fled Abbasid persecution after the Battle of Fakhkh. Generally regarded by historians as the first Moroccan state, the Idrisids established the sharifian tradition—rule by descendants of the Prophet Muhammad—that would become a defining feature of Moroccan political legitimacy for centuries to come. Under Idris II, the dynasty founded the city of Fez, which grew into the spiritual and intellectual capital of Morocco.


Quick Facts

AttributeValue
TypeHasanid Alid Dynasty / Imamate
Period788–974 CE
RegionNorthern Morocco (and parts of western Algeria)
CapitalWalili (788–808), Fez (808–927), Hajar an-Nasr (927–985)
FounderIdris I ibn Abdallah (Idris I)
DynastyIdrisid (al-Adārisah)
ReligionIslam (Zaydi Shia / Sunni — disputed)
Duration186 years

The Founders: Idris I & Idris II

Idris I: The Exiled Sharif (788–791)

Idris I was a great-grandson of Hasan ibn Ali (the grandson of Muhammad) who survived the Abbasid massacre of Alids at the Battle of Fakhkh (786 CE) near Mecca. Fleeing westward across North Africa, he eventually reached Volubilis (Walili), where the Awraba Berbers—a powerful tribe chafing under Abbasid suzerainty—declared him their imam in 788 CE.

Within three years, Idris I had:

  • United the Awraba and allied Berber tribes
  • Extended his authority over northern Morocco and parts of the Atlantic plain
  • Begun minting coins establishing his legitimacy
  • Laid the foundations for what would become the city of Fez

The Abbasid Caliph Harun al-Rashid saw Idris’s growing power as a threat. In 791 CE, the caliph dispatched an agent named Sulayman ibn Jarir al-Shammakh who infiltrated Idris’s court, poisoned him, and fled. Idris I died after a reign of only three years—but his posthumous son would carry his legacy forward.

Idris II: The Builder (791–828)

Born months after his father’s assassination, Idris II was raised by the Awraba chieftain Rashid and later by his mother, Kanz al-Awrabiya. In 803 CE, at age 12, he was formally proclaimed imam. Under his rule, the Idrisid state reached its zenith.

Idris II’s greatest achievement was the foundation and expansion of Fez (founded c. 808 CE). He:

  • Established Fez as the capital, replacing Volubilis
  • Attracted Arab immigrants from al-Andalus (800 families) and Ifriqiya
  • Built the first mosques and administrative quarters
  • Consolidated control over northern Morocco and parts of western Algeria
  • Established the framework for a central government outside the Berber tribal system

By the time of his death in 828 CE, the Idrisid state was the dominant power in northern Morocco, though it never controlled all of the country—the Barghawata, Sijilmasa, and Nekor remained independent.


History

The Division & Fragmentation (828–863)

Upon Idris II’s death, the kingdom was divided among his eight sons, a decision that permanently fractured Idrisid power:

SonTerritory
MuhammadFez (senior heir)
IsaChellah / Sale region
AhmadTaza / Rif region
UmarTangier and surrounding areas
al-QasimWad Zam / Tadla
AliDraa Valley
YahyaNorthern Morocco (later ruled)
AbdullahUncertain / minor territory

Muhammad retained Fez but could not control his brothers. Internecine conflict weakened the dynasty, and local Berber tribes reasserted autonomy.

Restoration & Stability (863–900)

After decades of fragmentation, the dynasty experienced a modest revival under Yahya ibn Muhammad (r. 863–866) and especially Ali ibn Umar (r. 866–883), who managed to reassert authority over most of the Idrisid domains. Yahya ibn al-Qasim (r. 883–904) maintained stability, but the dynasty’s internal divisions had created permanent weakness.

The Zenata Ascendancy (900–974)

The 10th century saw the Idrisids caught between two external powers: the Fatimid Caliphate (Isma’ili Shia) and the Umayyad Caliphate of Córdoba (Sunni Maliki). Local Zenata Berber tribes—the Miknasa and Maghrawa—fought proxy wars on behalf of these powers, reducing the Idrisids to pawns.

YearEvent
909Fatimid revolution begins in Ifriqiya
917Miknasa (Fatimid allies) expel Idrisids from Fez
925Idrisids briefly retake Fez with Umayyad help
927Definitively expelled from Fez
927–74Reduced to Hajar an-Nasr in northern Rif
974Defeated by Umayyad forces (who had been their allies)
985Final Idrisid uprising fails

The End

The last Idrisid emir, al-Hasan ibn al-Qasim, was captured by the Umayyads in 974 and died in captivity. A final attempt to restore Idrisid authority in 985 under al-Hasan ibn Gannun also failed, ending the dynasty’s rule permanently. The Zenata tribes and eventually the Almoravids would fill the power vacuum.


Rulers Chronology

#RulerReignKey Events
1Idris I ibn Abdallah788–791Founder; poisoned by Abbasid agent
2Idris II803–828Founded Fez; peak of Idrisid power
3Muhammad ibn Idris828–836Senior son; ruled from Fez
4Ali ibn Muhammad836–848Religious / pious emir
5Yahya ibn Muhammad848–864First of the restoration period
6Ali ibn Umar866–883Second restoration; stable rule
7Yahya ibn al-Qasim883–904Continued stability
8Yahya ibn Idris904–917Expelled by Miknasa
9Fragmented leadership917–925Interregnum / exile
10al-Hasan I ibn Muhammad925–927Brief restoration
11al-Qasim ibn Ibrahim927–?Ruled from Hajar an-Nasr
12Abu al-Aysh Ahmad?–960Last effective Idrisid emir
13al-Hasan II ibn al-Qasim954–974Captured and killed by Umayyads

Cultural & Religious Significance

Islamization of Morocco

The Idrisids played a pivotal role in the Islamization of Morocco. While Berber revolts against the Umayyads had often taken on Kharijite forms, the Idrisids presented Islam through the lens of sharifian descent—a figure who combined religious authority with Arab lineage and Berber alliance.

The Founding of Fez

Fez became the lasting legacy of the Idrisid dynasty:

AchievementDescription
FoundationFounded c. 808 CE by Idris II
Andalusian Settlement800 families from Córdoba settled west of the Fez River
Kairouan SettlementRefugees from Ifriqiya settled east of the river
Qarawiyyin MosqueFounded 859 CE by Fatima al-Fihri (under Idrisid rule)
Political CenterCapital of the Idrisid state and later dynasties
Intellectual HubBecame one of the great centers of Islamic learning

Zaydi Shia or Sunni? The Doctrinal Question

The religious orientation of the Idrisids is a matter of scholarly debate:

ViewEvidence
Zaydi ShiaIdris I was an Alid; Zaydis recognize Alid imams; early sources describe them as Shia
Sunni MalikiLater Idrisids adopted Malikism; Fez became a Maliki center
Syncretic / PragmaticIdris I adapted to local Berber contexts; doctrine may have evolved over time

The most widely accepted view is that the early Idrisids had Zaydi Shia leanings but that the dynasty pragmatically shifted toward Sunni Malikism under later rulers to gain legitimacy with the Umayyads of Córdoba.


Geography

Core Territory

  • Walili (Volubilis) — First capital (Roman ruins repurposed)
  • Fez — Capital founded 808 CE; twin-city layout
  • Hajar an-Nasr — Last stronghold in the Rif

Extent at Peak

DirectionExtent
NorthMediterranean coast (Tangier to the Rif)
SouthAtlas Mountains foothills
EastParts of western Algeria (Tlemcen region)
WestAtlantic plain (Sale to the Abi al-Khasib River)

Natural Features

  • Fez River (Wadi Fez) — Divided the two halves of the city
  • Atlas Mountains — Southern boundary
  • Atlantic Coast — Western access
  • Rif Mountains — Eastern / northern frontier

Economy

Agriculture

CropRegion
OlivesFez region, Atlantic plains
CerealsSaïs plain, Gharb
FruitsFigs, grapes, pomegranates
SaffronHigh-value export

Coinage

The Idrisids minted silver dirhams bearing:

  • The name of the ruling Idrisid emir
  • The date and mint location
  • The shahada and Alid genealogical claims
  • Inscriptions in Kufic Arabic script

Trade

PartnerGoods
Al-AndalusSlaves, leather, amber
IfriqiyaGrain, oil, textiles
Sub-Saharan AfricaGold, slaves (via Sijilmasa)
EuropeLuxury goods, weapons

Legacy

The Sharifian Tradition

The Idrisids established the principle of sharifian rule—governance by descendants of the Prophet Muhammad—which became the foundational legitimizing ideology of subsequent Moroccan dynasties:

  • Saadians (16th century) — Also claimed sharifian descent
  • Alaouites (17th century–present) — Currently rule Morocco; also Hasanid Alids

Every major Moroccan dynasty since the Idrisids has emphasized its connection to the Prophet’s lineage.

The Foundation of Fez

Fez remains the cultural and spiritual heart of Morocco. The Qarawiyyin Mosque, founded during the Idrisid period (859 CE), is the oldest continuously operating university in the world.

Modern Reception

  • Celebrated as the founders of the first Moroccan state
  • Idris I’s tomb in Moulay Idriss Zerhoun is a major pilgrimage site
  • Fez designated a UNESCO World Heritage Site
  • Symbol of Moroccan national identity and Islamic legitimacy

Realms

Characters

Events

Concepts


Sources

  • Ibn Khaldun, Muqaddimah & History of the Berbers
  • al-Bakri, Kitab al-Masalik wa al-Mamalik
  • Ibn Hawqal, Kitab Surat al-Ard
  • al-Ya’qubi, Kitab al-Buldan
  • Abun-Nasr, Jamil M., A History of the Maghrib in the Islamic Period (1987)
  • Eustache, D., “Idrisid dynasty” in Encyclopaedia of Islam
  • Britannica, “Idrisid Dynasty”
  • Archnet, Timeline: Idrisid (791–974)
  • New World Encyclopedia, “Idrisid Dynasty”