Imperial cities of Morocco
The Imperial Cities of Morocco are the four historical capital cities of Morocco: Fez, Marrakesh, Meknes and Rabat. Rabat is the current capital of Morocco. Fez 
Founded by Idris I between 789 and 808, the town of Fez was the capital city several times:
 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 

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. Meknes 
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. Rabat 
Founded by the Almohad caliph Yaqub al-Mansur with the aim to make it his capital, the project was abandoned after he died and Marrakech remained the capital 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. References 

Geographic history of Morocco
Morocco