Around 1000BC, the area around Marrakech served as a temporary campsite to nomads who made their living crossing the Sahara and trading with African tribes to the south. A permanent city was not founded until 1062, when Ben Youssef of the Almoravid dynasty claimed the site for his soldiers and erected the Koutobia mosque. Marrakech became an important cultural, economic and military base. It was the destination of many traders from Timbuktu who carried sub-Saharan gold, salt and slaves for European merchants. The sultan Ben Youssef used it as a starting point from which he sent out armies against Spain. During his reign, Andalusian influences drifted south across the Strait of Gibraltar, and Muslim artisans began incorporating Spanish styles into the city’s buildings.

Marrakech served as the capital of the Almoravidian Empire until its fall in 1258, when the city was abandoned and the nearby town of Fez became the capital of the new Marinid Empire. However, in 1554, the city was re-granted its capital status with the establishment of the Saadian dynasty, which lasted until 1917. At this point in history Morooco officially became a protectorate of France, though it was in effect a colony, and they ruled it until 1956, when the country regained its sovereignty. Today, Marrakech is no longer the Moroccan capital, but still serves as a major tourist attraction and cultural center.