Idrisid dynasty

The Idrisid dynasty or Idrisids (الأدارسة al-Adārisah) were an Arab Muslim dynasty from 788 to 974, ruling most of present-day Morocco and parts of present-day western Algeria. Named after the founder, Idris I, the Idrisids were an Alid dynasty descended from Muhammad through his grandson Hasan. The Idrisids are traditionally considered to be the founders of the first Moroccan state, setting the stage for subsequent dynasties and states centered in this region. Their reign played an important role in the early Islamization of Morocco and also presided over an increase in Arab immigration and Arabization in major urban centers.

Fleeing the Abbasid Caliphate to the east in the aftermath of the Battle of Fakhkh, Idris I first established himself in 788 at Volubilis in present-day Morocco with the help of local Berber allies. He and his son, Idris II, subsequently founded what became the city of Fez further east. Fez became the capital of an Idrisid state which ruled most of present-day Morocco and part of western Algeria. After Idris II's death, the realm was divided between his rival sons. After a period of conflict, the dynasty's authority resumed and remained relatively stable between 836 and 863. In the late 9th century, however, they faced repeated challenges and local opposition. In the 10th century the region came under the political domination of Zenata tribes who fought proxy battles on behalf of two rival powers in the region, the Fatimid Caliphate and the Umayyad Caliphate of Córdoba. The Idrisids were definitively expelled from Fez in 927, but held onto to a reduced territory in the north of Morocco from their base at Hajar an-Nasr. They were finally defeated and removed from power in 974, and a brief attempt to regain power in 985 also failed.

Founders of the Idrisid state: Idris I and Idris II
By the second half of the 8th century the westernmost regions of the Maghreb, including present-day Morocco, had been effectively independent of the Umayyad Caliphate since the Khariji-led Berber revolts that started in 739–40. The Abbasid Caliphate after 750 had no more success in re-establishing control over Morocco. The overthrow of eastern authority meant that Morocco was controlled by various local Berber tribes and principalities which emerged around this time, such as the Barghwata Confederacy on the Atlantic coast and the Midrarid Emirate in Sijilmasa.

The founder of the Idrisid dynasty was Idris ibn Abdallah (788–791), who traced his ancestry back to Ali ibn Abi Talib (died 661) and his wife Fatimah, daughter of the Islamic prophet, Muhammad. He was the great-grandchild of Hasan ibn Ali. After the Battle of Fakhkh, near Mecca, between the Abbasids and supporters of the descendants of Muhammad, Idris ibn Abdallah fled to the Maghreb. He first arrived in Tangier, the most important city of Morocco at the time, and by 788 he had settled in Volubilis (known as Walili in Arabic).

The powerful Awraba Berbers of Volubilis took in Idris and made him their 'imam' (religious leader). The Awraba tribe had supported Kusayla in his struggle against the Ummayad armies in the 670s and 680s. By the second half of the 8th century they had settled in northern Morocco, where their leader Ishak had his base in the Roman town of Volubilis. By this time the Awraba were already Muslim, but lived in an area where most tribes were either Christian, Jewish, Khariji or pagan. The Awraba seem to have welcomed a Sharifi imam as a way to strengthen their political position. Idris I, who was very active in the political organization of the Awraba, began by asserting his authority and working toward the subjugation of the Christian and Jewish tribes. In 789 he founded a settlement south east of Volubilis, called Medinat Fas. In 791 Idris I was poisoned and killed by an Abbasid agent. Even though he left no male heir, shortly after his death, his wife Lalla Kanza bint Uqba al-Awrabi, bore him his only son and successor, Idris II. Idris' loyal Arab ex-slave and companion Rashid brought up the boy and took on himself the regency of the state, on behalf of the Awraba. In 801 Rashid was killed by the Abbasids. In the following year, at the age of 11 years, Idris II was proclaimed imam by the Awraba.

Even though he had spread his authority across much of northern Morocco, as far west as Tlemcen, Idris I had been completely dependent on the Awraba leadership. Idris II began his rule with the weakening of Awraba power by welcoming Arab settlers in Walili and by appointing two Arabs as his vizier and qadi. Thus he transformed himself from a protégé of the Awraba into their sovereign. The Awraba leader Ishak responded by plotting against his life with the Aghlabids of Tunisia. Idris reacted by having his former protector Ishak killed, and in 809 moved his seat of government from the Awraba dominated Walili to Fes, where he founded a new settlement named Al-'Aliya. Idris II (791–828) developed the city of Fez, established earlier by his father as a Berber market town. Here he welcomed two waves of Arab immigration: one in 818 from Cordoba and another in 824 from Aghlabid Tunisia, giving Fes a more Arab character than other Maghrebi cities. When Idris II died in 828, the Idrisid state spanned from western Algeria to the Sous in southern Morocco and had become the leading state of Morocco, ahead of the principalities of Sijilmasa, Barghawata and Nekor which remained outside their control.

The successors of Idris II
The dynasty's power would slowly decline following Idris II's death. Under his son and successor Muhammad (828–836) the kingdom was divided amongst seven of his brothers, whereby eight Idrisid statelets formed in Morocco and western Algeria. Muhammad himself came to rule Fes, with only nominal power over his brothers. His brother Al-Qasim ruled Tangier and its surroundings. 'Umar ruled over the Sanhaja and the Ghumara in the Rif region. Isa was given control of the coastal Tamesna regions near the Bou Regreg, including Shallah (Chellah), and was based at Wazeqqūr (a town near modern-day Khenifra). Yahya was given Hiṣn Daī (a site probably near modern Beni Mellal). Hamza was given Walili. 'Ubayd Allah (or 'Abd Allah) was given the south, including the territory of the Lamta tribes and a town named Tamdult. Agadir (later Tlemcen) was left under the control of Muhammad Ibn Sulayman, Idris II's cousin and the son of Sulayman, the brother of Idris I whom the latter had left in charge of the city, constituting the Sulaymanid dynasty.

Soon after this territorial division Isa revolted against his brother Muhammad. Muhammad entrusted his other brother Umar to punish him. Umar successfully drove Isa from power, who was forced to take refuge in Chellah. Umar then turned north to punish his other brother, al-Qasim, because the latter had refused to join him and Muhammad against Isa. Al-Qasim fled to Asilah and settled nearby, while Muhammad gave Umar governorship of Tangier as a reward. Upon Umar's death in September or October 835 his son Ali ibn Umar was granted all of his father's domains in turn. Muhammad himself died seven months later in the March or April 836. His son Ali ibn Muhammad inherited his position and ruled for 13 years (836–849) in a competent manner, ensuring the stability of the state. After his death in 849 he was succeeded by his brother Yahya ibn Muhammad (or Yahya I), who also enjoyed a peaceful reign. During this time Islamic and Arabic culture gained a stronghold in the towns and Morocco profited from the trans-Saharan trade, which came to be dominated by Muslim (mostly Berber) traders. The city of Fes also flourished and became an important religious center. During Yahya's reign more Arab immigrants arrived and the famous mosques of al-Qarawiyyin and al-Andalusiyyin were founded. Even so, the Islamic and Arabic culture only made its influence felt in the towns, with the vast majority of Morocco's population still using the Berber languages and often adhering to Islamic heterodox and heretical doctrines. The Idrisids were principally rulers of the towns and had little power over the majority of the country's population.

Decline and fall
After the death of Yahya I in 863 he was succeeded by his less competent son, Yahya II, who divided up the Idrisid realm yet again among the extended families. Yahya II died in uncertain circumstances in 866 after fleeing his palace. After an episode of disorder in Fes his cousin Ali ibn Umar took over power. In 868, under the leadership of the Abd al-Razzaq the Berber Khariji Sufri tribes of Madyuna, Ghayata and Miknasa of the Fes region formed a common front against the Idrisids. From their base in Sefrou they were able to defeat Ali ibn Umar and occupy Fes. Fes refused to submit, however, and another Yahya, the son of al-Qasim, was able to retake the city and establish himself as the new ruler, Yahya III. Thus the ruling line had passed from the sons of Muhammad to the son of Umar and now the sons of al-Qasim.

Yahya III ruled over the entire Idrisid realm and continued to attack the Sufris. In 905 however he died in battle against another family member, Yahya ibn Idris ibn Umar (a grandson of Umar), who then took power as Yahya IV. At this point, however, the Fatimids in the east began to intervene in Morocco, hoping to expand their influence. In 917 the Miknasa and its leader Masala ibn Habus, acting on behalf of their Fatimid allies, attacked Fes and forced Yahya IV to recognize Fatimid suzerainty, before deposing him in 919 or 921. He was succeeded by his cousin Musa ibn Abul 'Afiya, who had already been given charge over the rest of the country. The Idrisid Hassan I al-Hajam, a grandson of al-Qasim, managed to wrest control of Fez from 925 but in 927 Musa returned, captured Hassan and killed him, marking the last time the Idrisids held power in Fes.

From Fes, the Miknasa began pursuing the Idrisid family across Morocco. The family took refuge at the fortress of Hajar an-Nasr in northern Morocco, where the Miknasa besieged them. Soon after, however, civil war broke out among the Miknasa when Musa switched allegiance to the Umayyads of Cordoba in 931 in an attempt to gain more independence. The Fatimids sent Humayd ibn Yasal (or Hamid ), the nephew of Masala ibn Habus, to confront Musa, defeating him in 933 and forcing him to fall back into line. The Idrisids took advantage of the situation to break the siege of their fortress and defeat the Mikanasa Zenata troops. Once the Fatimids were gone, however, Musa once again threw off their authority and recognized the Umayyad caliph. The Fatimids sent their general Maysur to confront him again, and this time he fled. He was pursued and killed by the Idrisids.

After this Idrisids settled among the Jbala tribes in the Rif region of north-west Morocco where they partially rebuilt their power base from Hajar an-Nasr, alternately acknowledging either the Umayyads of Cordoba (under Abd ar-Rahman III) or the Fatimids as overlords. Al-Qasim al-Gannun ibn Muhammad ruled here from 938 until 948 in the name of the Fatimids. His son and successor, Ahmad, known as Abul-'Aysh, recognized the Umayyads instead but ran afoul of them when he refused to let them occupy Tangier. He was besieged there and forced to retreat, retaining only the areas around al-Basra and Asilah while the Umayyads occupied the rest of northern Morocco. He eventually left for Al-Andalus, leaving his brother Hasan ibn al-Qasim al-Gannun as the new leader in 954. In 958 the Fatimids sent a new general, Jawhar, to invade Morocco. His success forced the Idrisids to again accept Fatimid overlordship. Soon afterwards, however, when Jawhar and the Fatimids were busy taking control of Egypt, the Umayyads made a comeback. In 973 their general, Ghalib, invaded Morocco. The Idrisids were expelled from their territories and al-Hasan, along with many other Idrisids or their sons, were taken as hostages to Cordoba in 974. The remaining Idrisids in Morocco acknowledged Umayyad rule. Al-Hasan was later expelled from Cordoba and fled to Egypt, which was now under Fatimid rule. In 979 Buluggin ibn Ziri, the Fatimid governor of Ifriqiya (after the Fatimid Caliphs had their capital to Cairo), returned to defeat the Umayyads and impose Fatimid overlordship in the western Maghreb again. In 985 he returned to Morocco with Fatimid support, but that same year he was defeated by another Umayyad general sent by al-Mansur and then assassinated on the way to Cordoba. This brought a final end to the Idrisid dynasty. The Umayyads kept control over northern Morocco until their caliphate's collapse in the early 11th century. Following this, Morocco was dominated by various Zenata Berber tribes. Until the rise of the Sanhaja Almoravids later in the century, the Maghrawa controlled Fes, Sijilmasa and Aghmat while the Banu Ifran ruled over Tlemcen, Salé (Chellah), and the Tadla region.

Religion
According to Encyclopædia Britannica, "although Idrīs I had Shīʿite sympathies, the state founded by his son was Sunni in matters of religious doctrine." Primary source material and contemporary scholars have described them as a Sunni Muslim dynasty. Certain contemporary academics have described them as Shi'a or Zaydi Shi'a to one extent or another, most likely because of their political affiliation. The Idrisids were political opponents of the Abbasid Caliphate. Others have criticized this claim for conflating Shia theology with a political movement in a historical period where there was no Shia theology distinct from Sunni theology in this area as of yet. Amira Bennison argues that Idrisid coinage suggests that Idris I portrayed himself as a religious leader whose legitimacy was based on his descent from Muhammad, which Bennison describes as a "proto-Shi'i or 'Alid position."

The Awraba Berbers who welcomed Idris I in Volubilis were Muʿtazila and Idris relied widely on the support of Muʿtazila Berber tribes to found his state. He is also likely to have had ties to Muʿtazila figures in the Hijaz and further east, as he was accompanied on his journey to the Maghreb by a Muʿtazila khatib from Basra who aided him in gaining the support of the tribes. It is unclear, however, to what extent the community he established was Muʿtazila in character.

Legacy
Despite having fallen from power, the Idrisids spawned many sharifian families which continued to be present for centuries to come. Some Moroccans today still claim descent from them. In the 11th century, an Idrisid family descended from Umar (son of Idris II), the Hammudids, were able to gain power in several cities of northern Morocco and southern Spain.

In Fes and in the town of Moulay Idriss (near Volubilis), the tombs of Idris II and Idris I, respectively, eventually developed into important religious complexes and pilgrimage sites, like the Zawiya of Moulay Idris II. Several prominent sharifian families in Fez traced their lineages to Idris I, and some of these played a role in maintaining or rebuilding the Zawiya of Idris II in the city.

The Idrisid period also played an important role in the Islamization of the region, particularly in the spread of Islam to the Berber tribes that occupied the interior territories of present-day Morocco, outside the northern coastal regions where the earliest Muslim presence was initially concentrated. The new city of Fes also became a center of Arabization that spread to some of the surrounding Berber tribes in the area. Idrisid towns also formed a part of the wider trade network that linked the Maghreb with the Sahara and the Sudan region (south of the Sahara). This trade network and the Muslim merchants who came to dominate it in the 9th century were important in turn to the Islamization of the Sudan.

The Idrisid state set a precedent for Sharifian rule, which inspired the rise of Sharifism in Morocco during the 15th century and which is maintained by the present-day ruling dynasty of Morocco, the 'Alawis. From the 14th century, local writers began to portray the Idrisids as the starting point of an Islamic Maghrib al-Aqsa ("Furthest West", corresponding to present-day Morocco ). Both the Marinid dynasty (13th–15th centuries) and the Wattasid dynasty (15th–16th centuries) attempted at times to associate themselves with the Idrisid dynasty as a way to legitimize their own rule. The Rawd al-Qirtas, written by Ibn Abi Zar in the 14th century, is one of the best-known chronicles of this period and promoted the idea of continuity between Idrisid rule and contemporary Marinid rule, while at the same time downplaying the potential Shi'a character of Idris I. In the national narratives of modern Morocco, the Idrisids are often portrayed as the first Moroccan dynasty and as the start of an uninterrupted tradition of monarchy to the present day.

Rulers
Idrisid rule in northern Morocco:
 * Idris I – (788–791)
 * Idris II – (791–828)
 * Muhammad ibn Idris – (828–836)
 * Ali (I) ibn Muhammad – (836–849)
 * Yahya (I) ibn Muhammad – (849–863)
 * Yahya (II) ibn Yahya – (863–866)
 * Ali (II) ibn Umar – (866–?)
 * Yahya (III) ibn al-Qasim – (?–905)
 * Yahya (IV) ibn Idris – (905–919 or 921)
 * Miknasa control on behalf of the Fatimids – (919–925)
 * Al-Hajjam al-Hasan ibn Muhammad ibn al-Qasim – (925–927), last Idrisid ruler in Fes
 * Al-Qasim Gannun – (938–948)
 * Abul-Aish Ahmad – (948–954)
 * Al-Hasan ibn al-Qasim – (954–974, 985)