Marrakech City Walls and Gates: The Ramparts That Still Define the Medina
The red-ochre walls of Marrakech stretch for roughly 16 to 19 kilometres around the historic medina, punctuated by ornate gates that have stood for more than 800 years. Free to view at any hour, they are one of the most accessible and atmospheric walks in Morocco's most-visited city.
Quick Facts
- Location
- Surrounding the medina of Marrakech, Marrakech-Safi region, Morocco. Key gate: Bab Agnaou, Rue Oqba Ben Nafaa, Mechouar-Kasbah, Marrakech 40000
- Getting There
- Walk from Jemaa el-Fna (10-15 min to nearest gates); petit taxi to any named gate. No metro in Marrakech. ALSA Bus 19 from the airport runs to the city centre with stops near Jemaa el-Fna.
- Time Needed
- 30 minutes for a single gate; 2-3 hours for a meaningful ramparts circuit on foot or by calèche
- Cost
- Free. No ticket, no booth, no entrance fee. Accessible at all hours as part of the public streetscape (illumination varies by section).
- Best for
- Architecture lovers, photographers, walkers, history buffs, families with children

What You Are Actually Looking At
The Marrakech city walls, known formally as the Remparts de la médina de Marrakech, are medieval defensive fortifications that enclose the historic medina on all sides. Built primarily from pisé, a rammed-earth construction technique using local red clay, the walls take on the warm, terracotta colour that gives Marrakech its nickname, the Red City. At a glance they appear monolithic, but look closely at the surface texture and you can see the layered strata left by each successive pour of compacted earth, a construction record written into the rammed earth itself.
Stretching roughly 16 to 19 kilometres in circumference, the walls stand between 6 and 8 metres tall in most sections and are reinforced at intervals by square towers. They are classified as Moroccan national heritage under multiple royal decrees, and they form an integral part of the UNESCO World Heritage listing for the medina of Marrakech, inscribed in 1985. Despite their age, large sections remain structurally intact, which is remarkable for an earthen construction in a semi-arid climate.
ℹ️ Good to know
The walls have no single entry point or visitor centre. Access is simply by walking up to them from any street. The most photographed and historically significant gate is Bab Agnaou, on the southern edge of the medina near the Kasbah quarter.
The Gates: Each One a Different Character
The medina walls are broken by a series of gates, called babs in Arabic, each with a distinct architectural character and historical function. Bab Agnaou is the most celebrated. Dated to the Almohad period of the 12th century, it served as the principal ceremonial entrance to the royal kasbah. The arch is carved from dark grey-blue Guéliz stone, a material traditionally said to be quarried from hills just west of the city, and it contrasts sharply with the terracotta walls on either side. The decorative carving across the arch combines geometric interlacing with an Arabic inscription band, and the detail is fine enough that you can stand in front of it for ten minutes and keep finding new patterns. Traffic now flows through it constantly, which makes lingering a matter of finding a space on the pavement to one side rather than standing in the gateway.
Other gates worth seeking out include Bab Doukkala on the northwest side, a double-arched gate with a more austere military character, and Bab el-Khemis to the north, which opens onto a flea market that operates most mornings. Bab er-Rob and Bab Ahmar flank the southern walls near the Kasbah, while Bab Nkob and others punctuate the eastern stretches. Each gate tells you something slightly different about who built it and what it was protecting. For a focused look at one of the finest examples in context, the Bab Agnaou guide covers the iconography and best angles in more detail.
A Brief History: Why These Walls Were Built and When
Marrakech was founded in the 11th century by the Almoravid dynasty, and the first defensive walls around the nascent city were constructed not long after. The Almohad dynasty, which supplanted the Almoravids in the 12th century, substantially rebuilt and extended the fortifications, and much of what survives today reflects Almohad-era construction. Bab Agnaou dates to this period. Subsequent dynasties, including the Saadians in the 16th century, added, repaired, and modified sections, particularly around the kasbah in the south.
The walls were not purely military infrastructure. They defined where the medina ended and where agricultural land and cemeteries began. They regulated commerce and movement through a limited number of controlled gates. Today, the line of the wall still serves as the psychological boundary between the compressed world of the medina and the wider modern city. Standing at any gate and looking in one direction, then the other, makes that historical boundary immediately legible.
How the Experience Changes by Time of Day
Early morning, roughly between 6am and 8am, is when the walls are at their most atmospheric. The light from the east catches the textured pisé surface and throws every imperfection into relief, turning the walls into a study in shadow and ochre. The streets alongside the ramparts are quiet at this hour, used mainly by locals commuting on motorbikes and the occasional street sweeper. The smell of freshly baked bread drifts from nearby bakeries, and the call to prayer echoes from minarets above the roofline. If you want a serious photograph of Bab Agnaou without a foreground full of motor scooters, dawn is your window.
Midday in summer is the least comfortable time for walking the perimeter. The walls face the sun on multiple aspects, there is almost no shade along the external circuit, and temperatures regularly exceed 35 degrees Celsius from June through August. If you are visiting in summer, reserve the ramparts for late afternoon, when shadows lengthen and the ochre glows warm rather than bleached. Spring and autumn mornings are genuinely pleasant for a longer walk, with temperatures mild enough to sustain a 2-hour circuit without distress.
After sunset, the illuminated gates, particularly Bab Agnaou and Bab Doukkala, take on a theatrical quality. Floodlighting picks out the carved detail that the flat midday light flattens entirely. The streets around the gates are active with locals rather than tourists at this hour, and the atmosphere is quieter and more local than anything you will find inside the medina.
💡 Local tip
For the best Bab Agnaou photograph: arrive just after sunrise, position yourself slightly to the left of the gate facing the arch, and use the frame of the arch itself to compress the traffic behind. The carved stone reads much better in soft directional light than in the flat glare of noon.
Walking or Riding the Ramparts Circuit
A full circuit of the exterior walls on foot takes somewhere between 2.5 and 4 hours depending on your pace and how many times you stop. The terrain is mostly flat and paved, but sections of the perimeter road can be narrow, busy with car and moped traffic, and lacking pavements. The northern and eastern stretches are less frequently walked by tourists and have a more ordinary urban character: repair workshops, storage depots, and neighbourhood streets backing onto the walls. These sections are not dramatic, but they give you an accurate sense of how the medina boundary functions as a living edge rather than a heritage showpiece.
A calèche, the horse-drawn carriage that operates from ranks near Jemaa el-Fna, is the traditional way to do a partial circuit and is a reasonable option if you want to cover ground without the exertion. Negotiate a price before you board, agree explicitly on which section of the walls you want to see, and expect the experience to be leisurely rather than informative; the drivers are not trained guides. Cycling is another option and gives you more control over where to stop.
If you are combining the walls with other nearby monuments, the southern stretch near Bab Agnaou connects naturally to the Saadian Tombs and the Bahia Palace, making a coherent half-day itinerary through the Kasbah quarter without backtracking.
Practical Details: What to Know Before You Go
Access is completely free and requires nothing more than showing up. There are no opening times because the walls are simply part of the public streetscape. No tickets, no queues, no audio guides sold at the gate. This is both a virtue and a limitation: you get complete independence, but there is no interpretive signage to tell you what you are looking at or when it was built.
Footwear matters more than most visitors anticipate. The pavements and road surfaces around the perimeter range from smooth tarmac to broken paving, loose gravel, and patches of compacted earth. Comfortable walking shoes with a closed toe are advisable; sandals are manageable for short sections but become uncomfortable over a full circuit. Sun protection is non-negotiable for summer and spring visits: there is almost no shade on the exterior perimeter walk, and the walls reflect heat as well as absorb it.
Getting there from the centre of the medina is simple on foot. From Jemaa el-Fna, walk south along Rue du Bab Agnaou (roughly 10-12 minutes) to reach the Kasbah gate. For other sections, a petit taxi to the named gate of your choice is the quickest approach; drivers understand gate names. Confirm the destination clearly before departing.
⚠️ What to skip
The road running along the outside of the walls carries real traffic, including motorbikes and delivery vehicles that move quickly. Walk facing traffic on sections without pavements, and supervise children closely, particularly near the busier gate openings.
Who Will Get the Most From This, and Who Might Not
The walls reward visitors who are content to observe, photograph, and let historical context accumulate slowly, particularly those already interested in Islamic architecture or urban form. Travellers exploring the medina on a walking tour of Marrakech will find the gates natural pivot points in any route. Architecture enthusiasts who have already visited the Ben Youssef Madrasa will recognise the same Almohad decorative vocabulary in the carving at Bab Agnaou.
A practical note if you are short on time or visiting in midsummer: the full circuit is a significant physical undertaking in heat, and the experience of the walls, while genuinely worth having, is not concentrated into a single dramatic moment. You cannot go inside anything, there is no exhibition, and most of the perimeter looks more or less the same. Travellers who need a clear narrative payoff, a museum room to step into or a ruin to stand inside, may find the experience more satisfying focused solely on Bab Agnaou for 20 minutes than spread across a 3-hour walk.
Visitors with mobility impairments can view the major gates comfortably, as the street-level approach to Bab Agnaou and Bab Doukkala is essentially flat. However, the perimeter route is uneven in places and has no dedicated accessible infrastructure, so a full circuit on foot is not practical for wheelchair users. Arriving by taxi and viewing individual gates is a workable alternative.
Insider Tips
- The best-preserved and most continuous stretch of exterior wall runs along the southern edge between Bab Agnaou and Bab er-Rob. Walk this section at dusk when the light comes in low from the west and the surface glows a deep amber.
- Street food vendors and juice stalls cluster near Bab Doukkala and Bab el-Khemis in the mornings. The flea market at Bab el-Khemis is most active on Thursday and Friday, and it is a completely different crowd from the souk vendors inside the medina.
- The carved stone arch at Bab Agnaou is made from Guéliz stone, a blue-grey sandstone quarried from the hills west of the city. This material does not appear elsewhere on the walls, which makes the gate immediately recognisable even from a distance.
- If you hire a calèche for the circuit, ask specifically to include the eastern wall section toward Bab Ahmar. Most standard routes skip this stretch, but the scale of the walls along the open palm-grove edge gives you the best sense of how formidable the fortifications would have appeared to an approaching army.
- The walls look completely different in winter after rainfall: the pisé darkens dramatically when wet, and the surface texture becomes even more pronounced. If you are visiting in December or January and it has rained recently, the walls are worth a look before they dry out.
Who Is Marrakech City Walls & Gates For?
- Architecture and history enthusiasts interested in Almohad and medieval Islamic design
- Photographers looking for free, consistently photogenic subjects at any hour
- Walkers who want to orient themselves spatially within the medina before diving into the souks
- Families with older children who can cover ground and appreciate the scale of the fortifications
- Travellers on a budget who want a meaningful experience without entrance fees
Nearby Attractions
Other things to see while in Marrakech Medina:
- Ben Youssef Madrasa
Ben Youssef Madrasa is a 16th-century Saadian theological college in the heart of Marrakech's medina, and arguably the most ornately decorated interior in the entire city. Its central courtyard combines carved cedar, zellij tilework and sculpted stucco in a way that stops most visitors cold. This guide covers exactly what to expect, when to go, and how long to spend.
- Dar El Bacha – Musée des Confluences
Built in 1910 for the powerful Pasha Thami El Glaoui, Dar El Bacha is one of the medina's grandest palatial complexes. Restored and reopened as the Musée des Confluences, it now presents Moroccan art and craftsmanship within some of the city's most extraordinary interior architecture.
- Koubba Ba'adiyn (Almoravid Qoubba)
Built around 1117, the Koubba Ba'adiyn is the sole intact Almoravid structure in Marrakech and one of the oldest Islamic monuments in the city. Small in footprint but immense in historical weight, it sits several metres below the current street level near Ben Youssef Square, offering a rare glimpse into the architectural vocabulary that defined Islamic North Africa before the Almohads arrived.
- Le Jardin Secret
Tucked inside a 19th-century palace complex on Rue Mouassine, Le Jardin Secret is one of the largest traditional riad gardens in the Marrakech medina. Opened to the public in 2016 after an extensive restoration, it offers two distinct garden styles, ornate Islamic architecture, and a rooftop tower with panoramic views of the medina roofscape and the Atlas Mountains beyond.