The legendary Moroccan city of Fes (also spelled Fez) is the most complete medieval city in the Arab world. Founded in the 9th century and home to one of the oldest universities in the world, Fes reached its height in the 13th and 14th centuries, when it replaced Marrakesh as the capital of the kingdom. Although the political capital of Morocco was transferred to Rabat in 1912, Fes has retained its status as the country's cultural and spiritual center. Its principal mosque is the holiest in the country and governs the timing of Ramadan and other Islamic festivals. The major monuments in Fes' old Medina (Fes el Bali) - its madrasas, fondouks, palaces, residences, mosques and fountains - all date from the medieval period. Fes al Bali is still home to over a quarter of Fes' 800,000 inhabitants and "owes little to the West besides its electricity and the tourists" (Rough Guide Morocco).
Founded in 857 by a wealthy woman from Tunisia, the Kairaouine is the second-largest mosque in Morocco and the country's spiritual center. Its minaret, dating from 956, is Morocco's oldest.