Marrakechalso spelled Marrakesh chief city of central Morocco. The first of Morocco’s four imperial cities, it lies in the centre of the fertile, irrigated Haouz Plain, south of the Tennsift River. The ancient section of the city, known as the medina, was designated a UNESCO World Heritage site in 1985.

Marrakech gave its name to the kingdom of which it was long the capital. It was founded in the mid-11th century by Yūsuf ibn Tāshufīn of the dynasty of the Almoravids, and it served as the Almoravid capital until it fell to the Almohads in 1147. In 1269 Marrakech passed to the control of the Marīnids, whose preferred capital was the northern city of Fès. Although Marrakech flourished while serving as the capital under the Saʿdīs in the 16th century, the succeeding ʿAlawite rulers resided more often at Fès or Meknès; however, the ʿAlawites continued to use Marrakech as a military post. In 1912 Marrakech was captured by the religious leader Aḥmad al-Ḥībah, who was defeated and driven out by French forces commanded by Colonel Col. Charles M.E. Mangin. Under the French protectorate (1912–56), Marrakech was for many years administered by the Glaoui family, the last of whom, Thami al-Glaoui, was the chief instigator of the deposition of Muḥammad V in 1953.

Surrounded by a vast palm grove, the medina in Marrakech is called the “red city” because of its buildings and ramparts of beaten clay, which were built during the residence of the Almohads. The heart of the medina is Jamaa el-Fna square, a vibrant marketplace. Nearby is the 12th-century Kutubiyyah (Koutoubia) Mosque with its 253-foot (77-metre) minaret, built by Spanish captives. The 16th-century Saʿdī Mausoleum, the 18th-century Dar el-Beïda Palace (now a hospital), and the 19th-century Bahia royal residence reflect the city’s historical growth. Much of the medina is still surrounded by 12th-century walls; among the surviving gates to the medina, the stone Bab Agnaou is particularly notable. The modern quarter, called Gueliz, to the west of the medina developed under the French protectorate.

Marrakech is famous for its parks, especially the Menara olive grove and the walled 1,000-acre (405-hectare) Agdal gardens. An irrigation system built under the Almoravids is still used to water the city’s gardens. Popular for tourism and winter sports, the city is a commercial centre for the High Atlas mountains and Saharan trade and has an international airport. It is connected by railway and road to Safī and Casablanca. Pop. (2004) 823,154.