History of Morocco: From the Idrisids to Independence

Morocco's history stretches back thousands of years, and it is one of the few countries in the region that was never absorbed into the Ottoman Empire. Successive dynasties built the cities, mosques and fortresses you can still visit today, so understanding the timeline makes every trip richer.
At a glance
- Earliest inhabitants
- Amazigh (Berber) peoples
- First Moroccan dynasty
- Idrisids, from 788
- Protectorate
- 1912 to 1956
- Independence
- 1956
In this guide
Amazigh roots, Phoenicians and Romans
The Amazigh (Berber) peoples are the indigenous inhabitants of North Africa and have lived in what is now Morocco for millennia. Phoenician and Carthaginian traders founded coastal trading posts, and later the Romans made the region the province of Mauretania Tingitana. The best-preserved Roman city is Volubilis, near Meknes, which is now a UNESCO World Heritage Site.
The arrival of Islam and the Idrisids (788–974)
Arab armies brought Islam in the seventh century, and many Amazigh tribes adopted the faith. In 788 Idris I, a descendant of the Prophet Muhammad, founded the first Moroccan Islamic dynasty. His son, Idris II, made Fes his capital around 808, laying the foundations of the world's oldest continuously inhabited medina.
Almoravids and Almohads (11th–13th centuries)
The Almoravids, a Saharan Amazigh movement, founded Marrakech around 1070 and built an empire that stretched into Spain. They were replaced by the Almohads, who built monumental architecture such as the Koutoubia Mosque in Marrakech and the Hassan Tower in Rabat. Their empire ran from Iberia to Tunisia. See our guide to Moroccan architecture for what they left behind.

Marinids, Wattasids and Saadians (13th–17th centuries)
The Marinids made Fes a centre of learning, building madrasas including Al Attarine and Bou Inania. The Saadian dynasty (1549–1659) defeated a Portuguese army at the Battle of the Three Kings in 1578. Under Ahmad al-Mansur they built the opulent El Badi Palace and the Saadian Tombs in Marrakech, funded partly by the trans-Saharan trade in gold and sugar.
The Alaouite dynasty (1666–present)
The Alaouites, who still rule today, reunified the country. Sultan Moulay Ismail (reigned 1672–1727) made Meknes his imperial capital and built vast walls, gates and stables. In 1777 Morocco became one of the first countries to recognise the new United States of America.
The protectorate and independence
In 1912 the Treaty of Fes made most of Morocco a French protectorate, with a Spanish zone in the north and south. French planners built modern quarters such as the Art Deco and Mauresque districts of Casablanca. Nationalist movements grew, and Sultan Mohammed V, who became King, led Morocco to independence in 1956. His son Hassan II ruled from 1961 to 1999, and Mohammed VI has been king since then. A new constitution was adopted in 2011.
Seeing Moroccan history on your trip
Volubilis (Roman), Fes (Idrisid and Marinid), Marrakech (Almoravid, Almohad and Saadian), Meknes (Alaouite) and the Rabat fortress of the Udayas are the best places to walk through the timeline. Our 7-day itinerary links several of them.
Frequently asked questions
When did Morocco become independent?
Morocco regained independence from France in March 1956, and from Spain for most of the Spanish zone shortly afterwards in April 1956.
Which dynasty rules Morocco today?
The Alaouite dynasty, which has ruled since the 17th century. King Mohammed VI is the current monarch.
Was Morocco ever part of the Ottoman Empire?
No. Morocco kept its independence from the Ottomans, which is one reason its culture and institutions developed differently from those of its neighbours.
