Moulay Ismail (1645–1727) ruled Morocco for fifty-five years, the longest reign in the country's history. The 'Warrior King' forged the modern Alaouite state from his new capital at Meknes: a standing army loyal to the throne alone, European enclaves swept from the coast, and a prestige that made Louis XIV treat him as a fellow sovereign.
The seventh son of Sharif ibn Ali, Ismail was governor of Fez when his half-brother Moulay Rashid died in 1672; after years of war with a rival nephew, he stood alone. He chose Meknes — neither Fez nor Marrakech — and built it into an imperial city of walls, palaces, and granaries on a scale Versailles would have recognized. His instrument was the Black Guard, the Abid al-Bukhari: tens of thousands of soldiers, drilled from childhood and sworn on the Sahih of al-Bukhari, owing loyalty to no tribe and to no one but the sultan.