Walls of Marrakesh

City Gate and City Walls in Marrakesh

Marrakech City Gate
CC BY-SA 2.0 / János Korom Dr

The Walls of Marrakesh are a set of defensive ramparts which enclose the historic medina districts of Marrakesh, Morocco. They were first laid out in the early 12th century by the Almoravid dynasty which founded the city in 1070 CE as their new capital. The walls have since been expanded several times by the addition of the Kasbah to the south at the end of the 12th century and by the later extension of the walls to encompass the neighbourhood around the Zawiya of Sidi Bel Abbes.

The Gates of Marrakesh were for the most part established since the original Almoravid construction of the city walls but most have been modified during later periods. Other gates were also added when the Almohads created the Kasbah, which itself has been expanded and re-worked many times since.

History of the Walls of Marrakesh

Almoravid foundation (11th-12th centuries)

Marrakesh was founded in 1070 by Abu Bakr ibn Umar, the early leader of the Almoravids. At first, the city’s only major fortification was the Ksar al-Hajjar (“Palace/Fortress of Stone”), a royal citadel built by Abu Bakr to protect the treasury. It was located right next to the site of the current Kutubiyya Mosque in the western part of the city. Like other kasbahs of its time, it probably occupied a quadrangular area and is assumed to have had multiple gates (of which the western gate may have roughly corresponded to the later Bab al-Makhzen gate in the city walls). Excavations in the 20th-century revealed that the citadel’s southern side was 218 metres long, indicating a fairly large structure.  It was the first monumental structure built by the Almoravids and marked their definitive transition from a nomadic Saharan people to an empire with a fixed base.

It was only in 1126 that Ali ibn Yusuf, a later Almoravid amir, decided to surround the city with a full circuit of walls, which were completed in January or February 1127.The decision to fortify the city with ramparts was likely due to rising threat of the Almohads at the time. Abu-l-Walid ibn Rushd, a qadi from Cordoba and the grandfather of the famous Ibn Rushd (Averroes), was reportedly the one who convinced the amir to undertake the construction. Historical sources also claim that construction took only 8 months and cost 70,000 gold dinars.  Prior to construction, the path of the walls was laid out with ropes and the amir’s astrologers were consulted for the most propitious date on which to start.

The main outline of the medina’s walls today is still broadly that of the original Almoravid walls, although with notable differences to the north and south. The resulting walled area formed an irregular polygon of vaguely quadrangular shape. Some of the irregularities in this outline may have been due to existing cemeteries and religious sites or to last-minute decisions to include more land within the walls. Many of the city’s main gates also date back to this period — at least in their locations if not necessarily in their current forms and names. These gates were, in clockwise order starting from the northeast: Bab Fes (later known as Bab el-Khemis), Bab Debbagh, Bab Aylan, Bab Aghmat, Bab Yintan, Bab as-Saliha, Bab Neffis (probably the predecessor of Bab er-Robb today), Bab ash-Shari’a, Bab al-Makhzen, Bab el-‘Arissa (also known as Bab ar-Raha), Bab Doukkala, Bab Moussoufa, and Bab Taghzout. Four of these gates — Bab ash-Shari’a, Bab Moussoufa, Bab Yintan, and Bab as-Saliha — disappeared some time ago and are only known from historical texts or from vestigial physical evidence.

Almohad period (late 12th to 13th centuries) of the Walls of Marrakesh

When the Almohad ruler Abd al-Mu’min conquered Marrakesh in 1147 he reportedly destroyed many Almoravid monuments (especially mosques) but the Ksar el-Hajjar and the palace of Ali ibn Yusuf were still used as the official residence of the new Almohad rulers for a time.The Almohad caliph Ya’qub al-Mansur (ruled 1184-1199), however, embarked on an ambitious construction project to create a vast new royal district, the Kasbah, attached to the south side of the city. Its creation was motivated in part by the rapid growth of the city’s population and an urgent need for more space within the city. However it may also have been motivated by the Almohad caliph’s desire to follow the example of other powerful Islamic rulers who built separate palace-cities from which to rule, such as the Ummayyad construction of Madinat al-Zahra near Cordoba or the Abbasid construction of Samarra in Iraq. Construction of the kasbah began in 1185 and finished by 1190.

The current western and southern outline of the kasbah today, including its walls, most likely still date back essentially to the Almohad construction. The kasbah’s main gate was Bab Agnaou: both a defensive and a ceremonial gateway, located just inside the city walls near Bab er-Robb (Bab Neffis) and forming the main public access to the kasbah for the city’s residents. The Almohads also established vast gardens and orchards near the kasbah, in particular the al-Buhayra garden now known as the Agdal Gardens. These were located further and were enclosed by their own separate walls.

The Saadian and Alaouite periods (15th century and after) of the Walls of Marrakesh

Following the demise of the Almohad regime, Marrakesh as a whole fell into decline. The following Marinid dynasty made Fes their capital and carried out few major constructions in Marrakesh. It wasn’t until the Saadian Dynasty (16th century to early 17th century) established Marrakesh as their capital that the city saw a resurgence.  The Saadians renovated the kasbah and expanded its northern outline slightly with new palaces such as El Badi. Sultan Moulay Abdallah al-Ghalib also transferred the Jewish population of the city to a new Mellah district on the east side of the Royal Palace, expanding the eastern outline of the kasbah in the process. Sultan Ahmad al-Mansur also renovated and replanted the Agdal Gardens, thus maintaining this large walled enclosure to the south of the city.

The Saadians, and their successors the Alaouites, also sponsored the construction and expansion of the zawiya and mosque complex around the mausoleum of Sidi Bel Abbes, which was located just outside the northern gate of the city, Bab Taghzout. Sidi Bel Abbes is often considered the patron saint of Marrakesh and his zawiya attracted more and more settlers to the area until a flourishing neighbourhood developed here outside the walls of the city. In the 18th century, under the reign of the Alaouite sultan Muhammad ibn Abdallah, the walls of the city were finally extended to encompass this neighbourhood, forming the new northern point of the city. In the same period, the sultan also extended the Kasbah southwards and extended the Agdal northwards, until the walls of both enclosures were joined together. This constituted the last major extension and modification of the city walls.

Other works by Alaouite sultans still added to the existing walls and gates of the city. Sultan Muhammad ibn Abdallah is also responsible for much of the construction and redevelopment of the royal palace (Dar al-Makhzen) following years of neglect, giving it more or less its present-day form. The southern side of the Kasbah was expanded to accommodate new gardens, new neighbourhoods for palace servants and troops, and a series of walled squares known as mechouars (an official square/courtyard at the entrance of a royal palace). A multitude of gates were built to regulate passage between these new southern annexes. Many of them are of minor architectural interest, though Bab Ahmar (the easternmost gate) has a unique design that includes an elevated platform for light artillery. Lastly, following its destruction by the Rehamna in 1862, the western wall of the Agdal Gardens was rebuilt by Sultan Muhammad ibn Abd al-Rahman. At the same time, the sultan added a fort called Sqallat al-Mrabit to defend this part of the ramparts.

Description and design of the walls of Marrakesh

The walls have a fairly regular construction typical of medieval Morocco and al-Andalus, standing between 6 and 8 meters in height and fortified every 25 to 30 meters by square towers or bastions.   The walls vary between 1.4 and 2 meters in thickness, while the towers vary in thickness between 8 and 14 meters. Originally the walls were topped by a narrow path (wall walk) which was protected by battlements with merlons, though many of these have since disappeared. There is evidence that the walls were originally surrounded by a ditch or moat, though this may not have played a significant defensive role.

Constructions methods and maintenance of the Walls of Marrakesh

The walls of Marrakesh, like those of Fes and most historic cities in Morocco, were built in rammed earth, an ancient building technique found across the Near East, Africa, and beyond. It is also known as “pisé” (from French) or “tabia” (from Arabic). It generally made use of local materials and was widely used thanks to its low cost and relative efficiency. This material consisted of mud and soil of varying consistency (everything from smooth clay to rocky soil) usually mixed with other materials such as straw or lime to aid adhesion. The addition of lime also made the walls harder and more resistant overall, although this varied locally as some areas had soil which hardened well on its own while others did not. For example, the walls of Marrakesh are composed of up to 17% lime, while those of Fes and nearby Meknes contain up to 47%. The technique is still in use today, though the composition and ratio of these materials has continued to change over time as some materials (like clay) have become relatively more costly than others (like gravel).

The walls were built from bottom to top one level at a time. Workers pressed and packed in the materials into sections ranging from 50 and 70 cm in length that were each held together temporarily by wooden boards. Once the material was settled, the wooden restraints could be removed and the process was repeated on top of the previously completed level. This process of initial wooden scaffolding often leaves traces in the form of multiple rows of little holes visible across the face of the walls. In many cases walls were covered with a coating of lime, stucco, or other material to give them a smooth surface and to better protect the main structure.

This type of construction required consistent maintenance and upkeep, as the materials are relatively permeable and are more easily eroded by rain over time; in parts of Morocco, (especially near the Sahara) kasbahs and other structures made with a less durable composition (typically lacking lime) can begin to crumble apart in less than a couple of decades after they’ve been abandoned. As such, old structures of this type remain intact only insofar as they are continuously restored; some stretches of wall today appear brand new due to regular maintenance, while others are crumbling.

City Gates of Marrakesh

Location of the main gates of Marrakesh

Aside from those of the Kasbah, the city’s main gates all date back to the Almoravid period when the city walls were first built, but most of them have undergone subsequent modifications in later periods. Many of the medieval gates had complex “bent entrances” designed for greater defensiveness. Nowadays, simple archways have been opened alongside many of them to allow for easier passage in and out of the medina, along with other gaps in the city walls created to accommodate new roads.

Gates of the medina

The following are the main historical gates of the medina (the main walled city; not counting the Kasbah to the south). The gates are described below in order, starting from the northeast corner of the medina and proceeding in a clockwise fashion.

Bab el-Khemis

This gate is located in the northern/northeastern corner of the city walls and dates back to the Almoravid period. It was originally known as Bab Fes (“Gate of Fes”), but this name was apparently lost during the Marinid era.The gate’s current name (el-Khemis) refers to the souk or open-air market which historically took place here every Thursday (al-Khamis in Arabic). Nowadays, the market continues almost all week right outside the gate,[16] while a permanent flea market, Souk al-Khemis, has been constructed a few hundred meters to the north.[20][21] Also just outside the gate is a qubba (domed mausoleum) housing the tomb of a local marabout or Muslim saint.

The gate’s outer entrance is flanked on either side by square bastions. The gate’s passage originally consisted of a bent entrance which effected a single 90-degree turn; one entered the gate from the north and then exited westwards into the city. According to legend, the door leaves of the gate were brought from Spain by a victorious Yusuf ibn Tashfin.During the Almohad period, the gatehouse was expanded such that its passage effected three more right-angle turns before exiting southwards. This gave it a similar form and layout to several other major Almohad gates such as Bab er-Rouah. The outline of the gate’s original exit, now walled-up, can still be seen in its interior western wall.The gate underwent a significant renovation in 1803-04 on the orders of Sultan Moulay Slimane, noted by a marble inscription found inside. At some point in the 20th century, the inner wall of the passage was opened up to allow a straight passage directly through the gate in order to facilitate the heavy traffic in the area, resulting in the current form of the gate.

Bab ad-Debbagh

The floor plan of Bab Debbagh, showing the interior passage which turns multiple times. (The outer entrance is on the right, the inner side is on the left; the lightly-shaded areas indicate roofed-over or vaulted spaces.)Bab ad-Debbagh (or simply Bab Debbagh) is the northernmost of the two eastern gates of the city, dating back to the Almoravid period. Its name means “Gate of the Tanners” and refers to the nearby tanneries which have been present here since the Almoravid period. It has the most complicated layout of any gate: its passage bends 5 times, in an almost S-like path, passing through two open-air courts and one covered chamber.[2] A staircase in the southeastern corner of the structure grants access to the roof of the gate. Scholars believe, however, that only the central part of the gate (the vaulted chamber) dates back to the original Almoravid gate and that the Almohads added the inner and outer courtyard sections. The gate thus originally would have had a “simple” bent entrance (i.e. it turned 90-degrees only once).

Bab Aylan

Bab Aylan is the other (southernmost) eastern gate of the city, south of Bab Debbagh. It is named after the Aylan tribe (pronounced Haylana in Arabic), which was part of the Berber Masmuda confederacy. The gate was the site of the Battle of al-Buhayra in 1130 in which the Almoravids defeated an assault by the Almohads. (The battle was named after a garden, Buhayrat al-Raka’ik, which was located here near the eastern gates of the city.) The original Almoravid gate had a simple bent passage (i.e. turning 90-degrees once) located within a bastion on the outer side of the ramparts. Some time after the Almoravid period another bent passage was added on the inner side of the gate, such that one enters the gate from the south, turns twice (first left, then right), and emerges into the city facing north.

Bab Aghmat

This gate was named after Aghmat, the early capital of the Almoravids before Marrakesh, which lay in this direction (i.e. to the south/southeast). The gate may have also been called Bab Yintan, though this is uncertain and this name may have referred to another nearby gate which has since disappeared. Like other Almoravid gates of the city, it has been significantly modified since its initial construction. Originally, it most likely consisted of a bent passage which effected a full 180-degree turn, forming a symmetrical structure around the axis of the wall: one entered from the west through a bastion on the outer side of the city wall, passing through a roofed vestibule, then exited westwards from the bastion on the inner side of the wall, passing through an open-air court.In a much later period a walled courtyard with a very different construction style was added on the outer end of the gate, forcing traffic to effect one more 180-degree turn (though in recent times the northern wall of this courtyard has been knocked down to allow a more direct passage). A staircase in the northeastern corner of the gatehouse leads to the roof. A major cemetery, the Bab Aghmat Cemetery, occupies a wide area just outside the gate.

Bab er-Robb (Bab Neffis)

Bab er-Robb is one of the most unusual gates in the city, and the only one to be located in an angle or corner of the walls. While historians Deverdun and Allain believes the gate to be of Almohad origin (specifically under Ya’qub al-Mansur) due to its location relative to the Almohad Kasbah, historian Quentin Wilbaux more recently argued that its location in the wider schema of the city suggests it was an original Almoravid gate. All of them believe that Bab Neffis, another gate described in historical sources and named after the nearby Neffis (or N’fis) River, was most likely another name for the same gate. The word Robb or Rubb refers to a type of cooked wine whose vineyards were cultivated along the Neffis River and thus imported and regulated through this gate. A water basin measuring approximately 70 by 40 metres once existed outside this gate, in an area now covered by a cemetery, and was used for swimming practice.

The main structure of the gate is a bastion inside which a bent passage enters from the north, performs a 180-degree turn, and then exits again to the north. Today, the walls in the area have been moved around the gate’s bastion such that both entrances of the gate, facing north, open inside the city walls, obscuring its original role as an entrance to the city. However, when the gate was studied by French scholars in 1912 the surrounding city wall had a different configuration: rather than attaching to the side of the gatehouse it attached to the middle of the gate’s northern facade, between its two doorways, such that the eastern doorway was outside the city wall while the western one was inside the walls. Since both entrances still faced north, this meant that the outer entrance was not actually directly visible to outsiders coming from the countryside because it faced back towards the city walls; as a result, travelers arriving from the south had to walk all the way around to the far side of the bastion and enter it from the north. Because of this uncharacteristic configuration, and based on comparisons with other gates of the city, Wilbaux has hypothesized that the city’s ramparts in this area were previously altered and moved around the gate such that the entrances were originally reversed: the eastern doorway, which was the outer entrance in 1912, was originally located inside the city walls, while the western doorway (the inner entrance in 1912) was originally outside the city walls. This way, the bastion of the gate straddled the city wall and its design was thus quite similar to the original configuration of Bab Aghmat, the other southern gate of the city.

Bab al-Makhzen

Bab al-Makhzen is one of the western gates of the city, located west of the Kutubiyya Mosque. It dates back to the Almoravid period. It was probably named after the palace (Dar al-Makhzen) which existed near here in the Almoravid period as part of the former Ksar el-Hajjar. The gate is flanked by octagonal towers and has been much modified. It originally had a simple bent passage (turning 90 degrees to the north) but the gatehouse has since disappeared and only a simple arched opening remains today. At the beginning of the 20th century the gate was walled-up and closed, but today a road passes through it.

Bab al-‘Arisa (Bab ar-Raha)

Bab al-‘Arisa (meaning “Gate of the Bride”; also spelled as Bab Larissa or Bab Lrissa) is also known as Bab al-‘Arais (“Gate of the Fiancés”) and formerly as Bab ar-Raha (Raha possibly meaning “abundance” or “well-being”; it is also a surname in Marrakesh). It is the other western gate of the city, located north of Bab el-Makhzen in an angle of the ramparts, and dates back to the Almoravid period.[3] Like Bab al-Makhzen to the south, the gate is flanked by octagonal towers and originally had a simple bent passage (turning 90 degrees to the north), but has since been modified. It was walled-up at the beginning of the 20th century but today it has a simple opening through which a local road passes.

Bab Doukkala

Bab Doukkala is the northwestern gate of the medina. Its name, Doukkala, was that of both a Berber tribe and of a region between Marrakesh and Casablanca today. The gate is also of Almoravid construction, but unlike many others it has not been subject to major modifications (at least in its floor plan) and retains its original sophisticated bent entrance design. The passage inside the gate bends at a straight angle twice: one enters from the west, turns south, then turns east before emerging into the city. Today the gate is flanked by other simple openings in the wall to allow for easy circulation.

Other minor gates of the medina

A few other gates, mainly from recent centuries, can be found around the city and have their own names, in addition to a number of non-notable openings in the walls which have been created to improve free movement in and out of the medina. These include:

Bab Nkob: Bab Nkob is a recent gate created during the French Protectorate period (1912-1956) to connect the old medina with the new city districts created by the French known as Gueliz. Today it is simply a gap in the walls through which a major road passes.

Bab Jdid: Bab Jdid (“New Gate”) is another recent gate to the west of the Kutubiyya Mosque and near the Mamounia hotel and gardens. A modern road passes through it.
Bab Qchich: Bab Qchich (also spelled Bab Kechich, or Kechiche) is a recent gate located between Bab el-Khemis and Bab ad-Debbagh, at the northeastern tip of the old medina. A modern road passes through this modest archway named after the former landlord of the nearby garden.

The Walls of Marrakesh appears in our Complete Guide to Visiting Marrakesh!

This website uses affiliate links which may earn a commission at no additional cost to you!

Visiting Walls of Marrakesh

Address: Bab Agnaou, Marrakesh, Morocco
Duration: 20 minutes

Nearby Attractions

Tours and Activities from Marrakesh