The imperial city of Marrakech was founded in 1062 by Sultan Youssef ben Tachfine who is credited with construction of the defensive walls that encircle the city. Extended to 19 kms during the dynasties of the Almohades and Saadiens, the spectacular city walls, varying in colour between pink and red, are punctuated by 200 square towers (borjs) and nine monumental gates. The prosperity of Marrakech at this time made it a fitting capital for an empire which stretched from Algiers to the Atlantic and from the Mediterranean almost to Senegal.
Following 400 years of berber dynasties emanating from the indigenous tribes of the Atlas mountains (the Almoravides, Almohades and Merinides, who ruled until 1465), the 16 th century saw the arrival of rulers of Arabic origin. The wealthy Saadiens (1554-1603) were responsible for unifying Morocco as one country. In 1659 the Alouites came to the throne (occupied from 1672-1727 by Moulay Ismail, the most famous of all the sultans) and still rule Morocco today.
One of the most notable sites in Marrakech from this period of Moroccan history is found in the Kasbah. Set in a small garden, the16th century dynastic tombs of the Saadiens are among the finest examples of Islamic art, not least for the intricate stucco decoration and cedar ceilings of the mausoleum.
In 1912 the Treaty of Fes recognised Morocco as a French Protectorate under the notional sovereignty of the sultan. During the next 40 years the country made significant economic progress thanks to development by the French of rail and road infrastructure and the introduction of hydro-electrical installations, irrigation systems and national education. The modern commercial and residential quarter of Guéliz, outside the Marrakech medina, was completed shortly before Morocco became a fully independent country once more in 1956.