The fortifications of Marrakech were first constructed in 1126 and 1127 by Almoravid leader 'Ali bin Yusuf (reg. 1107-1142). At that time, Marrakech was the capital city of the Almoravid empire and was the subject of increasingly frequent attacks by other groups attempting to seize power of the region, particularly the Almohads who eventually conquered the city. The fortifications were built to enclose the city along its extents at that time and to protect the capital, its treasury and its leaders. The huge construction project was completed in only eight months.
The overall plan of the fortifications is an irregular polygon with fifteen major faces, including one extremely long south face. The plan is asymmetrical, as it was determined by the sprawl of the Almoravid city that the walls were built to enclose. In all, the length of the fortifications is approximately 9 km, making it one of the longest continuous city enclosures in existence. After 1147, Almohad rulers encouraged city growth beyond the boundaries of the Almoravid fortifications, so the walls bound only the inner medina of modern-day Marrakech.
The wall system includes a series of gates that provide fortified points of entry and exit from the Almoravid city. Twelve principal gates, some of which still stand, were constructed during the Almoravid period and the first years of Almohad rule. While some of the gates were built concurrently with the construction of the walls in 1126, others are dated to the time of the Almohad conquest of Marrakesh in 1147. At least seven additional gates previously existed but have been destroyed and are less known to contemporary historians. The twelve major original gates of the Marrakesh fortifications, in linear sequence, are Bab Aylan, Bab ad-Dabbagin, Bab el-Khemis, Bab Tagzut, Bab Mussufa, Bab Dukkala, Bab ar-Raha, Bab al-Mahzan, Bab as-Saria, Bab Neffis, Bab as-Saliha, and Bab Aghmat. Not included in this list is the gate that is best known today, the Bab Agnaou, which was built in 1147 but only became well-trafficked decades later.
Along their length, the walls feature numerous defensive towers that project out along their exterior faces. These towers would allow soldiers within the city to fight invading forces from a superior vantage at the top of the perimeter wall. The walls are approximately 2 meters deep along their length, and 8 to 14 meters deep where they are thickened by the addition of towers or fortified gates. There is also archaeological evidence that the walls were originally surrounded by a fossé, or a large dry ditch which served to increase the height of the ramparts from the exterior.
Due to the speed with which the fortifications needed to be constructed in order to stave off enemy attacks, the use of stone as a primary building material was quickly ruled out, as it was both difficult to source and expensive. Instead the ramparts, walls, fortified towers and gates were constructed using the pisé (rammed earth) technique, also known as tabiya or luh. In this construction method, moistened earth was rammed into temporary formworks from above to create a densely packed mud wall that built up from the ground in stratified layers. This technique had spread to Morocco after early Roman and Phoenician examples were built along the coast, and the red soil around Marrakech had proven to be ideal for this type of construction in previous applications.
A major addition to the fortifications was made in the 1830s by Moulay 'Abd-al-Rahman (reg. 1822-1859) in order to protect the vast Agdal Gardens that he commissioned adjacent to the south of the existing city walls. Enclosing these gardens added approximately 7 kilometers of defensive walls to the extant fortifications of the city. The west ramparts bordering the Agdal Gardens were destroyed in 1862, only 30 years after their construction; the ruling sultan Sidi Muhammad IV (reg. 1859-1873) rebuilt the ruined sections of the wall and further commissioned the fort Sqallat al-Mrabit to defend the west side of the city.
While the north and west faces of the Almoravid walls remain relatively intact, a large portion of the south wall and three of its gates have been ruined. Additional small sections of the wall have been lost, as well as most of the Almohad gates. However, the fortifications remain a strong physical presence in Marrakech today and continue to demarcate the boundary between the early Almoravid city and its later Almohad, Sa'did, Alawid and French expansions.
Bosworth, Clifford Edmund. 1996. The New Islamic Dynasties, 37-53. New York: Columbia University Press, 1996.
Deverdun, Gaston. Marrakech, des origines à 1912, 108-128, 229-232, 528-529. Casablanca: Editions Frontispiece, 2004.