The Medina of Fez is a walled city with madrasas, fondouks, mosques and palaces dating from Marinid rule in the 13th–14th centuries. At that period, Fez replaced Marrakesh as the capital of the kingdom. The most important monuments in the medina are:- Bou Inania Madrasa (1351-1356)- Al-Attarine Madrasa (1323-1325)- University of Al-Karaouine (859)- Zaouia Moulay Idriss II (shrine)- Dar al-Magana, a clockhouse which holds a weight powered water clock (1357)