Meknes is a city of north-central Morocco in the foothills of the Middle Atlas, sixty kilometres west of Fez. Its Berber name Ameknas derives from the Miknasa, a Zenati Berber tribe of the early medieval period that gave the site its first urban centre under the late Idrisids.
The defining moment of the city's history is its elevation to imperial capital under Moulay Ismail (r. 1672–1727), the second Alaouite sultan, who built a vast complex of palaces, granaries, royal stables, and military quarters within twenty-five kilometres of crenellated walls and seven monumental gates. The Bab Mansour, completed in 1732, is the largest gate in the Maghreb and one of the principal monuments of Moroccan Islamic architecture.
Moulay Ismail's reign saw the consolidation of Alaouite control over Morocco, the recovery of Tangier from England in 1684 and Larache from Spain in 1689, and the constitution of the Black Guard (Abid al-Bukhari) as a permanent slave-soldier corps. Meknes lost capital status after his death; under colonial and modern administration it has functioned as a regional centre for the Saïs plain.
The historic city was inscribed by UNESCO as a World Heritage Site in 1996. Tamazight (Central Tamazight) survives in the surrounding Beni Mguild, Beni Mtir, and Aït Yusi communes of the Middle Atlas and in increasingly bilingual urban populations, although Arabic dominates daily speech in the medina.