Marrakesh, is the fourth largest city in the Kingdom of Morocco.[2] It is one of the four Imperial cities of Morocco and is the capital of the Marrakesh-Safi region. The city is situated west of the foothills of the Atlas Mountains. Marrakesh is 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.
The region has been inhabited by Berber farmers since Neolithic times. The city was founded in 1070 by Emir Abu Bakr ibn Umar as the imperial capital of the Almoravid Empire. The Almoravids established the first major structures in the city and shaped its layout for centuries to come. The red walls of the city, built by Ali ibn Yusuf in 1122–1123, and various buildings constructed in red sandstone afterwards, have given the city the nickname of the "Red City" (المدينة الحمراء Almadinat alhamra') or "Ochre City" (ville ocre). 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, and in the early 16th century, Marrakesh again became the capital of the kingdom. The city regained its preeminence under wealthy Saadian sultans Abdallah al-Ghalib 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 its 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.
Marrakesh comprises an old fortified city packed with vendors and their stalls. This medina quarter is a UNESCO World Heritage Site. Today it is one of the busiest cities in Africa and serves as a major economic center and tourist destination. 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.