Marrakesh is the capital the Almohad Caliphate.
In the 12th century, the Almoravids built many madrasas (Koranic schools) and mosques in Marrakesh that bear Andalusian influences. The red walls of the city, built by Ali ibn Yusuf in 1122–1123, and various buildings constructed in red sandstone during this period, have given the city the nickname of the "Red City" or "Ochre City". Marrakesh grew rapidly and established itself as a cultural, religious, and trading centre for the Maghreb and sub-Saharan Africa; Jemaa el-Fnaa is the busiest square in domains of Maghreb and Ifriqiya.
Wealth in the city is manifested in palaces and many other mansions and lavish houses. Also in important public works such as Bab Agnaou the main gate of Marrakesh, the Kasbah the fortress of the city, the Menara and Agdal Gardens. Also there are numerous public baths (hamman) throughout the city.
The three main places of worship are the Koutoubia Mosque, Ben Youssef Mosque (includes madrasa with a large library) and Mouassine Mosque (includes a library, hamman, madrasa and the Mouassine Fountain).
The Palace (al-Qaṣ), also known as Dar el-Makhzen, is the seat of government and residence of the Caliph. The Caliphate complexes include the Kasbah, the citadel fortress next to the Bab Agnaou.
Outside the city walls several madrasas have been erected thanks to Almohad patronage. They are considered the key centers of Almohad orthodoxy (Unitarianism, Zahirite jurisprudence and Ashʿari theology) for the training of qadis (judges), preachers and missionaries (talba and huffaz). Also radical Maliki qadis and teachers, under private patronage, have their madrasas.