Meknes (French:Meknès; Arabic:مكناس; Berber: ⵎⴽⵏⴰⵙ, Mknas or Meknas; Spanish:Mequinez) is a city in northern Morocco and the sixth largest city of the kingdom. Meknès was the capital of Morocco under the reign of Moulay Ismail (1672–1727), before it was relocated to Marrakesh. The urban population is estimated at 650,000 with the metropolitan population close to 1,000,000. It is the capital of Meknès Prefecture. Meknes is named after a Berber tribe which, was known as Miknasa (native Berber name: Imeknasen) in the medieval North African documents.
A Berber tribe called the Miknasa (Imeknasen), originally from the Tunisian south, settled here in the 9th century.
The Almoravids founded a fortress in Meknes during the 11th century. It resisted the Almohads rise, and was thus destroyed by them, only to be rebuilt in a larger size with mosques and large fortifications. Under the Merinids it received further madrasas, kasbahs and mosques in the early 14th century, and continued to thrive under the Wattasid dynasty. Meknes saw its golden age as the imperial capital of Moulay Ismail following his accession to the Sultanate of Morocco (1672–1727). He installed under the old city a large prison to house Christian sailors captured on the sea, and also constructed numerous edifices, gardens, monumental gates, mosques (whence the city's nickname of "City of a Hundred Minarets") and the large line of wall, having a length of 40 kilometres (25 miles).