|History of Morocco|
- under the Idrisid dynasty, from the beginning of the 9th century to 974;
- under the Marinid dynasty, from 1244 to 1465;
- during the 15th century Idrisid interlude, from 1465 to 1471;
- under the Wattasid dynasty, from 1471 to 1554;
- under the Saadian dynasty, from 1603 to 1627;
- during the 17th century Dila'ite interlude, from 1659 to 1663;
- under the Alaouite dynasty, from 1666 to 1672 and from 1727 to 1912.
Marrakesh is considered a symbol of Morocco and the power of the Almoravid and Almohad dynasties. It was founded in 1071 and became the capital for the two following centuries.
Marrakesh was the capital city for:
- the Almoravid dynasty, from 1071 to 1147;
- the Almohad dynasty, from 1147 to 1244;
- the Saadi dynasty, as princes of Tagmadert from 1511 to 1554 and as sultans of Morocco from 1554 to 1659;
- the Alaouite dynasty, in certain periods.
The capital under the Alaouite sultan Ismail Ibn Sharif (r.1672–1727), who built its walls and made it his capital. He rebuilt and expanded its old kasbah into a new monumental palace-city to the south of the old city.
In the 18th century, Rabat was designated as an Imperial city by the Alaouite sultan Muhammad ibn Abdallah, who built the Dar al-Makhzan palace, although he did not designate any city as his capital, moving continually between Rabat, Fez and Marrakech.
- "The Complete Guide to the Imperial Cities of Morocco". The Independent. 2002-01-05. Retrieved 2016-12-03.