Kasbah Mosque, Marrakesh

The Kasbah Mosque (مسجد القصبة), also known as the Moulay al-Yazid Mosque, is a historic mosque in Marrakesh, Morocco. It was originally built by the Almohad ruler Yaqub al-Mansur in 1185–1190 CE. It is located in the Kasbah district, the city's former citadel, near the site of its historic royal palaces. Along with the Kutubiyya Mosque, it is one of the most important historic mosques in Marrakesh.

History
Construction of the mosque was probably begun around 1185 and finished by 1190 (CE), at the apogee of the Almohad Empire. It was commissioned by the Almohad caliph Yaqub al-Mansur (ruled 1184–1199) as part of the newly created imperial kasbah (citadel) district which was to be the residence of the Almohad Caliph and the seat of government. This followed with a long tradition of rulers in the Islamic world (and beyond) who built palace-cities or separate royal districts. The Kasbah Mosque was built to be the congregational mosque for the caliph and for this royal district, where the ruler would go to attend prayers.

Even after al-Mansur and after the Almohad Empire had gone, the Kasbah Mosque was held in high esteem by the general population and subsequent rulers, and even competed with the Kutubiyya Mosque for prestige. As early as the Marinid era, rulers and important figures began to be buried in a cemetery just to the south of the mosque, eventually becoming the site of the Saadian dynasty's royal necropolis, known as the Saadian Tombs.

In the late 16th century the mosque was severely damaged by an enormous explosion at a nearby gunpowder store. The exact date of the event is not certain, with the earliest estimation being 1562 while the latest it could have happened was in 1573–1574. In any case, the Saadi sultan Moulay Abd Allah al-Ghalib (ruled 1557–1574) undertook extensive repairs and restorations in the wake of the explosion, with the southern part of the mosque having possibly been the most damaged. Scholars have traditionally supposed that the repairs and reconstruction of this period preserved the original Almohad design, although the stucco decoration visible inside the mosque today is most likely entirely Saadian and replaced whatever decoration would have existed earlier. A more recent study by Íñigo Almela Legorburu argues that the Saadian reconstruction likely enacted some significant changes to the mosque's internal configuration, resulting in its current layout. Even after these repairs, long cracks in the minaret remained visible up until the 20th century.

Later, the Alaouite sultan Sidi Muhammad Ibn Abd Allah (ruled 1757–1790) undertook another round of extensive restorations during the second half of the 18th century. The wooden cupola at the central entrance to the prayer hall from the courtyard dates from this time, as may other elements. Despite this, it still appears that these later sultans faithfully preserved the form of the original mosque, which may be an indication of the esteem in which it was held.

On August 16, 1907, days after the French bombardment of Casablanca and invasion of the Shawiya plains, a group led by gathered at the mosque to pledge allegiance to Abdelhafid as their sultan over his brother Abdelaziz in the Hafidiya.

Today, the mosque is still in use for prayer and non-Muslims are not permitted to enter inside (as with other mosques in Morocco).

Location and urban environment
The mosque is in the old Kasbah district of Marrakesh and is located not far from the El-Badi Palace and from the current Royal Palace still used by the Moroccan king today. It is flanked by Place Moulay el Yazid on its eastern side. On its south side are the Saadian Tombs, a narrow necropolis with ornate mausoleums that housed the tombs of the Saadi dynasty. The mosque is also close to the city walls and to Bab Agnaou, the historical main gate to the Kasbah.

Outer walls and façades
The exterior of the mosque is imposing, with high walls crowned along the top by merlons above a row of corbels. Along the walls are large pointed horseshoe arches, many of which are now walled-in, while some frame the gates of the mosque. Some of the arches on the southwestern side of the mosque accommodate space for shops.

The minaret
The minaret, like the more famous Kutubiyya minaret and other minarets in the Maghreb, has a square base (8.8 metre per side) and is divided vertically into two parts: a main body and a much smaller lantern (almost 4 metre per side) at the top. That said, the decoration of this minaret is different from that of the Koutoubia and would go on to become the prototype for many later minarets built in the Maghreb and al-Andalus.

The main part of the minaret has plain walls made of rubble stone up to the level of the mosque's roof, at which point the rest of the minaret is made of brick and the decoration begins. From here, on each of the almost identical four sides, three narrow horseshoe arches are topped by larger polylobed arches ("polylobed" meaning that it is made up of multiple smaller half-circles). In between these arches are thin engaged columns that were once all covered in coloured faience (ceramic), which remains on some of them. This set of elements then blends into the much larger decorative facades above them. These facades feature a wide interlacing sebka pattern (a common Maghrebi motif that roughly resembles palmettes or fleur-de-lys) sculpted in brick and filled-in with green faience. Although the decoration of the four sides of the minaret is almost the same, there are small differences between the north and south facades on the one hand and the east and west facades on the other, with details of the shapes of the sebka pattern and of the polylobed arches on the lower façade varying slightly. This type of alternation was repeated in other contemporary and later minarets (e.g. the Hassan Tower in Rabat or the Chrabliyine Mosque in Fes). Towards the top, a large frieze of green and white geometric mosaic tiles wraps around the minaret, before finishing in a crown of merlons. Between this mosaic tile frieze and the merlons there is currently an empty horizontal band which used to be filled by an Arabic inscription in cuerda seca tiles, with dark (maybe purple) lettering over a white background. The inscription was in a prominent kufic script and featured the first surah of the Qur'an, Al-Fatiha. This frieze did not survive but fragments of it have been found, while the rest of the tile mosaics on the minaret needed to be restored in recent times. The fragments which have been preserved (in a collection kept at the nearby Badi Palace) represent the earliest surviving example of cuerda seca tilework (a technique originating in al-Andalus) being used in an architectural context.

Above this main part of the minaret, the short lantern or secondary shaft on top makes use of similar decoration. It is surmounted by a finial (jamur) with three copper spheres. A once widely reported belief alleged that they were actually made of pure gold; a legend which originated with this mosque but which latter became associated with the Koutoubia minaret.

Courtyards
The mosque is roughly square in plan. The floor plan of the mosque is notable for being dominated by the size of its courtyard and for the division of the courtyard into five parts: a large central rectangular courtyard and four minor rectangular courtyards at its corners. The four smaller courtyards are placed in two symmetrical pairs around the main courtyard: two on the west side, two on the east, and separated from the main courtyard by an arcade of arches. The large roofless space formed by these five courtyards is surrounded by the indoor prayer hall on one side (to the south) and by a roofed gallery running along the other three sides. The space between each pair of auxiliary courtyards is taken up by a narrow roofed aisle as well – essentially projections of the surrounding gallery. The main courtyard features two fountains: one in the center and a larger one closer to the northern entrance. The two secondary courtyards that are closest to the prayer hall each feature their own central fountain as well. As in other mosques, these fountains serve for ablutions before prayer.

A recent study by Íñigo Almela Legorburu hypothesized that the mosque's current configuration with five courtyards is a result of the Saadian-era repairs in the 16th century. The author suggests that the original Almohad mosque would instead have had three separate rectangular courtyards in a configuration similar to that of the unfinished Almohad Great Mosque of Rabat (site of the Hassan Tower today). Under this hypothesis, of the four minor courtyards that stand today only the two southern ones would have existed in the original Almohad design, while only the northern part of the large central courtyard would have existed, thus corresponding to the positions of the three large courtyard fountains today. The courtyards would have been isolated from each other and the rest of the mosque would have been roofed over. The expansion of the central courtyard and the addition of the two minor courtyards to the north would have been a result of a Saadian preference for a large square courtyard in mosques and of a desire to achieve more symmetry in the final layout of the rebuilt mosque.

Prayer hall
The prayer hall itself is located on the south side of the courtyard, and is a hypostyle space with rows of arches running perpendicular into the southern wall of the mosque (the wall furthest from the courtyard) and forming three aisles that run parallel to the wall. The southern wall represents the qibla (the direction of prayer), and the aisle closest to it is marked off from the others by another row of arches running parallel to the qibla wall.

This floor plan is unusual compared to the classical layout of mosques in the western Islamic world (i.e. the Maghreb and al-Andalus) which usually consists of one large courtyard and a generally larger adjacent prayer hall (like at the influential Great Mosque of Cordoba and the prototypical Almohad Mosque of Tinmal, for example). Nonetheless, the mosque still shares many similarities to other Almohad or medieval mosques in the region, as its construction was more or less contemporary with the Koutoubia Mosque in Marrakech, the Hassan Tower in Rabat, and the Almohad Mosque of Seville (replaced by a cathedral but preserving elements like its minaret, the Giralda). For example, even though the proportions of the prayer hall are much reduced, the central aisle that leads from the courtyard to the mihrab in the qibla wall and the aisle that runs along the qibla wall are emphasized architecturally in their width and decoration, a standard feature of classic Moroccan and Andalusian mosques sometimes referred to as a "T-plan" or "T-type" (because the two aisles together form a "T" shape on the floor plan).

Decoration of the interior
Like most Almohad mosques, the mosque is relatively austere and much of its aesthetic effect inside is achieved by the rhythmic repetition of arches in the courtyard and prayer hall. The arches themselves vary slightly in shape and look. Most are horseshoe arches, with many of them embellished slightly by the carved outlines of pointed or polylobed arches around them. Some of the arches (around the mihrab, for example), are more elaborate polylobed and "lambrequin" (muqarnas-shaped) arches, all commonly found in Moorish architecture. Some of the pillars of the arches also feature small engaged columns with ornate capitals from the Almohad and Saadian periods. Additionally, in the outer aisles of the mosque (including the galleries around the courtyard) the wall-space around the arches is marked by bands and lines of stucco carved with geometric and arabesque patterns, very similar to those found in the Mouassine Mosque and Bab Doukkala Mosque from the Saadian period.

The mihrab area
The most decorated area is that around the mihrab (a niche in the qibla wall symbolizing the direction of prayer). This section, which was rebuilt/restored in the late 16th century (Saadian period), likely still preserves the model and layout from the Almohad era and resembles the mihrab of important Almohad mosques like the one at Tin Mal. However, the stucco decoration that covers the wall around the mihrab is very similar to the decoration of mihrabs of Saadian buildings like the Ben Youssef Madrasa and the Bab Doukkala Mosque, and thus likely dates from the Saadian restoration. This decoration features elaborate arabesques in high relief, with pinecones and seashells featured among the decorative repertoire. A prominent inscription in kufic Arabic features the basmala and a passage from the Qur'anic surah An-Nur. Below the level of the stucco decoration, twelve engaged columns of jasper and marble with carved capitals are incorporated into the mihrab area, including four into the sides of the mihrab opening. Six of the capitals, topping the columns furthest from the mihrab arch, are made of either stucco or stone and were carved in the Almohad period. The six capitals inside or closest to the mihrab are carved in white marble and are spolia from the Umayyad period of al-Andalus, most likely brought here during the Almohad construction. On either side of the mihrab are two doors giving access to small chambers, one of which was used to store the wooden minbar (a ceremonial pulpit).

Above and right in front of the mihrab is a large square cupola filled with a dome of finely-carved and painted muqarnas (stalactite or honeycomb-like geometric sculpture). Similar cupolas stand above either end of the qibla aisle (i.e. at the southwestern and southeastern corners of the building). Inside the mihrab niche itself is another small dome of muqarnas. The wooden ceilings elsewhere in the mosque are in an artesonado style typical of Moroccan and Moorish architecture. These cupolas and ceilings almost certainly all date from post-Almohad restorations.

The minbar
Much like the minbar at the Koutoubia Mosque, the minbar of the Kasbah Mosque originally emerged from behind the doors and moved forward on its own with the help of an unknown mechanism. This mechanism was gone, or no longer functional, by the end of the 16th century. The minbar itself, which has suffered over time but is still present today, is smaller but very similar in style to the famous Almoravid minbar of the Kutubiyya Mosque which was crafted earlier that century in Cordoba. It was quite likely made by Andalucian craftsman too, or by Moroccan craftsmen following in the same tradition, and was commissioned by Yaqub al-Mansur, who likely wished to emulate the earlier Almoravid minbar.

The minbar is smaller than its famous predecessor (measuring 2.87 meters high, 2.25 meters long, and 76 cm wide) but also displays remarkable artistic quality. The minbar is made of wood (including ebony and other expensive woods), is decorated via a mix of marquetry and inlaid carved decoration, just like its famous predecessor. The main decorative pattern along its major surfaces on either side is centered around eight-pointed stars, from which bands of decorated with ivory and bone inlay then interweave and repeat the same pattern across the rest of the surface. The spaces between these bands form other geometric shapes which are filled with wood panels of intricately carved arabesques.

Qibla orientation of the mosque
The mosque, like other Almohad and medieval mosques in the early western Islamic world, is not actually oriented towards the "true" qibla used today (i.e. the direction of the shortest distance to the Kaaba in Mecca). Its qibla is oriented towards the south with an azimuth (from the true north) of 159 degrees, whereas the true qibla, seen in modern mosques, is 91 degrees (towards the east). This is due to historical debates about the direction of the qibla in far western Islamic lands like Morocco and al-Andalus; as a result, the qibla orientation of Marrakesh's mosques varies depending on the historical period in which they were built.