Africa
The history of Morocco
The whole story, from the first peoples to today, with every state that has held Rabat on our historical maps.
Key dates (16)
- c. 300000 BCEEarly Homo sapiens live at Jebel Irhoud, the oldest known fossils of our species.
- c. 700 BCEPhoenician traders establish settlements on the coast, including Lixus and Mogador.
- 25 BCEAugustus makes the Berber prince Juba II king of Mauretania.
- 40 CECaligula has King Ptolemy of Mauretania executed, and the kingdom is soon annexed as a Roman province.
- 740 CEBerber tribes revolt against the Umayyad Caliphate, and Morocco breaks free of eastern rule.
- 789 CEIdris I, founder of the Idrisid dynasty, founds the settlement that becomes Fes.
- c. 1070The Almoravids found Marrakesh as the capital of their Saharan and Moroccan empire.
- 1147The Almohads capture Marrakesh and replace the Almoravids.
- 1415Portugal captures Ceuta, beginning European conquests on the Moroccan coast.
- 1578The Saadians defeat Portugal at the Battle of the Three Kings, in which King Sebastian dies.
- 1591A Moroccan army defeats the Songhai Empire at Tondibi.
- 1666The Alawi sultan al-Rashid takes Fes, founding the dynasty that still reigns.
- 1912The Treaty of Fez makes Morocco a French protectorate, with a Spanish zone in the north and south.
- 1956France recognises Moroccan independence on 2 March, and Spain follows in April.
- 1975Some 350,000 Moroccans join the Green March into Spanish Sahara, and Spain agrees to withdraw.
- 1999Mohammed VI succeeds his father, Hassan II.
Morocco, at the north-western corner of Africa, has been shaped by its Amazigh (Berber) population, its Atlantic and Mediterranean coasts, and its closeness to Spain across the Strait of Gibraltar. Berber kingdoms flourished alongside Phoenician and Carthaginian ports and then under Roman rule, and after the Arab conquest Morocco became the heart of a succession of Islamic dynasties, some of which ruled from the Sahara to Spain. Unlike its neighbours, it never came under the Ottoman Empire, and the Alawi dynasty has reigned since the 1660s. France and Spain ruled it as protectorates from 1912 to 1956, and the independent kingdom has combined a powerful monarchy with an elected parliament, while its claim to Western Sahara remains disputed.
Prehistory
People have lived in Morocco for a very long time. Fossils found at Jebel Irhoud, dated in 2017 to about 300,000 years ago, are the oldest known remains of Homo sapiens anywhere, and hominin remains from a quarry in Casablanca are far older still. Shell beads from the cave of Taforalt, around 82,000 years old, are among the earliest known personal ornaments. When the Sahara was greener, hunters and herders spread across the region, and the Iberomaurusian people of Taforalt, around 15,000 years ago, left a genetic legacy still present in North Africans today.
From about 7,500 years ago farmers arrived from Iberia and herders from the Near East, mixing with the existing population. Pottery, cattle and crops spread along the coast, and at Oued Beht, between Rabat and Meknes, archaeologists have found a large farming settlement from about 3400 to 2900 BCE. The peoples who emerged from these communities in the Bronze and Iron Ages were the ancestors of the Amazigh, whose languages are still spoken across Morocco.
Phoenicians, Carthage and the Mauri
Phoenician sailors from the Levant reached Morocco by the eighth century BCE and set up trading posts for metals, salt and purple dye, at Lixus near Larache, at Chellah near Rabat and on the island of Mogador, off Essaouira. Local communities, such as the one excavated at Kach Kouch near Tétouan, adopted some Phoenician techniques while keeping their own culture. From the fifth century BCE the coastal settlements fell under the influence of Carthage, the great Phoenician city in Tunisia, which traded with the Berber tribes of the interior. Morocco forms part of the wider story of Phoenicia's expansion across the western Mediterranean.
Inland the Mauri, as Greek and Roman writers called them, formed the kingdom of Mauretania, whose first known king, Baga, ruled around 225 BCE. After Carthage's destruction in the Punic Wars, Mauretania's kings dealt directly with Rome. Bocchus I sided first with the Numidian king Jugurtha and then betrayed him to the Roman general Sulla in 105 BCE, gaining territory in return. In the Roman civil wars his successors Bogud and Bocchus II took opposite sides, Bogud supporting Julius Caesar.
Roman Mauretania
In 25 BCE Augustus made Juba II, a Berber prince educated in Rome, king of Mauretania. Juba married Cleopatra Selene, daughter of Cleopatra and Mark Antony, wrote learned books in Greek and ruled a prosperous client kingdom, while Augustus founded colonies of Roman citizens near the Atlantic coast. In 40 CE the emperor Caligula had Juba's son Ptolemy executed, and after a revolt led by Ptolemy's freedman Aedemon, Claudius divided the kingdom into two provinces of the Roman Empire. The western one, Mauretania Tingitana, covered northern Morocco, with Volubilis, whose mosaics and triumphal arch survive, as its main inland city, and Tingis, modern Tangier, as its port. Roman control never reached far beyond the northern plains, and alliances with the tribes mattered more than garrisons. The province exported olive oil, grain, fish sauce and wild animals for the arena. Christianity reached the towns in the second century, and there was also a substantial Jewish population.
As Roman power weakened in the late third century, most of the province was given up except for the area around Tangier and Ceuta. The Vandals crossed from Spain in 429 on their way to Carthage, in the era of the fall of Rome, and Berber principalities ruled most of the land. In the sixth century the Byzantine Empire under Justinian I took back Ceuta and held a foothold on the strait.
Arab conquest and the Berber kingdoms
Arab armies spreading Islam across North Africa reached Morocco in the late seventh century, and by about 709 the region was under the governors of the Umayyad Caliphate, administered from Kairouan in Tunisia. Many Berbers converted, and in 711 a Berber-majority army under Tariq ibn Ziyad crossed the strait and began the conquest of Spain. Heavy taxation and discrimination by Arab governors provoked the great Berber Revolt of 740, inspired by Kharijite preachers, after which neither the Umayyads nor their successors, the Abbasid Caliphate, controlled Morocco again. The land divided into independent states: the emirate of Nekor in the Rif, the Midrarid emirate of Sijilmasa, a key Saharan trade centre, and the Barghawata confederation on the Atlantic plains, which followed its own syncretic religion for three centuries.
The Idrisids and the founding of Fes
In 788 Idris ibn Abdallah, a descendant of the Prophet Muhammad who had fled Abbasid persecution, was received by the Awraba Berbers at Volubilis and recognised as their imam. In 789 he founded a settlement on the river Fes, but he was poisoned by an Abbasid agent in 791. His posthumous son, Idris II, developed Fes into a capital, settling refugees from Córdoba and from Kairouan, and in 859 Fatima al-Fihri founded the mosque of al-Qarawiyyin, which became one of the great centres of Islamic learning. The Idrisids are seen as the founders of the Moroccan state, but after 828 their realm was divided among heirs, and in the tenth century they were caught between the Fatimid Caliphate and the Umayyads of Córdoba. By 985 the dynasty was finished, though families claiming Idrisid descent remained prominent, and the shrines of the two Idrises are still major pilgrimage sites.
The Almoravids and Almohads
In the 1050s a reforming movement of Sanhaja Berber nomads from the Sahara, led by the preacher Abdallah ibn Yasin, swept north. These Almoravids took Sijilmasa in 1054, and under Yusuf ibn Tashfin they founded Marrakesh around 1070, unified Morocco for the first time and imposed the Maliki school of law. Invited by the Muslim kings of Spain, Yusuf defeated Alfonso VI of Castile at Zallaqa in 1086 and then annexed most of al-Andalus. For a generation one empire stretched from the Senegal River to the Ebro.
The Almoravids were overthrown by another Berber religious movement. Ibn Tumart, a scholar from the Anti-Atlas who proclaimed himself the Mahdi, preached a strict doctrine of the unity of God from the mountain stronghold of Tinmel among the Masmuda tribes. His successor, Abd al-Mumin, took the title of caliph, captured Marrakesh in 1147 and conquered North Africa as far as Tripoli, while the Almohad Caliphate also took over Muslim Spain, governing it from Seville. The Almohads built the Koutoubia mosque in Marrakesh, the Hassan Tower in Rabat and the Giralda in Seville, and the caliphs Abu Yaqub Yusuf and Yaqub al-Mansur patronised the philosopher Averroes. At first, however, they forced many Jews and Christians to convert or leave; the family of Maimonides fled Córdoba and lived for a time in Fes. Al-Mansur defeated Castile at Alarcos in 1195, but in 1212 the caliph al-Nasir was crushed at Las Navas de Tolosa, a turning point in the Reconquista. Internal feuds then broke the empire apart, and the last Almohad ruler was killed in Marrakesh in 1269.
The Marinids and Wattasids
The Marinids, Zenata Berber nomads from the east, took Fes in 1248 and Marrakesh in 1269. They built a new royal city, Fes el-Jdid, in 1276, and Fes reached its golden age under them, with richly decorated madrasas such as the Bou Inania and al-Attarine. Sultan Abu al-Hasan briefly conquered Tlemcen and Tunis in the 1330s and 1340s, but his army was defeated by Castile and Portugal at the Battle of Río Salado in 1340, ending Moroccan intervention in Spain, and the Black Death struck in 1348. The Marinid court attracted scholars: Ibn Battuta, born in Tangier in 1304, dictated the account of his travels in Fes, and Ibn Khaldun served the sultans in the 1350s.
After 1358 power passed to viziers, and from 1420 the Wattasid family ruled as regents before taking the throne themselves in 1472. Meanwhile Portugal seized Ceuta in 1415, and over the following century took Ksar es-Seghir, Asilah, Tangier, Safi, Azemmour, Mazagan and Agadir, while Spain took Melilla in 1497. The fall of the Emirate of Granada in 1492 and the expulsion of Jews from Spain that year, followed by the expulsion of the Moriscos in 1609–1614, brought waves of refugees who enriched the cities of Fes, Tétouan, Rabat and Salé. In the countryside, Sufi brotherhoods and families of holy descent (sharifs) led resistance to the Portuguese.
The Saadians
One such family, the Saadians from the Draa valley, who claimed descent from the Prophet, rose in the south on the strength of the struggle against Portugal. They took Marrakesh in 1525, drove the Portuguese from Agadir in 1541 and captured Fes in 1549, ending Wattasid rule. They also kept the Ottoman Empire at bay; Morocco was the only part of North Africa never to become Ottoman. On 4 August 1578, at the Battle of the Three Kings near Ksar el-Kebir, the Saadian sultan Abd al-Malik destroyed an invading army led by King Sebastian of Portugal, who had come to restore a deposed rival. Sebastian, Abd al-Malik and the pretender all died, and Portugal's royal line soon passed to Spain.
The victor's brother, Ahmad al-Mansur (1578–1603), used the ransoms to build the El Badi palace in Marrakesh, exchanged embassies with Elizabeth I of England against their common enemy Spain, and grew rich on sugar and saltpetre. In 1590 he sent an army across the Sahara under Judar Pasha, which defeated the Songhai Empire at Tondibi in 1591 and occupied Timbuktu and Gao, seizing control of the gold trade for a time. After al-Mansur's death his sons fought for the throne, and Morocco broke into rival states, including the Sufi lodge of Dila in the Middle Atlas and the corsair republic of Salé, founded by Morisco refugees.
The Alawi dynasty
The Alawis, another sharifian family from the Tafilalt oasis, reunited the country. Mawlay al-Rashid took Fes in 1666 and Marrakesh in 1668. His brother Mawlay Ismail (1672–1727) ruled for fifty-five years from a vast palace-city at Meknes and held power through an army of enslaved black soldiers, the Abid al-Bukhari, loyal to him alone. He recovered Tangier when the English abandoned it in 1684, and took Larache from Spain in 1689. His death was followed by thirty years of civil war, until Mohammed III (1757–1790) restored order, founded the port of Essaouira in 1764 to channel trade with Europe and took Mazagan, the last Portuguese stronghold, in 1769. In 1777 he became one of the first rulers to recognise the independence of the United States after the American Revolution, and the 1786 treaty of friendship between the two countries is still in force.
In the nineteenth century European pressure grew. When Sultan Abd al-Rahman supported the Algerian resistance to France, French forces bombarded Tangier and Essaouira and defeated his army at Isly in 1844. A treaty with Britain in 1856 opened Morocco to foreign trade, and Spain's victory in the war of 1859–1860, which included the occupation of Tétouan, left Morocco with a crippling indemnity. Sultan Hassan I (1873–1894) tried to modernise the army and administration, but the protection system, under which Moroccan clients of European consulates escaped local law and taxes, steadily eroded his authority.
The French and Spanish protectorates
By 1900 Morocco was weakened by debt, revolt and rival pretenders. In the Entente Cordiale of 1904 Britain gave France a free hand there, and France and Spain secretly divided spheres of influence. Wilhelm II's visit to Tangier in 1905 provoked an international crisis, settled at the Algeciras conference of 1906, one of the confrontations on the road to the First World War. France occupied Oujda and bombarded Casablanca in 1907, and after the Agadir crisis of 1911 Sultan Abd al-Hafid signed the Treaty of Fez on 30 March 1912, making Morocco a French protectorate. Spain received a northern zone along the Mediterranean and a southern zone near the Sahara, and Tangier later became an international zone. These steps were part of the Scramble for Africa.
The first resident-general, Hubert Lyautey, kept the sultan and the old administration as a facade of indirect rule, moved the capital to Rabat, built European new towns beside the old medinas and developed Casablanca into the country's main port. Conquest of the mountains took more than twenty years. In the Zaian War of 1914–1921 Middle Atlas tribes fought the French, and in the Rif, Abd el-Krim inflicted a disaster on the Spanish army at Annual in 1921, in which more than 13,000 Spanish soldiers died, and set up a Republic of the Rif. Spain used chemical weapons against Rif villages, and a large combined Franco-Spanish force defeated Abd el-Krim in 1926. Settlers acquired much of the best farmland, phosphate mining expanded, and Morocco became home to about half a million Europeans. In July 1936 Francisco Franco launched his rising against the Spanish Republic from Spanish Morocco, and tens of thousands of Moroccan soldiers fought in his army.
Organised nationalism grew from protests against the "Berber Dahir" of 1930, which placed Berber areas under customary rather than Islamic law and was seen as an attempt to divide Moroccans. During the Second World War Allied forces landed in Morocco in November 1942, and in January 1943 Franklin D. Roosevelt and Winston Churchill met at Anfa near Casablanca, where Roosevelt also met Sultan Mohammed V. In January 1944 the new Istiqlal (Independence) Party issued a manifesto demanding independence, and Moroccan goumiers fought for France in Italy and Europe. In 1947, at Tangier, the sultan called openly for Moroccan unity and independence. When France deposed and exiled him in August 1953, first to Corsica and then to Madagascar, the move united Moroccans behind him and set off armed resistance. France brought him back in November 1955, recognised independence on 2 March 1956, and Spain gave up its northern zone in April. Tangier rejoined Morocco in October 1956, and the Spanish southern zone of Tarfaya followed in 1958.
Independence and Hassan II
Mohammed V took the title of king in 1957 and kept the monarchy at the centre of power, preventing the Istiqlal from creating a one-party state. Morocco's large Jewish community, about 265,000 people in 1948, emigrated in great numbers to Israel, France and Canada over the following decades. Hassan II, who succeeded his father in March 1961, gave Morocco its first constitution in 1962, but ruled through a state of emergency from 1965 to 1970. The left-wing opposition leader Mehdi Ben Barka disappeared in Paris in 1965, and army officers twice tried to kill the king, at the Skhirat palace in 1971 and by attacking his plane in 1972. The decades of repression, imprisonment and disappearances are remembered as the "years of lead"; a truth commission set up under his successor documented nearly 10,000 cases of abuse. In 1963 a border dispute with newly independent Algeria led to the brief Sand War, and relations between the two countries have remained tense. In 1973 Hassan II's "Moroccanisation" policy transferred foreign-owned businesses and farmland to Moroccan owners, and Moroccan troops fought in the Arab-Israeli war that October.
Western Sahara
Morocco considers the former Spanish Sahara, to its south, part of its historic territory, citing pre-colonial ties of allegiance between Saharan tribes and the sultans. The Polisario Front, founded in 1973, seeks an independent state for the Sahrawi people. In October 1975 the International Court of Justice found that there had been legal ties of allegiance between the sultan and some tribes, but not territorial sovereignty, and that these did not override the right of self-determination. In November 1975 Hassan II led the Green March, in which some 350,000 unarmed Moroccans crossed into the territory, and Spain agreed in the Madrid Accords to hand administration to Morocco and Mauritania. Polisario, backed by Algeria, proclaimed the Sahrawi Arab Democratic Republic in 1976 and fought both countries. After Mauritania withdrew in 1979, Morocco took control of its zone and from the 1980s built a long fortified sand wall, leaving it in control of most of the territory, with Polisario holding a strip to the east and tens of thousands of Sahrawi refugees living in camps near Tindouf in Algeria. Morocco left the Organisation of African Unity in 1984 when it admitted the Sahrawi republic.
A UN-brokered ceasefire took effect in 1991, and a peacekeeping mission was created to organise a referendum on self-determination, but disputes over who could vote meant it was never held. In 2007 Morocco proposed autonomy for the territory under Moroccan sovereignty, which Polisario rejected in favour of a referendum including the option of independence. In November 2020 Polisario declared the ceasefire over after Moroccan forces cleared protesters from the Guerguerat crossing, and low-level fighting resumed. In December 2020 the United States recognised Moroccan sovereignty as part of an agreement under which Morocco restored relations with Israel, and in October 2025 the UN Security Council referred to Morocco's autonomy proposal as a basis for negotiations. The UN still lists Western Sahara as a non-self-governing territory, and its final status remains unresolved.
Mohammed VI and the present day
Mohammed VI became king on Hassan II's death in July 1999. He released many political prisoners, set up the Equity and Reconciliation Commission to examine abuses of the previous reign, and in 2004 introduced a new family code, the Mudawana, which expanded women's rights. Suicide bombings in Casablanca killed 45 people in May 2003. In 2011, amid the Arab Spring, protesters of the 20 February movement demanded reform, and a new constitution approved by referendum strengthened the elected head of government and made Amazigh an official language alongside Arabic, while leaving the king with wide powers over the army, religion and foreign policy. The Islamist Justice and Development Party led governments from 2011 until its defeat in 2021, when Aziz Akhannouch's National Rally of Independents took over. Protests in the Rif in 2016–2017 were met with arrests, and Morocco rejoined the African Union in 2017.
On 8 September 2023 an earthquake in the High Atlas south-west of Marrakesh killed more than 2,800 people. In 2025 youth-led protests over unemployment, corruption and inequality spread across the country. Morocco, whose football team reached the World Cup semi-finals in 2022, is preparing to co-host the 2030 World Cup with Spain and Portugal. In the general election of 23 September 2026 the Authenticity and Modernity Party won the most seats, and on 29 September the king appointed its leader, Fatima Ezzahra El Mansouri, as the first woman to head a Moroccan government.
Sources
- Wikipedia: History of Morocco
- Wikipedia: Morocco
- Wikipedia: Kingdom of Mauretania
- Wikipedia: Saadi Sultanate
- Wikipedia: Alaouite dynasty
- Wikipedia: French protectorate in Morocco
- Wikipedia: Western Sahara conflict
- Wikipedia: 2026 Moroccan general election
- BBC News: Morocco country profile
- BBC News: Morocco profile, Timeline
Who held Rabat?
21 periodsThe state drawn at the site of today’s capital on each of our maps. Open any year to see the borders of the time.
- 2000 BCE – 1500 BCESaharan pastoral nomadsMap of 2000 BCE →
- 1500 BCE – 500 BCEBerbersMap of 1500 BCE →
- 500 BCE – 200 BCESaharan pastoral nomadsMap of 500 BCE →
- 200 BCE – 1 BCEMauretaniaMap of 200 BCE →
- 1 BCE – 300 CERoman EmpireMap of 1 BCE →
- 300 CE – 400 CERome (Maximian)Map of 300 CE →
- 400 CE – 500 CEWestern Roman EmpireMap of 400 CE →
- 500 CE – 700 CENo state drawn here on the mapMap of 500 CE →
- 700 CE – 800 CEBarghawataunder Umayyad CaliphateMap of 700 CE →
- 800 CE – 1000 CEIdrisid CaliphateMap of 800 CE →
- 1000 CE – 1100 CECaliphate of CórdobaMap of 1000 CE →
- 1100 CE – 1200 CEAlmoravid dynastyMap of 1100 CE →
- 1200 CE – 1279 CEAlmohad CaliphateMap of 1200 CE →
- 1279 CE – 1300 CEMerinidesMap of 1279 CE →
- 1300 CE – 1492 CEMoroccoMap of 1300 CE →
- 1492 CE – 1530 CEWattasid CaliphateMap of 1492 CE →
- 1530 CE – 1650 CEWatassid MoroccoMap of 1530 CE →
- 1650 CE – 1938 CEMoroccoMap of 1650 CE →
- 1938 CE – 1945 CEMorocco (France)under FranceMap of 1938 CE →
- 1945 CE – 1960 CEMoroccounder FranceMap of 1945 CE →
- 1960 CE – todayMoroccoMap of 1960 CE →
Empires and states on this land
12Every state in the atlas whose territory, at its height, reached into today’s Morocco.
- Berbers1500 BCE–1200 CE
- Carthage500 BCE–200 BCE
- Kingdom of the Masaesyli200 BCE
- Mauretania200 BCE–100 BCE
- Western Roman Empire400 CE–500 CE
- Umayyad Caliphate700 CE
- Idrisid dynasty800 CE–900 CE
- Umayyad state of Córdoba800 CE–1000 CE
- Almoravid dynasty1100 CE
- Almohad Caliphate1200 CE
- Morocco1300 CE–
- Wattasid dynasty1492 CE–1600 CE
Visit today
See Morocco for yourself
Guided tours, museum and monument tickets, and day trips across Morocco, from the capital to the historic sites.
Tours and tickets in MoroccoOn GetYourGuide. We may earn a commission if you book. See our disclosure.
Morocco elsewhere on the site
- Empires and states
- Berbers, Guanches, Idrisid dynasty, Spanish Sahara, Wattasid dynasty
- Other countries
- Algeria, Democratic Republic of the Congo, Mali, Mauritania, Niger, Portugal