Morocco’s cities tell much of the country’s story. Four of them, Fez, Marrakech, Meknes and Rabat, served as capital under one dynasty or another, which is why they are known as the imperial cities of Morocco. Around them you will find fortified ports, Andalusian medinas in the north and fast-growing cities along the southern Atlantic coast. This guide explains what makes a city imperial, what each one is like, which cities are the largest according to the 2024 census, and how to fit them into one trip.
The four imperial cities of Morocco are Fez, Marrakech, Meknes and Rabat, the present capital. All four have their medina or historic centre on the UNESCO World Heritage List, as do Tetouan, Essaouira and El Jadida. The biggest city is Casablanca, with about 3.2 million people in the 2024 census. For a first trip, the classic route links Rabat, Meknes, Fez and Marrakech in about a week.
What are the imperial cities of Morocco?
The term covers the four cities that, at some point, were the seat of power of a ruling dynasty: Fez, Marrakech, Meknes and Rabat. None of them held the title for good. The capital moved whenever a new family took over, and each one left its mark in walls, gates, mosques and palaces. Visiting them in turn is a bit like walking through a thousand years of Moroccan history.
The chart below shows which dynasty ruled from which city, based on the UNESCO World Heritage descriptions and the general history of the country.
| Dynasty | Fez | Marrakech | Meknes | Rabat |
|---|---|---|---|---|
| Idrisids9th century | Capital | |||
| Almoravids1056-1147 | Capital | Founded or major project | ||
| Almohads1147-1269 | Capital | Founded or major project | ||
| Marinids13th-15th centuries | Capital | |||
| Saadians16th century | Capital | |||
| Alaouites, Moulay Ismail1672-1727 | Capital | |||
| Modern Moroccosince 1912 | Capital |
- Capital
- Founded or major project, not yet capital
Sources: UNESCO World Heritage descriptions of Fez, Marrakech, Meknes and Rabat. Rabat, the current capital, was laid out as a modern capital under the Protectorate, from 1912.
What stands out is how the role passes from one city to the next. Marrakech, founded by the Almoravids in 1070-1072, was capital of both the Almoravids and the Almohads. The Marinids moved power back to Fez, which then lived through its golden age. Moulay Ismail, the great Alaouite sultan, chose Meknes in the late 17th century. And Rabat, where the Almohads had planned a grand capital they never finished, finally took on the role in the 20th century.
The four imperial cities at a glance
Fez, the medina city
Founded between 789 and 808 under the Idrisids, Fez is described by UNESCO as one of the most extensive and best preserved historic towns of the Arab-Muslim world. Its old medina, Fes el-Bali, is a car-free maze where goods still move on foot or by donkey, and it is home to the Qarawiyyin mosque and university, founded in 859. We cover it in detail in our guide to things to do in Fez.
Marrakech, the red city
Capital of the Almoravids and then the Almohads, Marrakech keeps the Koutoubia mosque and minaret from that period, and the famous Saadian Tombs from a later one. Today it is the most visited city in the country and the best base for the Atlas Mountains and the south. If you are spending a few days there, see our guides to the Marrakech souks and medina and to Marrakech weather by month.
Meknes, Moulay Ismail’s capital
Meknes began in the 11th century as an Almoravid military settlement, but its great moment came under Sultan Moulay Ismail (1672-1727), who made it his capital and ringed it with walls, monumental gates and huge granaries. Bab Mansour is its best-known image. It is the calmest of the four and is usually paired with the Roman ruins of Volubilis, a short drive away and also a World Heritage site.
Rabat, the capital
Rabat is really two cities in one. On one side are the Almohad walls and gates and the Hassan mosque, begun in 1184 and never completed, the remains of a capital that was never finished. On the other is the modern city, planned between 1912 and the 1930s, with avenues and buildings that UNESCO listed in 2012 together with the historic core. It is the political and administrative capital of Morocco.
Moroccan cities on the World Heritage List
Morocco has nine cultural sites on the World Heritage List. Seven are cities or parts of cities. The other two, the ksar of Ait Ben Haddou and the archaeological site of Volubilis, stand on their own and are usually visited from a nearby city.
- 1981: the medina of Fez.
- 1985: the medina of Marrakech.
- 1987: the ksar of Ait Ben Haddou, near Ouarzazate. Read more in our guide to Ait Ben Haddou.
- 1996: the historic city of Meknes.
- 1997: the medina of Tetouan and the archaeological site of Volubilis.
- 2001: the medina of Essaouira, the old Mogador.
- 2004: the Portuguese city of Mazagan, in El Jadida.
- 2012: Rabat, modern capital and historic city.
The largest cities in Morocco (2024 census)
The 2024 general census counted 36,828,330 people in Morocco. According to the High Commission for Planning, seven large cities account for almost 38% of the country’s urban population.
| City | Population |
|---|---|
| Casablanca | 3.24 million |
| Tangier | 1.28 million |
| Fez | 1.18 million |
| Marrakech | 1.02 million |
| Salé | 945,000 |
| Meknes | 562,000 |
| Rabat | 516,000 |
Source: High Commission for Planning (HCP), results of the 2024 general population and housing census.
One surprise: Rabat, the capital, is the smallest of the seven, although with Salé, just across the Bou Regreg river, it forms one large urban area. Tangier has now overtaken both Fez and Marrakech, driven by its port and industry.
The country is divided into twelve regions, from Tanger-Tetouan-Al Hoceima in the north to Laayoune-Sakia El Hamra and Dakhla-Oued Ed-Dahab in the south. It helps to know them, as many road signs and tourist offices refer to the region.
Other cities in Morocco worth knowing
- Casablanca: the business capital. Its big sight is the Hassan II Mosque, opened in 1993 on the edge of the ocean, with a 200-metre minaret.
- Tangier: the gateway from Spain, with a medina above the Strait and, a few kilometres away, Tanger Med, one of the major ports of the Mediterranean.
- Tetouan: its white medina, a World Heritage site, was rebuilt by refugees from al-Andalus and still has a strong Andalusian feel.
- Chefchaouen: the blue town of the Rif, a couple of hours from Tangier. See our guide to Chefchaouen.
- Essaouira: an 18th-century fortified port on the Atlantic coast, with ramparts, steady winds and a medina that is easy to explore on foot.
- Agadir: a beach city rebuilt almost entirely after the 1960 earthquake.
- Laayoune and Dakhla: the main cities of the south. Dakhla sits on a peninsula of about 40 km that shelters a lagoon popular with kitesurfers.
Getting around between Moroccan cities
The train is the easiest way to link the big cities along the Atlantic side. Since November 2018 the Al Boraq high-speed line has connected Tangier with Rabat and Casablanca, cutting the Tangier to Casablanca journey from 4 hours 45 minutes to about 2 hours 10 minutes. Work on extending high-speed rail from Kenitra to Marrakech, roughly 430 km, began in April 2025, with no opening date yet.
For the south, the Atlas and the desert, the road is still essential. Distances are deceptive: between mountains and villages, journeys take longer than the map suggests, so avoid packing too many cities into too few days.
Which route suits your trip
- Four or five days: pick two cities and take your time, for example Marrakech plus a day in the Atlas, or Fez with Meknes and Volubilis.
- One week: the classic imperial cities loop, from Casablanca or Rabat to Meknes, Fez and Marrakech.
- Eight to ten days: the imperial cities plus a night in the desert, crossing the Middle Atlas from Fez to Merzouga and returning to Marrakech along the road of the kasbahs.
That last combination is the one we follow on our 8-day imperial cities and desert tour, which starts and ends in Casablanca.
Cities in Morocco: frequently asked questions
What are the 4 imperial cities of Morocco?
Fez, Marrakech, Meknes and Rabat. All four served as capital under a ruling dynasty, and Rabat is the capital of Morocco today.
What is the capital of Morocco?
Rabat. Casablanca is the largest city and the main business centre, but it is not the capital.
What is the largest city in Morocco?
Casablanca, with about 3.24 million people in the 2024 census, followed by Tangier, Fez and Marrakech.
Which Moroccan cities are UNESCO World Heritage sites?
The medinas of Fez, Marrakech, Tetouan and Essaouira, the historic city of Meknes, the Portuguese city of Mazagan (El Jadida) and Rabat. Ait Ben Haddou and Volubilis are listed too.
Which is the most beautiful city in Morocco?
It depends on what you are after: Fez for the most traditional medina, Marrakech for atmosphere and day trips, Chefchaouen for mountain scenery and Essaouira for the sea.
How many days do you need for the imperial cities?
A week is enough to see all four without rushing. If you want to add the desert, allow eight to ten days.
Sources
- UNESCO World Heritage Centre: properties in Morocco and the pages for Fez, Marrakech, Meknes and Rabat.
- High Commission for Planning (HCP), 2024 general population and housing census: results by region and results presentation.
- Hassan II Mosque Foundation: history of the mosque.
- Moroccan National Tourist Office: kitesurfing in Dakhla.
- International Union of Railways (UIC): opening of the Tangier to Casablanca high-speed line (2018).


