|History of Morocco|
History of human habitation in Morocco spans since Lower Paleolithic, with the earliest known being Jebel Irhoud. Much later Morocco was part of Iberomaurusian culture, including Taforalt. It dates from the establishment of Mauretania and other ancient Berber kingdoms, to the establishment of the Moroccan state by the Idrisid dynasty followed by other Islamic dynasties, through to the colonial and independence periods.
Archaeological evidence has shown that the area was inhabited by hominids at least 400,000 years ago. The recorded history of Morocco begins with the Phoenician colonization of the Moroccan coast between the 8th and 6th centuries BCE, although the area was inhabited by indigenous Berbers for some two thousand years before that. In the 5th century BCE, the city-state of Carthage extended its hegemony over the coastal areas. They remained there until the late 3rd century BCE, while the hinterland was ruled by indigenous monarchs. Indigenous Berber monarchs ruled the territory from the 3rd century BCE until 40 CE, when it was annexed to the Roman Empire. In the mid-5th century CE, it was overrun by Vandals, before being recovered by the Byzantine Empire in the 6th century.
The region was conquered by the Muslims in the early 8th century CE, but broke away from the Umayyad Caliphate after the Berber Revolt of 740. Half a century later, the Moroccan state was established by the Idrisid dynasty. Under the Almoravid and the Almohad dynasties, Morocco dominated the Maghreb and Muslim Spain. The Saadi dynasty ruled the country from 1549 to 1659, followed by the Alaouites from 1667 onwards, who have since been the ruling dynasty of Morocco.
See also: List of prehistoric sites in Morocco
Archaeological excavations have demonstrated the presence of people in Morocco that were ancestral to Homo sapiens, as well as the presence of early human species. The fossilized bones of a 400,000-year-old early human ancestor were discovered in Salé in 1971. The bones of several very early Homo sapiens were excavated at Jebel Irhoud in 1991, these were dated using modern techniques in 2017 and found to be at least 300,000 years old, making them the oldest examples of Homo sapiens discovered anywhere in the world. In 2007, small perforated seashell beads were discovered in Taforalt that are 82,000 years old, making them the earliest known evidence of personal adornment found anywhere in the world.
In Mesolithic times, between 20,000 and 5000 years ago, the geography of Morocco resembled a savanna more than the present arid landscape. While little is known of settlements in Morocco during that period, excavations elsewhere in the Maghreb region have suggested an abundance of game and forests that would have been hospitable to Mesolithic hunters and gatherers, such as those of the Capsian culture.
During the Neolithic period, which followed the Mesolithic, the savanna was occupied by hunters and herders. The culture of these Neolithic hunters and herders flourished until the region began to desiccate after 5000 BCE as a result of climatic changes. The coastal regions of present-day Morocco in the early Neolithic shared in the Cardium pottery culture that was common to the entire Mediterranean region. Archaeological excavations have suggested that the domestication of cattle and the cultivation of crops both occurred in the region during that period. In the Chalcolithic period, or the copper age, the Beaker culture reached the north coast of Morocco.
The arrival of Phoenicians on the Moroccan coast heralded many centuries of rule by foreign powers in the north of Morocco. Phoenician traders penetrated the western Mediterranean before the 8th century BCE, and soon after[when?] set up depots for salt and ore along the coast and up the rivers of the territory of present-day Morocco. Major early settlements of the Phoenicians included those at Chellah, Lixus and Mogador. Mogador is known to have been a Phoenician colony by the early 6th century BCE.
By the 5th century BCE, the state of Carthage had extended its hegemony across much of North Africa. Carthage developed commercial relations with the Berber tribes of the interior, and paid them an annual tribute to ensure their cooperation in the exploitation of raw materials.
Mauretania was an independent tribal Berber kingdom on the Mediterranean coast of north Africa, corresponding to northern modern-day Morocco from about the 3rd century BCE. The earliest known king of Mauretania was Bocchus I, who ruled from 110 BCE to 81 BCE[dubious ]. Some of its earliest recorded history relates to Phoenician and Carthaginian settlements such as Lixus and Chellah. The Berber kings ruled inland territories overshadowing the coastal outposts of Carthage and Rome, often as satellites, allowing Roman rule to exist. It became a client of the Roman empire in 33 BCE, then a full province after Emperor Caligula had the last king, Ptolemy of Mauretania, executed (39 CE or 40).
Rome controlled the vast, ill-defined territory through alliances with the tribes rather than through military occupation, expanding its authority only to those areas that were economically useful or that could be defended without additional manpower. Hence, Roman administration never extended outside the restricted area of the northern coastal plain and valleys. This strategic region formed part of the Roman Empire, governed as Mauretania Tingitana, with the city of Volubilis as its capital.
During the time of the Roman emperor Augustus, Mauretania was a vassal state, and its rulers, such as Juba II, controlled all the areas south of Volubilis. But the effective control of Roman legionaries reached as far as the area of Sala Colonia (the castra "Exploratio Ad Mercurios" south of Sala is the southernmost discovered up to now). Some historians believe the Roman frontier reached present-day Casablanca, known then as Anfa, which had been settled by the Romans as a port.
During the reign of Juba II, the Augustus founded three colonies, with Roman citizens, in Mauretania close to the Atlantic coast: Iulia Constantia Zilil, Iulia Valentia Banasa, and Iulia Campestris Babba. Augustus would eventually found twelve colonies in the region. During that period, the area controlled by Rome experienced significant economic development, aided by the construction of Roman roads. The area was initially not completely under the control of Rome, and only in the mid-2nd century was a limes built south of Sala extending to Volubilis. Around 278 CE the Romans moved their regional capital to Tangier and Volubilis started to lose importance.
Christianity was introduced to the region in the 2nd century CE, and gained converts in the towns and among slaves as well as among Berber farmers. By the end of the 4th century, the Romanized areas had been Christianized,[clarification needed] and inroads had been made among the Berber tribes, who sometimes converted en masse. Schismatic and heretical movements also developed, usually as forms of political protest. The area had a substantial Jewish population as well.
Main article: Muslim conquest of the Maghreb
The Muslim conquest of the Maghreb, that started in the middle of the 7th century CE, was achieved in the early 8th century. It brought both the Arabic language and Islam to the area. Although part of the larger Islamic Empire, Morocco was initially organized as a subsidiary province of Ifriqiya, with the local governors appointed by the Muslim governor in Kairouan.
The indigenous Berber tribes adopted Islam, but retained their customary laws. They also paid taxes and tribute to the new Muslim administration.
Main article: Berber Revolt
In 740 CE, spurred on by puritanical Kharijite agitators, the native Berber population revolted against the ruling Umayyad Caliphate. The rebellion began among the Berber tribes of western Morocco, and spread quickly across the region. Although the insurrection petered out in 742 CE before it reached the gates of Kairouan, neither the Umayyad rulers in Damascus nor their Abbasid successors managed to re-impose their rule on the areas west of Ifriqiya. Morocco passed out of Umayyad and Abbasid control, and fragmented into a collection of small, independent Berber states such as Berghwata, Sijilmassa and Nekor, in addition to Tlemcen and Tahert in what is now western Algeria. The Berbers went on to shape their own version of Islam. Some, like the Banu Ifran, retained their connection with radical puritan Islamic sects, while others, like the Berghwata, constructed a new syncretic faith.
Main article: Barghawata
The Barghawatas were a confederation of Berber groups inhabiting the Atlantic coast of Morocco, who belonged to the Masmuda Berber tribal division. After allying with the Sufri Kharijite rebellion in Morocco against the Umayyads, they established an independent state (CE 744 – 1058) in the area of Tamesna on the Atlantic coast between Safi and Salé under the leadership of Tarif al-Matghari.
The Midrarid dynasty or Banu Midrar were a Berber dynasty that ruled the Tafilalt region and founded the city of Sijilmasa in 757.
Sijilmasa was a medieval Moroccan city and trade entrepôt at the northern edge of the Sahara desert. The ruins of the town lie for 8 kilometres (5 mi) along the River Ziz in the Tafilalt oasis near the town of Rissani. The town's history was marked by several successive invasions by Berber dynasties. Up until the 14th century, as the northern terminus for the western trans-Sahara trade route, it was one of the most important trade centres in the Maghreb during the Middle Ages.
Main article: Kingdom of Nekor
The Kingdom of Nekor was an emirate centered in the Rif area of Morocco. Its capital was initially located at Temsaman, and then moved to Nekor. The polity was founded in 710 CE by Salih I ibn Mansur through a Caliphate grant. Under his guidance, the local Berber tribes adopted Islam, but later deposed him in favor of one az-Zaydi from the Nafza tribe. They subsequently changed their mind and reappointed Ibn Mansur. His dynasty, the Banū Sālih, thereafter ruled the region until 1019.
In 859, the kingdom became subject to a 62 ship-strong group of Vikings, who defeated a Moorish force in Nekor that had attempted to interfere with their plunderings in the area. After staying for eight days in Morocco, the Vikings went back to Spain and continued up the east coast.
Main article: Idrisid dynasty
The Idrisid dynasty was a Muslim polity centered in Morocco, which ruled from 788 to 974. Named after the founder Idriss I, the great-grandchild of Hasan ibn Ali, the Idrisids are believed by some historians to be the founders of the first Moroccan state.
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–740. The Abbasid Caliphate after 750 had no more success in re-establishing control over Morocco.: 41 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.: 81 After the Battle of Fakhkh, near Mecca, between the Abbasids and supporters of the descendants of the prophet 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).: 51
The powerful Awraba Berbers of Volubilis took in Idris and made him their 'imam' (religious leader).: 51 : 81 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.: 51
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.: 51–52 : 86
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 Isa, who was given control of the coastal Tamesna regions near the Bou Regreg from his base at Chellah, quickly revolted against him. Muhammad entrusted his brother Umar, who had received the territories around the Rif, to punish Isa. Umar successfully drove Isa from power, who was forced to take refuge in Chellah, and then turned north to punish his other brother al-Qasim at Tangier because he had earlier 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.: 52 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.: 52
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.: 52 
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.: 63 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.: 63 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-Gannoun 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-Gannoun 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.: 75 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.: 91 : 82 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.: 91
Despite having fallen from power, the Idrisids nonetheless 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 (e.g. the Zawiya of Moulay Idris II). Several prominent sharifian families in Fez traced their lineages to Idris I,: 488 and some of these played a role in maintaining or rebuilding the Zawiya of Idris II in the city.
Main article: Almoravid dynasty
The Almoravid dynasty (c.1060–1147) originated among the Lamtuna nomadic Berber tribe belonging to the Sanhaja. They succeeded in unifying Morocco after it had been divided among several Zenata principalities in the late 10th century, and annexed the Emirate of Sijilmasa and the Barghawata (Tamesna) into their realm.
Under Yusuf ibn Tashfin, the Almoravids were invited by the Muslim taifa princes of Al-Andalus to defend their territories from the Christian kingdoms. Their involvement was crucial in preventing the fall of Al-Andalus. After having succeeded in repelling Christian forces in 1086, Yusuf returned to Iberia in 1090 and annexed most of the major taifas.
Almoravid power began to decline in the first half of the 12th century, as the dynasty was weakened after its defeat at the battle of Ourique and because of the agitation of the Almohads. The conquest of the city of Marrakech by the Almohads in 1147 marked the fall of the dynasty. However, fragments of the Almoravids (the Banu Ghaniya) continued to struggle in the Balearic Islands and in Tunisia.
The Berbers of the Tamazgha in the early Middle Ages could be roughly classified into three major groups: the Zenata across the north, the Masmuda concentrated in central Morocco, and the Sanhaja, clustered in two areas: the western part of the Sahara and the hills of the eastern Maghreb. The eastern Sanhaja included the Kutama Berbers, who had been the base of the Fatimid rise in the early 10th century, and the Zirid dynasty, who ruled Ifriqiya as vassals of the Fatimids after the latter moved to Egypt in 972. The western Sanhaja were divided into several tribes: the Gazzula and the Lamta in the Draa valley and the foothills of the Anti-Atlas range; further south, encamped in the western Sahara, were the Massufa, the Lamtuna and the Banu Warith; and most southerly of all, the Gudala, in littoral Mauritania down to the borderlands of the Senegal River.
The western Sanhaja had been converted to Islam some time in the 9th century. They were subsequently united in the 10th century and, with the zeal of new converts, launched several campaigns against the "Sudanese" (pagan peoples of sub-Saharan Africa). Under their king Tinbarutan ibn Usfayshar, the Sanhaja Lamtuna erected (or captured) the citadel of Awdaghust, a critical stop on the trans-Saharan trade route. After the collapse of the Sanhaja union, Awdagust passed over to the Ghana empire; and the trans-Saharan routes were taken over by the Zenata Maghrawa of Sijilmassa. The Maghrawa also exploited this disunion to dislodge the Sanhaja Gazzula and Lamta out of their pasturelands in the Sous and Draa valleys. Around 1035, the Lamtuna chieftain Abu Abdallah Muhammad ibn Tifat (alias Tarsina), tried to reunite the Sanhaja desert tribes, but his reign lasted less than three years.
Around 1040, Yahya ibn Ibrahim, a chieftain of the Gudala (and brother-in-law of the late Tarsina), went on pilgrimage to Mecca. On his return, he stopped by Kairouan in Ifriqiya, where he met Abu Imran al-Fasi, a native of Fes and a jurist and scholar of the Sunni Maliki school. At this time, Ifriqiya was in ferment. The Zirid ruler al-Muizz ibn Badis, was openly contemplating breaking with his Shi'ite Fatimid overlords in Cairo, and the jurists of Kairouan were agitating for him to do so. Within this heady atmosphere, Yahya and Abu Imran fell into conversation on the state of the faith in their western homelands, and Yahya expressed his disappointment at the lack of religious education and negligence of Islamic law among his southern Sanhaja people. With Abu Imran's recommendation, Yahya ibn Ibrahim made his way to the ribat of Waggag ibn Zelu in the Sous valley of southern Morocco, to seek out a Maliki teacher for his people. Waggag assigned him one of his residents, Abdallah ibn Yasin.
Abdallah ibn Yasin was a Gazzula Berber, and probably a convert rather than a born Muslim. His name can be read as "son of Ya Sin" (the title of the 36th Sura of the Qur'an), suggesting he had obliterated his family past and was "re-born" of the Holy Book. Ibn Yasin certainly had the ardor of a puritan zealot; his creed was mainly characterized by a rigid formalism and a strict adherence to the dictates of the Qur'an, and the Orthodox tradition. (Chroniclers such as al-Bakri allege Ibn Yasin's learning was superficial.) Ibn Yasin's initial meetings with the Gudala people went poorly. As he had more ardor than depth, Ibn Yasin's arguments were disputed by his audience. He responded to questioning with charges of apostasy and handed out harsh punishments for the slightest deviations. The Gudala soon had enough and expelled him almost immediately after the death of his protector, Yahya ibn Ibrahim, sometime in the 1040s.
Ibn Yasin, however, found a more favorable reception among the neighboring Lamtuna people. Probably sensing the useful organizing power of Ibn Yasin's pious fervor, the Lamtuna chieftain Yahya ibn Umar al-Lamtuni invited the man to preach to his people. The Lamtuna leaders, however, kept Ibn Yasin on a careful leash, forging a more productive partnership between them. Invoking stories of the early life of Muhammad, Ibn Yasin preached that conquest was a necessary addendum to Islamicization, that it was not enough to merely adhere to God's law, but necessary to also destroy opposition to it. In Ibn Yasin's ideology, anything and everything outside of Islamic law could be characterized as "opposition". He identified tribalism, in particular, as an obstacle. He believed it was not enough to urge his audiences to put aside their blood loyalties and ethnic differences, and embrace the equality of all Muslims under the Sacred Law, it was necessary to make them do so. For the Lamtuna leadership, this new ideology dovetailed with their long desire to refound the Sanhaja union and recover their lost dominions. In the early 1050s, the Lamtuna, under the joint leadership of Yahya ibn Umar and Abdallah ibn Yasin—soon calling themselves the al-Murabitin (Almoravids)—set out on a campaign to bring their neighbors over to their cause.
The Almohad movement originated with Ibn Tumart, a member of the Masmuda, a Berber tribal confederation of the Atlas Mountains of southern Morocco. At the time, Morocco, western Algeria and Spain (al-Andalus), were under the rule of the Almoravids, a Sanhaja Berber dynasty. Early in his life, Ibn Tumart went to Spain to pursue his studies, and thereafter to Baghdad to deepen them. In Baghdad, Ibn Tumart attached himself to the theological school of al-Ash'ari, and came under the influence of the teacher al-Ghazali. He soon developed his own system, combining the doctrines of various masters. Ibn Tumart's main principle was a strict unitarianism (tawhid), which denied the independent existence of the attributes of God as being incompatible with His unity, and therefore a polytheistic idea. Ibn Tumart represented a revolt against what he perceived as anthropomorphism in Muslim orthodoxy. His followers would become known as the al-Muwaḥḥidūn ("Almohads"), meaning those who affirm the unity of God.
Around 1124, Ibn Tumart erected the ribat of Tinmel, in the valley of the Nfis in the High Atlas, an impregnable fortified complex, which would serve both as the spiritual center and military headquarters of the Almohad movement. For the first eight years, the Almohad rebellion was limited to a guerilla war along the peaks and ravines of the High Atlas. In early 1130, the Almohads finally descended from the mountains for their first sizeable attack in the lowlands. It was a disaster. The Almohads swept aside an Almoravid column that had come out to meet them before Aghmat, and then chased their remnant all the way to Marrakesh. They laid siege to Marrakesh for forty days until, in April (or May) 1130, the Almoravids sallied from the city and crushed the Almohads in the bloody Battle of al-Buhayra (named after a large garden east of the city). The Almohads were thoroughly routed, with huge losses. Half their leadership was killed in action, and the survivors only just managed to scramble back to the mountains.
Ibn Tumart died shortly after, in August 1130. That the Almohad movement did not immediately collapse after such a devastating defeat and the death of their charismatic Mahdi, is likely due to the skills of his successor, Abd al-Mu'min.: 70 Ibn Tumart's death was kept a secret for three years, a period which Almohad chroniclers described as a ghayba or "occultation". This period likely gave Abd al-Mu'min time to secure his position as successor to the political leadership of the movement.: 70 Although a Zenata Berber from Tagra (Algeria), and thus an alien among the Masmuda of southern Morocco, Abd al-Mu'min nonetheless saw off his principal rivals and hammered wavering tribes back to the fold. Three years after Ibn Tumart's death he was officially proclaimed "Caliph".
Abd al-Mu'min then came forward as the lieutenant of the Mahdi Ibn Tumart. Between 1130 and his death in 1163, Abd al-Mu'min not only rooted out the Murabits (Almoravids), but extended his power over all northern Africa as far as Egypt, becoming amir of Marrakesh in 1149.
Al-Andalus followed the fate of Africa. Between 1146 and 1173, the Almohads gradually wrested control from the Murabits over the Moorish principalities in Iberia. The Almohads transferred the capital of Muslim Iberia from Córdoba to Seville. They founded a great mosque there; its tower, the Giralda, was erected in 1184 to mark the accession of Ya'qub I. The Almohads also built a palace there called Al-Muwarak on the site of the modern day Alcázar of Seville.
The Almohad princes had a longer and more distinguished career than the Murabits. The successors of Abd al-Mumin, Abu Yaqub Yusuf (Yusuf I, ruled 1163–1184) and Abu Yusuf Yaqub al-Mansur (Yaʻqūb I, ruled 1184–1199), were both able men. Initially their government drove many Jewish and Christian subjects to take refuge in the growing Christian states of Portugal, Castile, and Aragon. Ultimately they became less fanatical than the Murabits, and Ya'qub al-Mansur was a highly accomplished man who wrote a good Arabic style and protected the philosopher Averroes. His title of "al-Manṣūr" ("the Victorious") was earned by his victory over Alfonso VIII of Castile in the Battle of Alarcos (1195).
From the time of Yusuf II, however, the Almohads governed their co-religionists in Iberia and central North Africa through lieutenants, their dominions outside Morocco being treated as provinces. When Almohad emirs crossed the Straits it was to lead a jihad against the Christians and then return to Morocco.
In 1212, the Almohad Caliph Muhammad 'al-Nasir' (1199–1214), the successor of al-Mansur, after an initially successful advance north, was defeated by an alliance of the four Christian kings of Castile, Aragón, Navarre, and Portugal, at the Battle of Las Navas de Tolosa in the Sierra Morena. The battle broke the Almohad advance, but the Christian powers remained too disorganized to profit from it immediately.
Before his death in 1213, al-Nasir appointed his young ten-year-old son as the next caliph Yusuf II "al-Mustansir". The Almohads passed through a period of effective regency for the young caliph, with power exercised by an oligarchy of elder family members, palace bureaucrats and leading nobles. The Almohad ministers were careful to negotiate a series of truces with the Christian kingdoms, which remained more-or-less in place for next fifteen years (the loss of Alcácer do Sal to the Kingdom of Portugal in 1217 was an exception).
In early 1224, the youthful caliph died in an accident, without any heirs. The palace bureaucrats in Marrakesh, led by the wazir Uthman ibn Jam'i, quickly engineered the election of his elderly grand-uncle, Abd al-Wahid I 'al-Makhlu', as the new Almohad caliph. But the rapid appointment upset other branches of the family, notably the brothers of the late al-Nasir, who governed in al-Andalus. The challenge was immediately raised by one of them, then governor in Murcia, who declared himself Caliph Abdallah al-Adil. With the help of his brothers, he quickly seized control of al-Andalus. His chief advisor, the shadowy Abu Zayd ibn Yujjan, tapped into his contacts in Marrakesh, and secured the deposition and assassination of Abd al-Wahid I, and the expulsion of the al-Jami'i clan.
This coup has been characterized as the pebble that finally broke al-Andalus. It was the first internal coup among the Almohads. The Almohad clan, despite occasional disagreements, had always remained tightly knit and loyally behind dynastic precedence. Caliph al-Adil's murderous breach of dynastic and constitutional propriety marred his acceptability to other Almohad sheikhs. One of the recusants was his cousin, Abd Allah al-Bayyasi ("the Baezan"), the Almohad governor of Jaén, who took a handful of followers and decamped for the hills around Baeza. He set up a rebel camp and forged an alliance with the hitherto quiet Ferdinand III of Castile. Sensing his greater priority was Marrakesh, where recusant Almohad sheikhs had rallied behind Yahya, another son of al-Nasir, al-Adil paid little attention to this little band of misfits.
In 1225, Abd Allah al-Bayyasi's band of rebels, accompanied by a large Castilian army, descended from the hills, besieging cities such as Jaén and Andújar. They raided throughout the regions of Jaén, Cordova and Vega de Granada and, before the end of the year, al-Bayyasi had established himself in the city of Cordova. Sensing a power vacuum, both Alfonso IX of León and Sancho II of Portugal opportunistically ordered raids into Andalusian territory that same year. With Almohad arms, men and cash dispatched to Morocco to help Caliph al-Adil impose himself in Marrakesh, there was little means to stop the sudden onslaught. In late 1225, with surprising ease, the Portuguese raiders reached the environs of Seville. Knowing they were outnumbered, the Almohad governors of the city refused to confront the Portuguese raiders, prompting the disgusted population of Seville to take matters into their own hands, raise a militia, and go out in the field by themselves. The result was a veritable massacre – the Portuguese men-at-arms easily mowed down the throng of poorly armed townsfolk. Thousands, perhaps as much as 20,000, were said to have been slain before the walls of Seville. A similar disaster befell a similar popular levy by Murcians at Aspe that same year. But Christian raiders had been stopped at Cáceres and Requena. Trust in the Almohad leadership was severely shaken by these events – the disasters were promptly blamed on the distractions of Caliph al-Adil and the incompetence and cowardice of his lieutenants, the successes credited to non-Almohad local leaders who rallied defenses.
But al-Adil's fortunes were briefly buoyed. In payment for Castilian assistance, al-Bayyasi had given Ferdinand III three strategic frontier fortresses: Baños de la Encina, Salvatierra (the old Order of Calatrava fortress near Ciudad Real) and Capilla. But Capilla refused to hand them over, forcing the Castilians to lay a long and difficult siege. The brave defiance of little Capilla, and the spectacle of al-Bayyasi's shipping provisions to the Castilian besiegers, shocked Andalusians and shifted sentiment back towards the Almohad caliph. A popular uprising broke out in Cordova – al-Bayyasi was killed and his head dispatched as a trophy to Marrakesh. But Caliph al-Adil did not rejoice in this victory for long – he was assassinated in Marrakesh in October 1227, by the partisans of Yahya, who was promptly acclaimed as the new Almohad caliph Yahya "al-Mu'tasim".
The Andalusian branch of the Almohads refused to accept this turn of events. Al-Adil's brother, then in Seville, proclaimed himself the new Almohad caliph Abd al-Ala Idris I 'al-Ma'mun'. He promptly purchased a truce from Ferdinand III in return for 300,000 maravedis, allowing him to organize and dispatch the greater part of the Almohad army in Spain across the straits in 1228 to confront Yahya.
That same year, Portuguese and Leonese renewed their raids deep into Muslim territory, basically unchecked. Feeling the Almohads had failed to protect them, popular uprisings took place throughout al-Andalus. City after city deposed their hapless Almohad governors and installed local strongmen in their place. A Murcian strongman, Muhammad ibn Yusuf ibn Hud al-Judhami, who claimed descendance from the Banu Hud dynasty that had once ruled the old taifa of Saragossa, emerged as the central figure of these rebellions, systematically dislodging Almohad garrisons through central Spain. In October 1228, with Spain practically all lost, al-Ma'mun abandoned Seville, taking what little remained of the Almohad army with him to Morocco. Ibn Hud immediately dispatched emissaries to distant Baghdad to offer recognition to the Abbasid Caliph, albeit taking up for himself a quasi-caliphal title, 'al-Mutawwakil'.
The departure of al-Ma'mun in 1228 marked the end of the Almohad era in Spain. Ibn Hud and the other local Andalusian strongmen were unable to stem the rising flood of Christian attacks, launched almost yearly by Sancho II of Portugal, Alfonso IX of León, Ferdinand III of Castile and James I of Aragon. The next twenty years saw a massive advance in the Christian reconquista – the old great Andalusian citadels fell in a grand sweep: Mérida and Badajoz in 1230 (to Leon), Majorca in 1230 (to Aragon), Beja in 1234 (to Portugal), Cordova in 1236 (to Castile), Valencia in 1238 (to Aragon), Niebla-Huelva in 1238 (to Leon), Silves in 1242 (to Portugal), Murcia in 1243 (to Castile), Jaén in 1246 (to Castile), Alicante in 1248 (to Castile), culminating in the fall of the greatest of Andalusian cities, the ex-Almohad capital of Seville, into Christian hands in 1248. Ferdinand III of Castile entered Seville as a conqueror on 22 December 1248.
The Andalusians were helpless before this onslaught. Ibn Hudd had attempted to check the Leonese advance early on, but most of his Andalusian army was destroyed at the battle of Alange in 1230. Ibn Hud scrambled to move remaining arms and men to save threatened or besieged Andalusian citadels, but with so many attacks at once, it was a hopeless endeavor. After Ibn Hud's death in 1238, some of the Andalusian cities, in a last-ditch effort to save themselves, offered themselves once again to the Almohads, but to no avail. The Almohads would not return.
With the departure of the Almohads, the Nasrid dynasty ("Banū Naṣr", Arabic: بنو نصر) rose to power in Granada. After the great Christian advance of 1228–1248, the Emirate of Granada was practically all that remained of old al-Andalus. Some of the captured citadels (e.g. Murcia, Jaen, Niebla) were reorganized as tributary vassals for a few more years, but most were annexed by the 1260s. Granada alone would remain independent for an additional 250 years, flourishing as the new center of al-Andalus.
In their African holdings, the Almohads encouraged the establishment of Christians even in Fez, and after the Battle of Las Navas de Tolosa they occasionally entered into alliances with the kings of Castile. They were successful in expelling the garrisons placed in some of the coast towns by the Norman kings of Sicily. The history of their decline differs from that of the Almoravids, whom they had displaced. They were not assailed by a great religious movement, but lost territories, piecemeal, by the revolt of tribes and districts. Their most effective enemies were the Banu Marin (Marinids) who founded the next dynasty. The last representative of the line, Idris II, 'al-Wathiq', was reduced to the possession of Marrakesh, where he was murdered by a slave in 1269.
Main article: Marinids dynasty
Although the Marinids claimed Arab ancestry through a North Arabian tribe, they were of Berber origin. Following the arrival of the Arab Bedouins in North Africa in the middle of the eleventh century, the Marinids were obliged to leave their lands in the region of Biskra, in present-day Algeria. They first frequented the area between Sijilmasa and Figuig, present-day Morocco, at times reaching as far as the Zab, present-day Algeria. They would move seasonally from the Figuig oasis to the Moulouya River basin. Following the arrival of Arab tribes in the area in the 11th-12th centuries, the Marinids moved to the north-west of present-day Algeria, before entering en-masse into Morocco by the beginning of the 13th century.
The Marinids took their name from their ancestor, Marin ibn Wartajan al-Zenati.
After arriving in present-day Morocco, they initially submitted to the Almohad dynasty, which was at the time the ruling house. After successfully contributing to the Battle of Alarcos, in central Spain, the tribe started to assert itself as a political power. Starting in 1213, they began to tax farming communities of today's north-eastern Morocco (the area between Nador and Berkane). The relationship between them and the Almohads became strained and starting in 1215, there were regular outbreaks of fighting between the two parties. In 1217, they tried to occupy the eastern part of present-day Morocco, but they were expelled, pulling back and settling in the eastern Rif mountains where they remained for nearly 30 years. During their stay in the Rif, the Almohad state suffered huge blows, losing large territories to the Christians in Spain, while the Hafsids of Ifriqia broke away in 1229, followed by the Zayyanid dynasty of Tlemcen in 1235.
Between 1244 and 1248 the Marinids were able to take Taza, Rabat, Salé, Meknes and Fez from the weakened Almohads. The Marinid leadership installed in Fes declared war on the Almohads, fighting with the aid of Christian mercenaries. Abu Yusuf Yaqub (1259–1286) captured Marrakech in 1269.
After the Nasrids of Granada ceded the town of Algeciras to the Marinids, Abu Yusuf went to Al-Andalus to support the ongoing struggle against the Kingdom of Castile. The Marinid dynasty then tried to extend its control to include the commercial traffic of the Strait of Gibraltar.
It was in this period that the Spanish Christians were first able to take the fighting to mainland present-day Morocco: in 1260 and 1267 they attempted an invasion, but both attempts were defeated. After gaining a foothold in Spain, the Marinids became active in the conflict between Muslims and Christians in Iberia. To gain absolute control of the trade in the Strait of Gibraltar, from their base at Algeciras they started the conquest of several Spanish towns: by the year 1294 they had occupied Rota, Tarifa and Gibraltar.
In 1276 they founded Fes Jdid, which they made their administrative and military centre. While Fes had been a prosperous city throughout the Almohad period, even becoming the largest city in the world during that time, it was in the Marinid period that Fes reached its golden age, a period which marked the beginning of an official, historical narrative for the city. It is from the Marinid period that Fes' reputation as an important intellectual centre largely dates, they established the first madrasas in the city and country. The principal monuments in the medina, the residences and public buildings, date from the Marinid period.
Despite internal infighting, Abu Said Uthman II (r. 1310–1331) initiated huge construction projects across the land. Several madrasas were built, the Al-Attarine Madrasa being the most famous. The building of these madrasas were necessary to create a dependent bureaucratic class, in order to undermine the marabouts and Sharifian elements.
The Marinids also strongly influenced the policy of the Emirate of Granada, from which they enlarged their army in 1275. In the 13th century, the Kingdom of Castile made several incursions into their territory. In 1260, Castilian forces raided Salé and, in 1267, initiated a full-scale invasion, but the Marinids repelled them.
At the height of their power, during the rule of Abu al-Hasan Ali (r. 1331–1348), the Marinid army was large and disciplined. It consisted of 40,000 Zenata cavalry, while Arab nomads contributed to the cavalry and Andalusians were included as archers. The personal bodyguard of the sultan consisted of 7,000 men, and included Christian, Kurdish and Black African elements. Under Abu al-Hasan another attempt was made to reunite the Maghreb. In 1337 the Abdalwadid kingdom of Tlemcen was conquered, followed in 1347 by the defeat of the Hafsid empire in Ifriqiya, which made him master of a huge territory, which spanned from southern present-day Morocco to Tripoli. However, within the next year, a revolt of Arab tribes in southern Tunisia made them lose their eastern territories. The Marinids had already suffered a crushing defeat at the hands of a Portuguese-Castilian coalition in the Battle of Río Salado in 1340, and finally had to withdraw from Andalusia, only holding on to Algeciras until 1344.
In 1348 Abu al-Hasan was deposed by his son Abu Inan Faris, who tried to reconquer Algeria and Tunisia. Despite several successes, he was strangled by his own vizir in 1358, after which the dynasty began to decline.
After the death of Abu Inan Faris in 1358, the real power lay with the viziers, while the Marinid sultans were paraded and forced to succeed each other in quick succession. The county was divided and political anarchy set in, with different viziers and foreign powers supporting different factions. In 1359 Hintata tribesmen from the High Atlas came down and occupied Marrakesh, capital of their Almohad ancestors, which they would govern independently until 1526. To the south of Marrakesh, Sufi mystics claimed autonomy, and in the 1370s Azemmour broke off under a coalition of merchants and Arab clan leaders of the Banu Sabih. To the east, the Zianid and Hafsid families reemerged and to the north, the Europeans were taking advantage of this instability by attacking the coast. Meanwhile, unruly wandering Arab Bedouin tribes increasingly spread anarchy, which accelerated the decline of the empire.
In the 15th century, it was hit by a financial crisis, after which the state had to stop financing the different marabouts and Sharifian families, which had previously been useful instruments in controlling different tribes. The political support of these marabouts and Sharifians halted, and it splintered into different entities. In 1399 Tetouan was taken and its population was massacred and in 1415 the Portuguese captured Ceuta. After the sultan Abdalhaqq II (1421–1465) tried to break the power of the Wattasids, he was executed.
Marinid rulers after 1420 came under the control of the Wattasids, who exercised a regency as Abd al-Haqq II became Sultan one year after his birth. The Wattasids however refused to give up the Regency after Abd al-Haqq came to age.
In 1459, Abd al-Haqq II managed a massacre of the Wattasid family, breaking their power. His reign, however, brutally ended as he was murdered during the 1465 revolt. This event saw the end of the Marinid dynasty as Muhammad ibn Ali Amrani-Joutey, leader of the Sharifs, was proclaimed Sultan in Fes. He was in turn overthrown in 1471 by Abu Abd Allah al-Sheikh Muhammad ibn Yahya, one of the two the surviving Wattasids from the 1459 massacre, who instigated the Wattasid dynasty.
Main article: Wattasid dynasty
Morocco was in decline when the Berber Wattasids assumed power. The Wattasid family had been the autonomous governors of the eastern Rif since the late 13th century, ruling from their base in Tazouta (near present-day Nador). They had close ties to the Marinid sultans and provided many of the bureaucratic elite. While the Marinid dynasty tried to repel the Portuguese and Spanish invasions and help the kingdom of Granada to outlive the Reconquista, the Wattasids accumulated absolute power through political maneuvering. When the Marinids became aware of the extent of the conspiracy, they slaughtered the Wattasids, leaving only Abu Abd Allah al-Sheikh Muhammad ibn Yahya alive. He went on to found the Kingdom of Fez and establish the dynasty to be succeeded by his son, Mohammed al-Burtuqali, in 1504.
The Wattasid rulers failed in their promise to protect Morocco from foreign incursions and the Portuguese increased their presence on Morocco's coast. Mohammad al-Chaykh's son attempted to capture Asilah and Tangier in 1508, 1511 and 1515, but without success.
In the south, a new dynasty arose, the Saadian dynasty, which seized Marrakesh in 1524 and made it their capital. By 1537 the Saadis were in the ascendent when they defeated the Portuguese Empire at Agadir. Their military successes contrast with the Wattasid policy of conciliation towards the Catholic kings to the north.
As a result, the people of Morocco tended to regard the Saadians as heroes, making it easier for them to retake the Portuguese strongholds on the coast, including Tangiers, Ceuta and Maziɣen. The Saadians also attacked the Wattasids who were forced to yield to the new power. In 1554, as Wattasid towns surrendered, the Wattasid sultan, Ali Abu Hassun, briefly retook Fez. The Saadis quickly settled the matter by killing him and, as the last Wattasids fled Morocco by ship, they too were murdered by pirates.
The Wattasid did little to improve general conditions in Morocco following the Reconquista. It was necessary to wait for the Saadians for order to be reestablished and the expansionist ambitions of the kingdoms of the Iberian peninsula to be curbed.
Main article: Saadi dynasty
Beginning in 1549, the region was ruled by successive Arab dynasties known as the Sharifian dynasties, who claimed descent from the prophet Muhammad. The first of these polities was the Saadi dynasty, which ruled Morocco from 1549 to 1659. From 1509 to 1549, the Saadi rulers had control of only the southern areas. While still recognizing the Wattasids as Sultans until 1528, Saadians' growing power led the Wattasids to attack them and, after an indecisive battle, to recognize their rule over southern Morocco through the Treaty of Tadla.
In 1659, Mohammed al-Hajj ibn Abu Bakr al-Dila'i, the head of the zaouia of Dila, was proclaimed sultan of Morocco after the fall of the Saadi dynasty.
Main article: Republic of Salé
The republic traces its origins back to the beginning of the 17th century, with the arrival of approximately 3,000 wealthy Moriscos from Hornachos in western Spain, who anticipated the 1609 expulsion edicts ordered by Philip III of Spain. After 1609, approximately 10,000 down-and-out expelled Moriscos arrived from Spain. Cultural and language differences between the native Saletin people and the Morisco refugees led the newcomers to settle in the old medina of Rabat, on the opposite bank of the Bou Regreg.
Pirates based on the western bank thrived and expanded their operations throughout the Mediterranean and the Atlantic Ocean. In 1624, the Dutchman Jan Janszoon (also known as Murad Reis) became the "Grand Admiral" and President of the Corsair Republic of Salé.
After Janszoon left Salé in 1627, the Moriscos ceased to recognize the authority of the Sultan Zidan al-Nasir, and refused to pay his tithe on their incomes. They proclaimed a Republic, ruled by a council or Diwan, a sort of government cabinet formed by 12 to 14 notable people whose members annually elected a Governor and a Captain General of the Fortalesa during the month of May. In the early years of the republic (between 1627 and 1630), the Diwan was controlled only by Hornacheros, whose grip on power was resented by the growing population of non-Hornachero Moriscos, called Andalusians. After bloody clashes in 1630, an agreement was reached: the election of a Qaid by Andalusians and a new Diwan of 16 members of whom 8 were Andalusians and 8 Hornacheros.
In 1641 the Zaouia of Dila, which controlled much of Morocco, imposed a religious hegemony over Salé and its parent republic. By the early 1660s the republic was embroiled in civil war with the zawiya, and eventually Sultan Al-Rashid of Morocco of the Alaouite dynasty, which still rules Morocco into the 21st century, seized Rabat and Salé, ending its independence. It ended up under the control of the Sultan of Morocco after 1668, when Moulay al Rashid finally vanquished the Dilaites.
Main article: Alaouite dynasty
The Alaouite dynasty is the current Moroccan royal family. The name Alaouite comes from the ‘Alī of ‘Alī ibn Abī Ṭālib, whose descendant Sharif ibn Ali became Prince of Tafilalt in 1631. His son Mulay Al-Rashid (1664–1672) was able to unite and pacify the country. The Alaouite family claim descent from Muhammad through his daughter Fāṭimah az-Zahrah and her husband ‘Alī ibn Abī Ṭālib.
The kingdom was consolidated by Ismail Ibn Sharif (1672–1727), who began to create a unified state in the face of opposition from local tribes . Since the Alaouites, in contrast to previous dynasties, did not have the support of a single Berber or Bedouin tribe, Isma'īl controlled Morocco through an army of slaves. With these soldiers he reoccupied Tangiers in 1684 after the English abandoned it and drove the Spanish from Larache in 1689. The kingdom he established did not survive his death — in the ensuing power struggles the tribes became a political and military force once again, and it was only with Muhammad III (1757–1790) that the kingdom was unified again. The idea of centralization was abandoned and the tribes allowed to preserve their autonomy. On 20 December 1777, Morocco became one of the first states to recognize the sovereignty of a newly independent United States.
During the reigns of Muhammad IV (1859–1873) and Hassan I (1873–1894), the Alaouites tried to foster trade links, especially with European countries and the United States. The army and administration were also modernized to consolidate control over the Berber and Bedouin tribes. In 1859, Morocco went to war with Spain. The independence of Morocco was guaranteed at the Conference of Madrid in 1880, with France also gaining significant influence over Morocco. Germany attempted to counter the growing French influence, leading to the First Moroccan Crisis of 1905–1906, and the Second Moroccan Crisis of 1911. Morocco became a French protectorate through the Treaty of Fez in 1912.
The successful Portuguese efforts to control the Atlantic coast in the 15th century did not affect the interior of Morocco. After the Napoleonic Wars, North Africa became increasingly ungovernable from Istanbul by the Ottoman Empire. As a result, it became the resort of pirates under local beys. The Maghreb also had far greater known wealth than the rest of Africa, and its location near the entrance to the Mediterranean gave it strategic importance. France showed a strong interest in Morocco as early as 1830.  The Alaouite dynasty succeeded in maintaining the independence of Morocco in the 18th and 19th centuries, in the face of Ottoman and European encroachment.
In 1844, after the French conquered Algeria, the Franco-Moroccan War took place, with the bombardment of Tangiers, the Battle of Isly, and the bombardment of Mogador.
In 1856, Sultan Abd al-Rahman's Makhzen signed the Anglo-Moroccan treaty, which was negotiated with the British diplomat John Hay Drummond Hay. The treaty granted several rights to British subjects in Morocco, and lowered Moroccan customs tariffs to 10%. The treaty prolonged Moroccan independence while opening up the country to foreign trade, along with reducings the Makhzen's control over the Moroccan economy.
The Hispano-Moroccan War took place from 1859 to 1860, and the subsequent Treaty of Wad Ras led the Moroccan government to take a massive British loan larger than its national reserves to pay off its war debt to Spain.
In the mid 19th century, Moroccan Jews started migrating from the interior to coastal cities such as Essaouira, Mazagan, Asfi, and later Casablanca for economic opportunity, participating in trade with Europeans and the development of those cities. The Alliance Israélite Universelle opened its first school in Tetuan in 1862.
In the latter part of the 19th century Morocco's instability resulted in European countries intervening to protect investments and to demand economic concessions. Sultan Hassan I called for the Madrid Conference of 1880 in response to France and Spain's abuse of the protégé system, but the result was an increased European presence in Morocco—in the form of advisors, doctors, businessmen, adventurers, and even missionaries.
More than half of the Makhzen's expenditures went abroad to pay war indemnities and buy weapons, military equipment, and manufactured goods. From 1902 to 1909, Morocco's trade deficit increased 14 million francs annually, and the Moroccan rial depreciated 25% from 1896 to 1906. In June 1904, after a failed attempt to impose a flat tax, France bailed out the already indebted Makhzen with 62.5 million francs, guaranteed by a portion of customs revenue.
In the 1890s, the French administration and military in Algiers called for the annexation of the Touat, the Gourara and the Tidikelt, a complex that had been part of the Moroccan Empire for many centuries prior to the arrival of the French in Algeria.  The first years of the 20th century saw major diplomatic efforts by European powers, especially France, to further its interests in the region.
Morocco nominally was ruled by its sultan, the young Abd al-Aziz, through his regent, Ba Ahmed. By 1900, Morocco was the scene of multiple local wars started by pretenders to the sultanate, by bankruptcy of the treasury, and by multiple tribal revolts. The French Foreign Minister Théophile Delcassé saw the opportunity to stabilize the situation and expand the French overseas empire.
General Hubert Lyautey wanted a more aggressive military policy using his French army based in Algeria. France decided to use both diplomacy and military force. The French colonial authorities would establish control over the Sultan, ruling in his name and extending French influence. The British acceded to any French designs in Morocco in the Entente Cordiale of 1904. The Germans, however, who had no established presence in the region, strongly protested against the French plan. The Kaiser's dramatic intervention in Morocco in March 1905 in support of Moroccan independence became a turning point on the road to the First World War. The international Algeciras Conference of 1906 formalized France's "special position" and entrusted policing of Morocco jointly to France and Spain. Germany was outmaneuvered diplomatically, and France took full control of Morocco.
Morocco experienced a famine from 1903 to 1907, as well as insurrections led by El-Rogui (Bou Hmara) and Mulai Ahmed er Raisuni.
In 1907, the French took the murder of Émile Mauchamp in Marrakesh as a pretext to invade Oujda in the east, as they took an uprising against their appropriation of customs revenue in Casablanca as an opportunity to bombard and invade that city in the west. Months later, there was a brief fratricidal civil war referred to as the Hafidiya, in which Abd al-Hafid, at first supported by southern aristocrats based in Marrakesh such as the Glawaand later conditionally supported by the ulama of Fes, wrested the throne from his brother Abd al-Aziz, who was supported by the French.
The Agadir Crisis increased tensions among the powerful European countries, and resulted in the Treaty of Fez (signed on 30 March 1912), which made Morocco a protectorate of France. A second treaty signed by the French and Spanish heads of state, Spain was granted a Zone of influence in northern and southern Morocco on 27 November 1912. The northern part became the Spanish protectorate in Morocco, while the southern part was ruled from El Aaiun as a buffer zone between the Spanish Colony of Saguia El Hamra and Morocco. The treaty of Fez triggered the 1912 Fez riots. By the Tangier Protocol signed in December 1923, Tangier received special status and became an international zone, although, during World War II, it was occupied from 1940 to 1945 by Francoist Spain.
The treaties nominally assured Morocco of its legal status as a sovereign state, with the sultan as its figurehead. In practice, the sultan had no real power and the country was ruled by the colonial administration. French civil servants allied themselves with the French settlers and with their supporters in France to prevent any moves in the direction of Moroccan autonomy. As "pacification" proceeded, with the Zaian War and the War of the Rif, the French government focused on the exploitation of Morocco's mineral wealth, and particularly its phosphates; the creation of a modern transportation system with trains and buses; and the development of a modern agricultural sector geared to the French market. Tens of thousands of colons, or colonists, entered Morocco and acquired large tracts of the rich agricultural land.
Morocco was home to half a million Europeans, most of whom settled in Casablanca, where they formed almost half the population. Since the kingdom's independence in 1956, and particularly after Hassan II's 1973 Moroccanization policies, the European element has largely departed.
The Spanish coup of July 1936, which gave way to the Spanish Civil War, began with the Ejército de África in Spanish occupied Morocco.
See also: French Morocco
Led by Abd el-Krim, the independent Republic of the Rif existed from 1921 to 1926, based in the central part of the Rif (in the Spanish Protectorate), while also extending, for some months, to some parts of the tribal lands of the Ghomara, the Eastern Rif, Jbala, the Ouergha valley and the north of Taza. After proclaiming independence on 18 September 1921, the polity developed state and governing institutions such as tax collection, law enforcement and the organisation of an army. However, since 1925 the Spanish and French troops managed to quell the resistance and Abd el-Krim surrendered in May 1926.
In December 1934, a small group of nationalists, members of the newly formed Comité d'Action Marocaine, or Moroccan Action Committee (CAM), proposed a Plan of Reforms that called for a return to indirect rule as envisaged by the Treaty of Fez, admission of Moroccans to government positions, and establishment of representative councils. CAM used petitions, newspaper editorials, and personal appeals to French officials to further its cause, but these proved inadequate, and the tensions created in the CAM by the failure of the plan caused it to split. The CAM was reconstituted as a nationalist political party to gain mass support for more radical demands, but the French suppressed the party in 1937.
Nationalist political parties, which subsequently arose under the French protectorate, based their arguments for Moroccan independence on declarations such as the Atlantic Charter, a joint United States-British statement that set forth, among other things, the right of all peoples to choose the form of government under which they live. The French regime also faced the opposition of the tribes — when the Berber were required to come under the jurisdiction of French courts in 1930, it increased support for the independence movement.
Many Moroccan Goumiers, or indigenous soldiers in the French army, assisted the Allies in both World War I and World War II. During World War II, the badly divided nationalist movement became more cohesive. However, the nationalists belief that an Allied victory would pave the way for independence was disappointed. In January 1944, the Istiqlal (Independence) Party, which subsequently provided most of the leadership for the nationalist movement, released a manifesto demanding full independence, national reunification, and a democratic constitution. The Sultan Muhammad V (1927–1961) had approved the manifesto before its submission to the French resident general, who answered that no basic change in the protectorate status was being considered. The general sympathy of the sultan for the nationalists became evident by the end of the war, although he still hoped to see complete independence achieved gradually. On 10 April 1947, in spite of a massacre instigated by French forces in Casablanca, Sultan Muhammad V delivered a momentous speech in Tangier appealing for the independence and territorial unity of Morocco, having traveled from French Morocco and through Spanish Morocco to reach the Tangier International Zone. The résidence, supported by French economic interests and vigorously backed by most of the colons, adamantly refused to consider even reforms short of independence.
In December 1952, a riot broke out in Casablanca over the assassination of the Tunisian labor leader Farhat Hached; this event marked a watershed in relations between Moroccan political parties and French authorities. In the aftermath of the rioting, the residency outlawed the new Moroccan Communist Party and the Istiqlal Party.
France's exile of the highly respected Sultan Mohammed V to Madagascar on Eid al-Adha of 1953, and his replacement by the unpopular Mohammed Ben Aarafa, sparked active opposition to the French protectorate both from nationalists and those who saw the sultan as a religious leader. In retribution, Muhammad Zarqtuni bombed Casablanca's Marché Central in the European ville nouvelle on Christmas of that year. Two years later, faced with a united Moroccan demand for the sultan's return and rising violence in Morocco, as well as a deteriorating situation in Algeria, the French government brought Mohammed V back to Morocco, and the following year began the negotiations that led to Moroccan independence.
In late 1955, in the middle of what came to be known as the Revolution of the King and the People, Sultan Mohammed V successfully negotiated the gradual restoration of Moroccan independence within a framework of French-Moroccan interdependence. The sultan agreed to institute reforms that would transform Morocco into a constitutional monarchy with a democratic form of government. In February 1956, Morocco acquired limited home rule. Further negotiations for full independence culminated in the French-Moroccan Agreement signed in Paris on 2 March 1956.
On 7 April 1956, France officially relinquished its protectorate in Morocco. The internationalized city of Tangier was reintegrated with the signing of the Tangier Protocol on 29 October 1956. The abolition of the Spanish protectorate and the recognition of Moroccan independence by Spain were negotiated separately and made final in the Joint Declaration of April 1956. Through this agreement with Spain in 1956 and another in 1958, Moroccan control over certain Spanish-ruled areas was restored. Attempts to claim other Spanish possessions through military action were less successful.
In the months that followed independence, Mohammed V proceeded to build a modern governmental structure under a constitutional monarchy in which the sultan would exercise an active political role. He acted cautiously, intent on preventing the Istiqlal from consolidating its control and establishing a one-party state. He assumed the monarchy on 11 August 1957, and from that date the country officially became known as 'The Kingdom of Morocco.'
Mohammed V's son Hassan II became King of Morocco on 3 March 1961. His rule saw significant political unrest, and the ruthless government response earned the period the name "the years of lead". Hassan took personal control of the government as prime minister, and named a new cabinet. Aided by an advisory council, he drew up a new constitution, which was approved overwhelmingly in a December 1962 referendum. Under its provisions, the king remained the central figure in the executive branch of the government, but legislative power was vested in a bicameral parliament, and an independent judiciary was guaranteed.
In May 1963, legislative elections took place for the first time, and the royalist coalition secured a small plurality of seats. However, following a period of political upheaval in June 1965, Hassan II assumed full legislative and executive powers under a "state of exception," which remained in effect until 1970. Subsequently, a reform constitution was approved, restoring limited parliamentary government, and new elections were held. However, dissent remained, revolving around complaints of widespread corruption and malfeasance in government. In July 1971 and again in August 1972, the regime was challenged by two attempted military coups.
After neighbouring Algeria's 1962 independence from France, border skirmishes in the Tindouf area of south-western Algeria escalated in 1963 into what is known as the Sand War. The conflict ended after Organisation of African Unity mediation, with no territorial changes.
On 3 March 1973, Hassan II announced the policy of Moroccanization, in which state-held assets, agricultural lands, and businesses that were more than 50 percent foreign-owned—and especially French-owned—were transferred to political loyalists and high-ranking military officers. The Moroccanization of the economy affected thousands of businesses and the proportion of industrial businesses in Morocco that were Moroccan-owned immediately increased from 18% to 55%. 2/3 of the wealth of the Moroccanized economy was concentrated in 36 Moroccan families.
The patriotism engendered by Morocco's participation in the Middle East conflict and by the events in Western Sahara contributed to Hassan's popularity. The king had dispatched Moroccan troops to the Sinai front after the outbreak of the Arab-Israeli War in October 1973. Although they arrived too late to engage in hostilities, the action won Morocco goodwill among other Arab states. Soon after, the attention of the government turned to the acquisition of Western Sahara from Spain, an issue on which all major domestic parties agreed.
Following years of discontent and inequality during the 1980s, on 14 December 1990 a general strike was called by two major trade unions in the country to demand an increase to minimum wage and other measures. In Fez this broke into protest and rioting led by university students and youths. The death of one of the students further inflamed protests, resulting in buildings being burned and looted, particularly symbols of wealth. While the official death toll was 5 people, the New York Times reported a toll of 33 people and quoted an anonymous source claiming the real death toll was likely higher. The government denied reports that the deaths were due to the intervention of security forces and armored vehicles. Many of those arrested were later released and the government promised to investigate and raise wages, though some of these measures were dismissed by skeptical opposition parties.: 377 
Main article: History of Western Sahara
The Spanish enclave of Ifni in the south became part of the new state of Morocco in 1969, but other Spanish possessions in the north, including Ceuta, Melilla and Plaza de soberanía, remained under Spanish control, with Morocco viewing them as occupied territory.
In August 1974, Spain formally acknowledged the 1966 United Nations (UN) resolution calling for a referendum on the future status of the Western Sahara, and requested that a plebiscite be conducted under UN supervision. A UN visiting mission reported in October 1975 that an overwhelming majority of the Saharan people desired independence. Morocco protested the proposed referendum and took its case to the International Court of Justice at The Hague, which ruled that despite historical "ties of allegiance" between Morocco and the tribes of Western Sahara, there was no legal justification for departing from the UN position on self-determination. Spain, meanwhile, had declared that even in the absence of a referendum, it intended to surrender political control of Western Sahara, and Spain, Morocco, and Mauritania convened a tripartite conference to resolve the territory's future. Spain also announced that it was opening independence talks with the Algerian-backed Saharan independence movement known as the Polisario Front.
In early 1976, Spain ceded the administration of the Western Sahara to Morocco and Mauritania. Morocco assumed control over the northern two-thirds of the territory, and conceded the remaining portion in the south to Mauritania. An assembly of Saharan tribal leaders duly acknowledged Moroccan sovereignty. However, buoyed by the increasing defection of tribal chiefs to its cause, the Polisario drew up a constitution, and announced the formation of the Saharawi Arab Democratic Republic (SADR), and itself formed government-in-exile.
The Moroccan government eventually sent a large portion of its combat forces into Western Sahara to confront the Polisario's forces, which were relatively small but well-equipped, highly mobile, and resourceful. The Polisario used Algerian bases for quick strikes against targets deep inside Morocco and Mauritania, as well as for operations in Western Sahara. In August 1979, after suffering military losses, Mauritania renounced its claim to Western Sahara and signed a peace treaty with the Polisario. Morocco then annexed the entire territory and, in 1985 built a 2,500-kilometer sand berm around three-quarters of Western Sahara.
In 1988, Morocco and the Polisario Front agreed on a United Nations (UN) peace plan, and a cease-fire and settlement plan went into effect in 1991. Even though the UN Security Council created a peacekeeping force to implement a referendum on self-determination for Western Sahara, it has yet to be held, periodic negotiations have failed, and the status of the territory remains unresolved.
The war against the Polisario guerrillas put severe strains on the economy, and Morocco found itself increasingly isolated diplomatically. Gradual political reforms in the 1990s culminated in the constitutional reform of 1996, which created a new bicameral legislature with expanded, although still limited, powers. Elections for the Chamber of Representatives were held in 1997, reportedly marred by irregularities.
With the death of King Hassan II of Morocco in 1999, the more liberal Crown Prince Sidi Mohammed took the throne, assuming the title Mohammed VI. He enacted successive reforms to modernize Morocco, and the human-rights record of the country improved markedly. One of the new king's first acts was to free approximately 8,000 political prisoners and reduce the sentences of another 30,000. He also established a commission to compensate families of missing political activists and others subjected to arbitrary detention. Internationally, Morocco has maintained strong ties to the West. It was one of the first Arab and Islamic states to denounce the 9/11 terrorist attacks on the United States.
In September 2002, new legislative elections were held, and the Socialist Union of Popular Forces (USFP) won a plurality. International observers regarded the elections as free and fair, noting the absence of the irregularities that had plagued the 1997 elections. In May 2003, in honor of the birth of a son, the king ordered the release of 9,000 prisoners and the reduction of 38,000 sentences. Also in 2003, Berber-language instruction was introduced in primary schools, prior to introducing it at all educational levels. In March 2000, women's groups organized demonstrations in Rabat proposing reforms to the legal status of women in the country. 200,000 to 300,000 women attended, calling for a ban on polygamy, and the introduction of civil divorce law. Although a counter-demonstration attracted 200,000 to 400,000 participants, the movement was influential on King Mohammed, and he enacted a new Mudawana, or family law, in early 2004, meeting some of the demands of women's rights activists.
In July 2002, a crisis broke out with Spain over a small, uninhabited island lying just less than 200 meters from the Moroccan coast, named Toura or Leila by Moroccans and Perejil by Spain. After mediation by the United States, both Morocco and Spain agreed to return to the status quo, under which the island remains deserted.
In May 2003, Islamist suicide bombers simultaneously struck a series of sites in Casablanca, killing 45 and injuring more than 100 others. The Moroccan government responded with a crackdown against Islamist extremists, ultimately arresting several thousand, prosecuting 1,200, and sentencing about 900. Additional arrests followed in June 2004. That same month, the United States designated Morocco a major non-North Atlantic Treaty Organization ally, stating that it was in recognition of its efforts to thwart international terrorism. On 1 January 2006, a comprehensive bilateral free trade agreement between the United States and Morocco took effect. The agreement had been signed in 2004 along with a similar agreement with the European Union, Morocco's main trade partner.
In February 2011, thousands of people rallied in Rabat and other cities calling for political reform and a new constitution curbing the powers of the king. Two months later, a bombing in Marrakesh occurred, killing 17 people – mainly foreigners. It was the deadliest attack in Morocco in eight years. The Maghrebi arm of al-Qaeda denied involvement. In July 2011 King Mohammed introduced a constitutional referendum proposed in order to placate "Arab Spring" protests.
In October 2016, large-scale protests erupted after a fish seller in al-Hoceima was crushed to death in a rubbish truck as he tried to retrieve fish confiscated by police. The protests became known as the Hirak Rif Movement. In June 2019, Morocco adopts law confirming Berber as official language. On 10 December 2020, President Donald Trump announced that the United States would officially recognize Morocco's claims over Western Sahara as part of the Israel–Morocco normalization agreement.
((cite book)): CS1 maint: others (link)
At this point, the rebels had control of all modern Morocco, most of which was not to see rule by the universal caliphate again.
North African dynasty probably of Berber origin, although they claimed Arab ancestry
and even contrived a family tree to establish their "descent" from a North Arabian tribe
((cite book)): CS1 maint: multiple names: authors list (link)