Marrakesh (ʃ/ or ʃ/;Arabic: مراكش Murrākuš; Berber languages: ⴰⵎⵓⵔⴰⴽⵓⵛMeṛṛakec, French: Marrakech)  is a major city of the Kingdom of Morocco. It is the fourth largest city in the country, after Casablanca, Fez and Tangier. It is the capital city of the mid-southwestern region of Marrakesh-Safi. Located to the north of the foothills of the snow-capped Atlas Mountains, Marrakesh is situated 580 km (360 mi) southwest of Tangier, 327 km (203 mi) southwest of the Moroccan capital of Rabat, 239 km (149 mi) south of Casablanca, and 246 km (153 mi) northeast of Agadir.
Marrakesh is possibly the most important of Morocco's four formerimperial cities. The region has been inhabited by Berber farmers since Neolithic times, but the actual city was founded in 1062, by Abu Bakr ibn Umar, chieftain and cousin of Almoravid king Yusuf ibn Tashfin. 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 center for the Maghreb and sub-Saharan Africa; Jemaa el-Fnaa is the busiest square in Africa.
After a period of decline, the city was surpassed by Fez, but in the early 16th century, Marrakesh again became the capital of the kingdom. The city regained its preeminence under wealthy Saadian sultans Abu Abdallah al-Qaim and Ahmad al-Mansur, who embellished the city with sumptuous palaces such as the El Badi Palace (1578) and restored many ruined monuments. Beginning in the 17th century, the city became popular among Sufi pilgrims for Morocco's seven patron saints, who are entombed here. In 1912 the French Protectorate in Morocco was established and T'hami El Glaoui became Pasha of Marrakesh and held this position nearly throughout the protectorate until the role was dissolved upon the independence of Morocco and the reestablishment of the monarchy in 1956. In 2009, Marrakesh mayor Fatima Zahra Mansouri became the second woman to be elected mayor in Morocco.
Like many Moroccan cities, Marrakesh comprises an old fortified city packed with vendors and their stalls (the medina, a UNESCO World Heritage Site), bordered by modern neighbourhoods, the most prominent of which is Gueliz. Today it is one of the busiest cities in Africa and serves as a major economic center and tourist destination. Tourism is strongly advocated by the reigning Moroccan monarch, Mohammed VI, with the goal of doubling the number of tourists visiting Morocco to 20 million by 2020. Despite the economic recession, real estate and hotel development in Marrakesh have grown dramatically in the 21st century. Marrakesh is particularly popular with the French, and numerous French celebrities own property in the city. Marrakesh has the largest traditional market (souk) in Morocco, with some 18 souks selling wares ranging from traditional Berber carpets to modern consumer electronics. Crafts employ a significant percentage of the population, who primarily sell their products to tourists. Marrakesh is one of North Africa’s largest centers of wildlife trade, despite the illegality of much of this trade. Much of this trade can be found in the medina and adjacent squares. Tortoises are particularly popular for sale as pets, but Barbary macaques and snakes can also be seen.
The exact meaning of the name is debated. One possible origin of the name Marrakesh is from the Berber (Amazigh) words amur (n) akush (ⴰⵎⵓⵔ ⵏ ⴰⴽⵓⵛ), which means "Land of God". According to historian Susan Searight, however, the town's name was first documented in an 11th-century manuscript in the Qarawiyyin library in Fez, where its meaning was given as "country of the sons of Kush". The word mur is used now in Berber mostly in the feminine form tamurt. The same word "mur" appears in Mauretania, the North African kingdom from antiquity, although the link remains controversial as this name possibly originates from μαύρος mavros, the ancient Greek word for black. The common English spelling is "Marrakesh", although "Marrakech" (the French spelling) is also widely used. The name is spelt Mṛṛakc in the Berber Latin alphabet, Marraquexe in Portuguese, Marraquech in Spanish, and "Mer-raksh" in Moroccan Arabic.
From medieval times until around the beginning of the 20th century, the entire country of Morocco was known as the "Kingdom of Marrakesh", as the kingdom's historic capital city was often Marrakesh. The name for Morocco is still "Marrakesh" to this day in Persian and Urdu (مراكش) as well as many other South Asian languages. Various European names for Morocco (Marruecos, Marrocos, Maroc, Marokko, etc.) are directly derived from the Berber word Murakush. Conversely, the city itself was in earlier times simply called Marocco City (or similar) by travelers from abroad. The name of the city and the country diverged after the Treaty of Fez divided Morocco into a French protectorate in Morocco and Spanish protectorate in Morocco, but the old interchangeable usage lasted widely until about the interregnum of Mohammed Ben Aarafa (1953–1955). The latter episode set in motion the country's return to independence, when Morocco officially became al-Mamlaka al-Maġribiyya (المملكة المغربية) ("The Maghreb Kingdom"), its name no longer referring to the city of Marrakesh. Marrakesh is known by a variety of nicknames, including the "Red City", the "Ochre City" and "the Daughter of the Desert", and has been the focus of poetic analogies such as one comparing the city to "a drum that beats an African identity into the complex soul of Morocco."