Kasbah of Marrakesh

The Kasbah of Marrakesh is a large walled district in the southern part of the medina of Marrakesh, Morocco, which historically served as the citadel (kasbah) and royal palace complex of the city. A large part of the district is still occupied by the official royal palace, the Dar al-Makhzen, which serves as the residence of the King of Morocco when he visits the city. The rest of the district consists of various neighbourhoods and monuments. It was founded by the Almohads in the late 12th century, with most of the construction carried out by Caliph Ya'qub al-Mansur (r. 1184–1199). Two of its most important surviving structures today, the Kasbah Mosque and the main gate of Bab Agnaou, date from al-Mansur's reign.

The palace complex was neglected after the fall of the Almohads, but the Kasbah was restored and rebuilt by the Saadian dynasty in the 16th century, during the time of sultans Abdallah al-Ghalib and Ahmad al-Mansur, who created new palaces and extensive gardens. The Saadian Tombs and the ruins of the El Badi Palace date from this period. Abdallah al-Ghalib was also responsible for the creation of a Jewish quarter, the Mellah, adjoined to the Kasbah's eastern flank. Following another period of neglect and pillage, the palaces were rebuilt and redeveloped by the 'Alawi sultan Muhammad ibn Abdallah who gave the Royal Palace (Dar al-Makhzen) and its surroundings much of their present form.

Today the kasbah is no longer a restricted district, apart from the royal palace, and is a popular tourist attraction in the city.

The Almohad kasbah
The first citadel and royal residence of Marrakesh was the fortress and residence known as the Ksar el-Hajjar, built by the Almoravid leader Abu Bakr ibn Umar when he founded the city in 1070. This fortress was located north of the current Kutubiyya Mosque. The later Almoravid emir Ali ibn Yusuf (ruled 1106–1143) attached a palace to the south, on the site of what is now the mosque. Remains of these Almoravid structures have been excavated and the remains of a stone gate called Bab 'Ali, belonging to Ali's palace, are visible today alongside the ruins of the first Kutubiyya Mosque. When the Almohad ruler Abd al-Mu'min conquered Marrakesh in 1147, he reportedly destroyed many Almoravid monuments (especially mosques). However the new Almohad rulers for a time used the Ksar el-Hajjar and the palace of Ali ibn Yusuf as their official residence. According to Ibn Idhari, in 1183 the Almohad ruler Abu Ya'qub Yusuf ordered the construction of a new extension to the city following complaints of overpopulation inside the old city. The project was entrusted to his son Ya'qub al-Mansur, and since Abu Ya'qub Yusuf died soon after in 1184 it was he who was responsible for most of its construction during his subsequent reign (1184–1199). However, some scholars attribute the Kasbah's foundation entirely to Ya'qub al-Mansur in 1185 and estimate that it was completed circa 1190. This ambitious construction project created a vast new royal district attached to the south side of the city. The new citadel and extension of the city was known in historical sources as the Kasbah (or Qasaba), as well as Tamurakusht and as-Saliḥa. It was built over the site of an Almoravid garden estate known as as-Saliḥa. Only the eastern portion of this garden remained afterward, later replaced by the present-day Mellah. The construction of the kasbah was motivated in part by the rapid growth of the city's population and an urgent need for more space within the city. 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 Marrakesh kasbah began in 1185 and finished by 1190, though al-Mansur's successors continued to build more palaces within it, totaling twelve by the end of the Almohad period. The Almohad kasbah was a vast self-contained district surrounded by ramparts and further subdivided by inner walls. It included not only the royal palace (known as the Dar al-Khalifa or Qasr al-Khilafa ), but also the congregational mosque (the Kasbah Mosque), markets and qaysariyya (bazaar), bathhouses (hammams), warehouses, stables, cemeteries, gardens, and squares. A "madrasa" stood next to main square near the palace, though the Almohad madrasa was most likely not the same type of institution as the madrasas introduced to Morocco under the Marinid dynasty in the later 13th century. It provided education for the ruler's children and family members. The expansion of the city also included the founding of a hospital (maristan), the location of which is unclear.

The main public entrance to the kasbah was the Bab Agnaou, a gate located in the kasbah's northwestern corner and accessed from inside the city walls. Despite some modifications, it is well-preserved today and features extensive stone-carved decoration. Another gate, the Bab as-Sadat, allowed direct entrance into the kasbah from outside the city walls but was reserved for high officials and members of the royal dynasty. The Almohads also built vast pleasure gardens around the kasbah, such as the Agdal Gardens to the south which were surrounded by walls. A gate known as the Bab al-Bustan allowed direct access between the caliph's palace and the gardens.

The kasbah was divided into three parts by inner walls which each had its own gate. The largest section was the caliph's palaces, covering about 24 ha and occupying the entire eastern side of the kasbah. The second division was in the southwest corner, taking up about 12 ha and containing the various services required by the palace and government. Notably, this district was centered around a large square or plaza known as the asaraq and which was the early equivalent of a mechouar. From this square, a gate known as Bab ar-Riyad led to the caliph's palaces. Next to this gate was an audience pavilion, known as Qubbat al-Khilafa, which allowed the caliph to observe ceremonies taking place in front of the gate. The third section, more publicly accessible, occupied 8 ha in the northwestern corner of the kasbah and contained the Kasbah Mosque and its annexes. Another public square, also known as the asaraq, existed in front of the mosque. This northwestern asaraq was smaller than the one in the southwestern division of the kasbah. A main street ran in a straight line from north to south connecting these two squares. The street was once lined with porticos and was accessed at either end by two gates known as the Bab at-Tubul (to the north) and the Bab as-Saqa'if (to the south).

Aside from the mosque and the main gate, Bab Agnaou, almost none of the Almohad structures have survived intact. The current western and southern outline of the kasbah, including its walls, probably date to the Almohad construction, but many other ramparts and gates have been changed since. The main street that ran between the two asaraq squares is evident today but the southern asaraq square has disappeared.

Saadian period
Marrakesh fell into decline with the demise of the Almohad regime. Their successors, the Marinid dynasty, made Fes their capital and carried out few major constructions in Marrakesh. It wasn't until the Saadian Dynasty (16th to early 17th centuries) established Marrakesh as their capital that the city saw a resurgence. The Saadians established themselves in the old Almohad kasbah and undertook their own renovations and reconstructions. Sultan Moulay Abdallah al-Ghalib constructed new palaces and annexes in the northern part of the kasbah and repaired the Kasbah Mosque after it was damaged in a gunpowder explosion in the 1560s or 1570s. He built the first structures of the Saadian Tombs on the south side of the mosque. He also transferred the Jewish population of the city to a new Mellah on the east side of the Royal Palace, which expanded the eastern outline of the kasbah. Sultan Ahmad al-Mansur, who oversaw the apogee of Saadian power, undertook another series of constructions and renovations. He built the most elaborate mausoleums in the Saadian Tombs. Most famously, he constructed an extravagant palace known as El Badi. The palace was used for the reception of ambassadors and other guests. It was designed as a showcase of al-Mansur's power and wealth, making use of the most lavish materials and decoration including Italian marble.

The Saadian palace complex of this period was entered via a "Grand Mechouar": a large ceremonial square or courtyard on the site of the former southern asaraq square, to the south of the Kasbah Mosque. The square measured about 180 by. The main gate of the royal palace was situated there and led to a smaller mechouar. From the smaller mechouar a long passage ran east to give access to the palace's various components. On the south side of this passage were located most of the service annexes of the palace, including kitchens, warehouses, the treasury, and stables. On the north side of the passage was the vast reception palace (the El Badi Palace), along with the private quarters of the sultan and his family, their bathhouses (hammams), a private mosque, and the mint. Beyond these structures and further east, were a number of pleasure gardens which occupied the whole eastern side of the kasbah. These included the Crystal Garden (az-zujaj), the garden known as al-Mustaha ("the Desired"), and the Qasr Garden or inner garden. The Crystal Garden, located on the east side of the Badi Palace, was for private use by the palace residents. The al-Mustaha garden, to the south, was reportedly open to the public. It included a large water basin which was used for bathing during the summer. The Qasr Garden was located south of El Badi Palace and next to Ahmad al-Mansur's private apartments. Ahmad al-Mansur also renovated the vast Agdal Gardens to the south of the kasbah. Lastly, sources from this period also describe and illustrate a tall tower rising from the center of the palaces and visible from afar. This tower is of uncertain origin and disappeared during the 'Alawi era, but may have been an observation tower built for the enjoyment of the sultan.

'Alawi period to present
After the decline of the Saadian dynasty, the kasbah was severely neglected again, as the 'Alawi dynasty that succeeded them rarely used Marrakesh as their capital. Moulay Isma'il notably plundered the Saadian palaces for materials (such as marble) to use in his own palace and kasbah that he was building in Meknes. The Badi Palace became a ruin, though the Saadian Tombs were used as a necropolis for some members of the 'Alawi royal family. The main exception to this neglect was the reign of Muhammad ibn Abdallah, who ruled Marrakesh as governor for his father from 1746 and then used it as his unofficial capital when he was sultan between 1757 and 1790. Muhammad Ibn Abdallah undertook a large number of renovations and constructed new palaces. He also built a new mosque, the Barrima Mosque, on the eastern perimeter of the palaces. A state prison was created within the grounds and annexes of the old Badi Palace, immediately adjacent to Muhammad's new palace. The current structures and gardens of the royal palace date mainly from this period (at least in terms of their overall layout). During this process Muhammad also expanded or developed the kasbah on its south side, creating a number of new mechouars (walled squares) as part of the approach to the royal palace, whose entrance was now reoriented to the south instead of the west. Construction on the main part of Muhammad's new palace was begun in 1747, when he was still viceroy under his father Abdallah. This construction included the creation of the large Arsat an-Nil garden and its surroundings. According to historian Gaston Deverdun, the palace sections on the north side of this garden were probably first finished in 1753–54 but were rebuilt or remodeled between 1760 and 1765, when Muhammad was sultan. The southern sections of the palace were probably finished before 1760. The palace as a whole, including some of the outlying structures around the mechouars, were finished in the 1760s. Nonetheless, there is evidence that Muhammad continued to carry out works later in his reign and that he enlisted European craftsmen (particularly from Spain) for many of its elements.

Up to the late 19th century and early 20th century the kasbah was still the center of power in Marrakesh. Wealthy government ministers built their own palaces and mansions near it during this period. The most famous of these is Bahia Palace, later turned into a royal palace. The Agdal Gardens were also maintained and were replanted in the 19th century, with new royal pavilions constructed within them and new fortifications constructed on their west side.

Overview
Today the kasbah is no longer a restricted district and much of it is accessible to the public. It is located on the south side of the main medina. Its western sections are filled with residential neighborhoods. Most of its eastern section continues to be used as the Royal Palace (Dar al-Makhzen) for the King of Morocco, which is off-limits to the public. To the north of the palace are the remains of the monumental El Badi Palace, which are now a historic site accessible to tourists.

In the northwest area of the kasbah is the citadel's original congregational mosque, the Kasbah Mosque (a.k.a. the Mansuriyya Mosque and the Mosque of Moulay al-Yazid), which is active today and accessible to Muslims. Just west of the mosque, at the junction between the walls of the medina and the walls of the kasbah, is the former main gate of the kasbah, Bab Agnaou. Near the kasbah, past Place des Ferblantiers to the north, is the Bahia Palace.

Between the mosque to the west and the El Badi and Dar al-Makhzen palaces to the east is an area that was once part of the royal palace or its annexes but today is occupied by residential neighborhoods. The shape and outline of certain neighborhood streets follow former palace walls or other structures no longer extant. The main street of the kasbah (Rue de la Kasbah), running roughly north–south between the mosque and the Derb Chtouka neighbourhood, corresponds to the original avenue that linked the two asaraq squares in the Almohad period.

The kasbah is flanked to the east by the former Jewish district of the city, the Mellah. To the south of this is another neighborhood created in recent centuries called Bab Ahmar or Bab Hmar (named after a nearby gate). To the west, the kasbah is flanked by largely open ground. To the south of the kasbah are the vast Agdal Gardens, which are enclosed in their own set of walls connecting with the walls of the kasbah. Between these gardens and the Royal Palace are several mechouar&thinsp;s (large enclosed squares) that constitute the main approach to the Royal Palace.

The Royal Palace
The Royal Palace of Marrakesh, known as the Dar al-Makhzen ("House of the Government"), is used as an official royal residence and is off-limits to the public. While the palace complex historically encompassed most of the kasbah, it now occupies a more limited space. The current structures and gardens of the palace date mainly from the 'Alawi period, mostly from the time of Moulay Muhammad ibn Abdallah in the 18th century. The original 18th-century palace was arranged in a regular and symmetrical fashion reflecting a riad-style layout, but subsequent constructions have added asymmetrical elements.

The mechouars
The palace's main entrance is from the south. It is approached via a series of walled courtyards or official squares known as mechouar&thinsp;s (also spelled meshwar), a common feature of traditional royal palaces in Morocco. These occupy a large space between the palace to the north and the Agdal Gardens to the south.

The mechouars, arranged in a series roughly east to west, are accessed through a number of gates – although many are of minor historical or architectural interest. The first (outermost) gate to the east is Bab Ahmar ("Red Gate"; also spelled Bab Hmar). It is the most notable gate due its incorporation of a large guardhouse and a terrace that could hold light artillery. Behind this gate is a neighbourhood of the same name and a street running west to Bab al-Furma, a gate which in turn leads to the Outer Mechouar (also known as Mechouar al-Barrani). This mechouar is a large rectangular plaza measuring about 200 by, located directly south of the Mellah and Barrima neighbourhoods. West of this mechouar is a narrower rectangular mechouar, the Inner Mechouar (also called Mechouar al-Wastani), measuring about 200 by. It is entered from the east via the Bab er-Rih gate. On its north side is the official main gate to the palace, Bab al-Akhdar. On its west side is a gate known as Tla ou Habet  on top of which a protected passage provided direct access between the palace and the Agdal Gardens to the south. This gate leads in turn to the largest mechouar, the Grand Mechouar (also called Mechouar al-Awwali). This mechouar occupies a large open area measuring 360 by. A gate at its northeastern corner, called Bab Bu 'Uqqaz, leads to the palace and was traditionally used to receive ambassadors or to conduct other ceremonies. A gate on the west side of this mechouar leads to a narrow walled road that runs to the westernmost gate of this area, Bab Ighli, which marks the southwest corner of the kasbah. At the southern end of the Grand Mechouar is a menzeh (observation pavilion) known as the Qubbat as-Suwayra ("Pavilion of Essaouira"), so-called because its construction was most likely funded by tax revenues from Essaouira. It dates from the reign of Muhammad ibn Abdallah and was most likely finished in the 1760s, like the rest of the palace. This pavilion is built over the wall between the mechouar and the gardens and externally distinguished by its green-tiled pyramidal roof. The heavy pillars and walls at ground level uphold a large square chamber above, which was heavily decorated with zellij tiling and painted wood ceiling. This chamber gives access to a loggia on its north side that allowed the sultan to observe ceremonies in the mechouar. The loggia features a wide arch on its external façade whose spandrels are decorated with floral arabesques, above which is an Arabic inscription in red. On its south side, the chamber also gives access to a small open terrace which allowed the sultan to admire the view of the Agdal Gardens and of the Atlas Mountains to the south. The pavilion was likely built with the help of European masons. At least one source, cited by historian Gaston Deverdun, claims the architect was a Spaniard sent by Charles III to Muhammad ibn Abdallah in friendship.

Interior of the palace
The interior of the palace consists of various gardens and courtyards surrounded by chambers and pavilions. It is dominated by the largest riad garden in Marrakesh, the Arsat an-Nil ("Garden of the Nile"). It is named after the Nile River, allegedly because it was planted with flora from Egypt. Measuring around 130 by, it is divided by a north–south path, which in turn is intersected by several perpendicular paths.

The palace structures are divided in two main groups: one to the north of the garden and one to the south. Along the west side of the garden is a row of structures that housed private apartments for the sultan as well as a small mosque and other facilities. On the east side of the garden is a gate that leads to the Barrima Mosque, the official mosque of the palace built by Muhammad ibn Abdallah.

The structures on the north side of the Arsat an-Nil, known collectively as al-Qasr al-Akhdar ("the Green Palace"), are arranged around two large rectangular courtyards: a northern one and a southern one. The courtyards are formal in appearance and enclosed by white walls behind which are various rooms and smaller inner courtyards. The northern courtyard, which is directly southeast of the El Badi Palace, is the simplest in form and contains a fine zellil-tiled pavilion facing a central fountain. The courtyard's perimeter is surrounded by richly-decorated rooms. The southern courtyard (measuring 34 by) is open on its south side to the Arsat an-Nil garden. At the middle of its north side is a large reception hall known as the Sattiniya. The hall is distinguished by its large pyramidal green roof and richly decorated interior. It is entered from the south via a triple-arched portico, in front of which a large square pool of water is positioned at the center of the courtyard. This overall symmetrical arrangement and the courtyard's opening on the south was designed to provide a visually grand approach to the Sattiniya from the Arsat an-Nil gardens. The palace wing on the east side of this courtyard was historically the residence of the sultan's hajib (chamberlain), while the wing on the west side of the courtyard included facilities such as kitchens and storage rooms. The west wing is also topped by an observation belvedere called the Menzeh ar-Radhi, with views on the courtyard and the garden.

The main structure on the south side of the Arsat an-Nil is called ad-Dar al-Kebira ("the Great House"). It originally consisted of one vast courtyard around which were three secondary courtyards. The main courtyard was entered from the south via a series of gates including Bab al-Akhdar (the outer entrance to the palace from the mechouars). The whole ensemble was strongly symmetrical and was arranged to form a grand approach to the main gardens to the north. It once included a hexagonal pool of water and the usual green pyramidal roofs which were all aligned with the central axis of the Arsat an-Nil. However, since the 18th century various other structures and rooms have been added or modified in this area, such that it has now lost its symmetry. Its large courtyard is symmetrical and features two halls with pyramidal roofs that face each other on its east–west axis, but the surrounding structures have a more irregular layout.