# Walls of Marrakesh

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 a later extension to encompass the northern 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
### 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.$^{:57}$ 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.$^{:110}$$^{:224}$ 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.$^{:108–109}$ 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.$^{:118–128}$ 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)

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 Umayyad 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.$^{:214}$ 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)

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 was not 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. 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.$^{:529}$

### 2023 earthquake

Following the 2023 Marrakesh-Safi earthquake on 8 September, portions of the city walls collapsed.

## Design of the walls

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.$^{:116}$ 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

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).$^{:80}$
Rammed earth 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

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, while a permanent flea market, Souk al-Khemis, has been constructed a few hundred meters to the north. 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 to facilitate the heavy traffic in the area, resulting in the current form of the gate.
* The outer (northern) facade of Bab el-Khemis
* The inner (southern) facade of Bab el-Khemis

#### Bab ad-Debbagh

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. 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).
* The outer (eastern) entrance of Bab Debbagh
* The bending passage inside the gate
* The inner (western) entrance of Bab Debbagh (facing the city)

#### 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.$^{:199–201}$

#### 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. 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.
* The outer (western) facade of Bab Doukkala
* The inner (eastern) facade of Bab Doukkala

#### 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.
* Bab Nkob today
* Bab Jdid today
* Bab Jdid in a 1919 postcard

### Former gates of the medina

At least four more gates, possibly five (depending on the status of Bab Yintan) formerly existed along the perimeter of the medina's city walls but have since disappeared or been rendered obsolete. They are listed here.

#### Bab Taghzout

Dating to the Almoravid period, this was originally the northern gate of the city until Sultan Muhammad ibn Abdallah extended the city walls to encompass the northern neighbourhood of Sidi Bel Abbes in the 18th century. The gate's name, Taghzout, is of unclear historical origin but is a common Berber toponym with a few different meanings; it may have referred to a nearby village or to the valley of the Tensift River. The gate is also called Bab Sidi Bel Abbes (after the nearby shrine). The gate resembled the nearby Bab el-Khemis in its original configuration: it was flanked by two square bastions and had a bent entrance by which one entered from the north and exited to the west. Today, however, the gate has lost its bastions and its bent passage and all that remains is a large archway over the main street to the south of the Zawiya of Sidi Bel Abbes.

#### Bab Moussoufa

Bab Moussoufa (or Bab Massufa) is an Almoravid gate whose history is uncertain but whose location is hypothesized to have been in the northwest corner of the city, north of Bab Doukkala and west of Bab Taghzout, near the neighbourhood of Riyad al-'Arus. Its name comes from an Almoravid Berber tribe.$^{:120–121}$

#### Bab ash-Shari'a

Bab ash-Shari'a, meaning the "Gate of Justice/Law" (Shari'a), was the main southwestern gate of the city, dating back to the Almoravid period. It was located near an angle of the walls just west of Bab er-Robb. The gate was rebuilt in the Almohad period when Abu Ya'qub Yusuf ordered his son, Ya'qub (the future al-Mansur), to move this section of the wall further south to accommodate a new neighbourhood for the city's growing population. This work was carried out over August and September 1183 and a new Bab ash-Shari'a gate was inaugurated by Abu Ya'qub Yusuf.$^{:114}$ The location of this gate has since been blocked and occupied by the mausoleum of Imam as-Suhayli (one of the Seven Saints of Marrakesh), though remains of the gate can be seen next to the mausoleum.
A large open-air prayer area, called a musalla or msalla, was located just outside the gate during the Almoravid and Almohad era (though it may have been moved during the construction of the Kasbah).$^{:244}$ Also near here was a hippodrome for equestrian games and training, equipped with a pavilion from which the amir or caliph could observe the activities. Today this area is occupied by a large cemetery stretching out from Bab er-Robb.

#### Bab as-Saliha

This was one of the southern gates of the Almoravid city, named after the Saliha gardens south of the city. It was located where the Almohad Kasbah district was later created; which is when the gate likely disappeared.

#### Bab Yintan

Scholars are uncertain about the identity and location of this gate. It may have been a southern gate of the city, possibly near what later became the Jewish Mellah on the east side of the Kasbah, but it has since disappeared without any clear trace. Another possibility is that it was simply another name for Bab Aylan or, more likely, Bab Aghmat. French historian Gaston Deverdun, in particular, favoured this second hypothesis.

### Gates of the Kasbah

The earliest gates of the Kasbah date to the Almohad period, but a number of gates date from the various expansions of the kasbah and the royal palace (Dar al-Makhzen) in later centuries.

#### Bab Agnaou

Bab Agnaou, one of Marrakesh's most famous and beautiful gates, was the main public and ceremonial entrance to the Kasbah of the city. The name agnaou is believed to be of Berber origin and had multiple historically reported meanings including "mutes" and, later on, "Black people" (or the Gnawa); however, it is unclear what exact connotation the name had in this case.$^{:230}$ The gate was also called Bab al-Qasr ("Gate of the Palace") and Bab al-Kuhl ("Gate of Kohl").$^{:229–230}$ Its construction is attributed to Ya'qub al-Mansur (the founder of the Kasbah) in 1188.
It is located just inside the walls of the medina, near Bab er-Robb. The gate was originally flanked by two bastion towers and the passage inside was a bent entrance (meaning it turned 90 degrees before exiting) passing through a large vaulted vestibule.$^{:230–231}$ On top of the gate was a terrace reached by an interior staircase. This layout made it similar to other monumental Almohad gates such as Bab er-Rouah in Rabat. The flanking towers and the covered vestibule, however, have since disappeared, and the archway of the gate has been partly filled-in with a smaller brick arch. Nonetheless, the gate has preserved its rich stone-carved decoration from the Almohad period, again comparable to that of Bab er-Rouah and of Bab Oudaia in Rabat.

#### Bab Berrima

Bab Berrima (also spelled Bab Barrima) is a gate between the main city (the medina) and the northeast part of the Kasbah, at the south end of Place des Ferblantiers today. It has existed since the Saadian period. Its creation may have been needed to allow workers to come and go during construction of the Badi Palace, which is located nearby. The gate consists of a simple arched passage cut through a tower in the perimeter wall of the Kasbah. The tower was once crowned with sawtooth-shaped merlons from the Saadian era, but these have since disappeared. The gate is flanked by rows of boutiques which are more recent constructions.$^{:473–474}$

#### Bab Shkiru

This gate is located at the northeastern corner of the current Royal Palace (inside the perimeter of the Kasbah). It was built on the orders of Sultan Moulay Hassan (ruled 1873–1894) to facilitate access to the palace at this end. It is named after the qadi who was in charge of its construction.$^{:537}$

#### Bab Ksiba

Bab Ksiba (or Bab Qusayba) is a small western gate to the Kasbah district. It used to be the entrance to another small kasbah (qusayba) which was adjoined to the main kasbah in this area to protect the western side of the Grand Mechouar (a vast open square, still present today, at the entrance of the royal palace) and the Derb Chtouka neighbourhood. The date of its construction is unclear; it existed at the beginning of the 19th century and may have been built under Muhammad ibn Abdallah in the 18th century, but was almost certainly not part of the original Almohad kasbah.$^{:501}$

#### Gates around the mechouars of the Royal Palace

Under Muhammad ibn Abdallah (governor of Marrakesh after 1746, sultan 1757–1790), the Royal Palace (Dar al-Makhzen) in the Kasbah was renovated and expanded. This expansion mainly progressed southwards, where the sultan built a number of mechouars (official squares at the entrance to the Royal Palace where royal ceremonies and receptions could take place). These occupy a large space between the palace to the north and the Agdal Gardens to the south. The mechouars are accessed through a number of gates with their own unique names; although many of the gates are of minor historical or architectural interest. Roughly from east to west, these gates are:
* Bab Ahmar: Bab Ahmar ("Red Gate"; also spelled Bab Hmar) is the eastern entrance into the southern kasbah districts and mechouars. It is located at the southern corner of the Bab Aghmat Cemetery. The gate dates to the reign of Muhammad ibn Abdallah and may have been the work of Ahmad al-Inglisi, who was responsible for building and restoring a variety of monuments across Morocco around this time.$^{:497–498}$ The gate was also used as a large guardhouse with a terrace that could hold light artillery. The neighbourhood near the gate was inhabited mainly by Black African servants and soldiers working for the Royal Palace.$^{:497}$
* Bab al-Furma: This gate stands between the Bab Ahmar district to the east and the Outer Mechouar (also called Mechouar al-Barrani) to the west. Its name means "Gate of the Breach".$^{:498}$
* Bab al-Harri: This gate is the passage between the Outer Mechouar and the Barrima neighbourhood to the north. Its name means "Gate of the Silos(/Granaries)".$^{:498}$
* Bab ar-Riyal: This gate led from the Outer Mechouar to the palace of the viceroy. The origin of its name is unclear.$^{:498}$
* Bab er-Rih: This gate leads from the Outer Mechouar to the Inner Mechouar (also called Mechouar al-Wastani) to the west. Its name means "Gate of the Wind", though the origin of this is unclear.
* Bab "Tla ou Habet": On the west side of the Inner mechouar, opposite Bab ar-Riyal, is another monumental gate over which a passage along the top of the wall allowed for direct and discrete passage between the palace and the Agdal Gardens to the south.$^{:498}$ According to Gaston Deverdun, the gate was known as "Tla ou Habet" (meaning "climb and descend!"). After its construction, the gate was repaired again by Sultan Moulay Hassan between 1873 and 1894.$^{:537}$ Beyond this gate and wall is the vast Grand Mechouar.
* Bab al-Akhdar: Meaning the "Green Gate", this was the main entrance of the Royal Palace at the middle of the northern side of the Inner Mechouar. (The northern part of the palace was also known as al-Qasr al-Akhdar or "the Green Palace".)$^{:498}$
* Bab Bu 'Uqqaz: Named after a qadi in charge of constructions in the palace, this is the main entrance of the Royal Palace from the Grand Mechouar (west of the Inner Mechouar), where ambassadors were received. It is located in the northeastern corner of this mechouar.$^{:499}$
* Bab Ighli: West of the Grand Mechouar, at the end of a main street between two walls, is a gate known as Bab Ighli (also spelled Bab Irhli), named after the mason who built the original gate.$^{:501}$ South of the gate is the Cemetery of Sidi A'mara.$^{:534}$ Another gate (of uncertain name) at the eastern end of the same street, on the edge of the Grand Mechouar itself, is notable for the distinctive tower on its north side. The tower, topped by a pyramidal green-tiled roof and featuring a small wooden balcony, is actually the minaret of the former Mosque of Derb Chtouka (named after a street in the adjoining neighbourhood), an 18th-century mosque (also by Sultan Muhammad ibn Abdallah) which has since disappeared.$^{:491}$
* Bab Ahmar in the early 20th century
* Bab er-Rih, the eastern gate of the Inner Mechouar, near the entrance of the Royal Palace
* Bab al-Akhdar, the entrance to the Royal Palace on the northern side of the Inner Mechouar
* Bab "Tla ou Habet", the western gate of the Inner Mechouar, leading to the Grand Mechouar on the other side
* The western gate of the Grand Mechouar (leading to Bab Ighli Street). The tower on the right is the minaret of the former 18th-century Mosque of Derb Chtouka.
* Bab Ighli Street, looking west towards Bab Ighli gate (visible in the distance)

#### Former gates of the Almohad Kasbah

A number of gates existed in the original Almohad kasbah which have disappeared today but are known from historical sources. In particular, the kasbah had a number of inner gates which granted passage between its three main districts, as well as few outer gates aside from Bab Agnaou. They included:
* Bab as-Sadat: While Bab Agnaou was the main public entrance to the Kasbah for the common people, the high officials and royal family members of the Almohad regime used to enter via a gate known as Bab as-Sadat (roughly meaning "Gate of the Lords/Nobles").$^{:224,230}$ It was located in the outer western wall of the Kasbah, allowing them to enter the Kasbah directly without having to pass through the city. Inside, the gate led to the main square (the Asaraq) in the central western district of the kasbah, which in turn granted access to the caliph's palaces. Outside the walls, near this gate, was an important cemetery.$^{:245}$
* Bab as-Saqa'if: Meaning "Gate of the Porticoes", this gate was located along the main street connecting the main square (the Asaraq) in the central western part of the kasbah to another main square in front of the Kasbah Mosque to the north. The entire length of the street was lined with porticoes or galleries, hence the gate's name. The gate was the main entrance to the Asaraq from the north, standing not far from Bab as-Sadat.$^{:226}$$^{:245}$
* Bab at-Tubul: Meaning "Gate of the Drums", this gate was located at the other (northern) end of the main porticoed street which ran from Bab as-Saqa'if, granting access to a square in front of the Kasbah Mosque.$^{:227}$$^{:245}$ The gate, in one form or another, was still present in the 16th century.$^{:258}$
* Bab ar-Riyad: Meaning "Gate of the Riad" (referring to a palace with an interior garden), this was the personal entrance of the caliph to his palace. Standing next to it was an audience pavilion from which the caliph could observe events and ceremonies in the Asaraq.$^{:220–221}$$^{:244}$
* Bab al-Ghadr: Meaning the "Gate of Betrayal", this gate is partly a mystery. It is referenced in historical sources, including an anecdote in which the Almohad caliph al-Murtada was forced to knock down the gate while attempting to flee the city in 1266–67.$^{:221–222}$ It may have been a postern gate on the south side of the kasbah.$^{:245}$
* Bab al-Qarraqin: Meaning (approximately) "Gate of the Cobblers", this was essentially a service gate for the kasbah, located on its northern side and allowing access to the main city to procure further supplies. The gate was likely modest in character.$^{:221}$$^{:245}$
* Bab al-Bustan: Meaning "Gate of the Garden", this gate was located at the southern end of the palace district and allowed passage between the palace and the Agdal Gardens to the south of the Kasbah.$^{:244}$ French historian Deverdun believed the gate may have been at the same location as the main entrance of the current royal palace, which is aligned with the gardens.$^{:220}$