Marrakech was founded in 1062 as one of the Imperial Cities of the Almoravide Sultan Youssef ben Tachfine, who commissioned the construction of the defensive walls encircling the city. The Almohades and Saadien dynasties extended the beautiful city walls to 19kms, decorating it with red and pink color variations. The prosperous empire made Marrakech its capital as it stretched from the Mediterranean to Senegal and Algiers to the Atlantic.
During the reign of Yousef ben Tachfine, Marrakech got its iconic city walls, elaborate mosques, exquisite gardens, and spectacular palaces. Due to the Almoravid conquest of the southern Spanish region of Andalusia, Marrakech retained some of the cosmopolitan feel of the Spanish city, and this is still evident everywhere you turn in the city.
The Almohads left a strong architectural heritage of carved domes and arches. Influences of West Africa and the Sahara resulted in this remote desert paradise having a distinctive architectural style. The city's most popular landmarks such as the Koutoubia and El Mansour Mosques were part of the legacy of the Almohad's conquests.
In the 12th century, the city's walls were built with red sandstone, which is why it is called Red City or Ochre City. Marrakech quickly became a prosperous center of culture, trade, and religion. While it suffered decline later, the reign of the wealthy Saadian sultans in the 16th century who built opulent palaces like the El Badi Palace brought back the good glory days.
The 1912 Treaty of Fes declared Morocco as a French Protectorate but granted notional sovereignty to the sultan. The country made rapid economic progress in the next 40 years with projects by the French in the areas of civil construction, education, power generation, and agriculture. Gualiz, the modern commercial and residential quarters built outside the city of Marrakech was completed in 1956, a few months before Morocco became an independent country once again.