page_title: Walls of Marrakesh
section_title: Almoravid foundation (11th-12th centuries)
hierarchical_section_title: Walls of Marrakesh / History / Almoravid foundation (11th-12th centuries)
caption_attribution_description: English: Eastern walls of Marrakesh, north of Bab Debbagh.
context_page_description: 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 13th 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.
context_section_description: 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. 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 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.
caption: The eastern walls of the city, near Bab Debbagh
exif: {"Image ImageWidth": "3528", "Image ImageLength": "1974", "Image XResolution": "72", "Image YResolution": "72", "Image ResolutionUnit": "Pixels/Inch", "Image Orientation": "Horizontal (normal)", "Image YCbCrSubSampling": "2", "Image DateTime": "2014:12:21 12:45:04", "Image Make": "FUJIFILM", "Image Model": "X20", "Image Software": "PaintShop Pro 20.00", "Image Copyright": "", "Image InterColorProfile": "[]", "Image ExifOffset": "182", "Thumbnail Compression": "JPEG (old-style)", "Thumbnail XResolution": "72", "Thumbnail YResolution": "72", "Thumbnail ResolutionUnit": "Pixels/Inch", "Thumbnail JPEGInterchangeFormat": "4064", "Thumbnail JPEGInterchangeFormatLength": "5672", "EXIF ExifVersion": "0230", "EXIF FlashPixVersion": "0100", "EXIF ColorSpace": "sRGB", "EXIF ComponentsConfiguration": "YCbCr", "EXIF CompressedBitsPerPixel": "16/5", "EXIF ExifImageWidth": "3528", "EXIF ExifImageLength": "1974", "EXIF DateTimeOriginal": "2014:12:21 12:45:04", "EXIF DateTimeDigitized": "2014:12:21 12:45:04", "EXIF ExposureTime": "1/900", "EXIF FNumber": "32/5", "EXIF ExposureProgram": "Program Normal", "EXIF ISOSpeedRatings": "100", "EXIF ShutterSpeedValue": "989/100", "EXIF ApertureValue": "27/5", "EXIF BrightnessValue": "1001/100", "EXIF ExposureBiasValue": "0", "EXIF MaxApertureValue": "2", "EXIF MeteringMode": "Pattern", "EXIF LightSource": "Unknown", "EXIF Flash": "Flash did not fire, compulsory flash mode", "EXIF FocalLength": "66/5", "EXIF FocalPlaneXResolution": "4545", "EXIF FocalPlaneYResolution": "4545", "EXIF FocalPlaneResolutionUnit": "3", "EXIF SensingMethod": "One-chip color area", "EXIF FileSource": "Digital Camera", "EXIF SceneType": "Directly Photographed", "EXIF CustomRendered": "Normal", "EXIF ExposureMode": "Auto Exposure", "EXIF WhiteBalance": "Auto", "EXIF SceneCaptureType": "Standard", "EXIF Sharpness": "Normal", "EXIF SubjectDistanceRange": "0", "EXIF SensitivityType": "Standard Output Sensitivity"}