The site of Essaouira has been inhabited since antiquity, serving as a Phoenician and later Roman trading post.
In the 16th century, the Portuguese built a fortress called Castelo Real de Mogador, but it was later abandoned.
The modern city of Essaouira was officially founded in the 18th century (1764–1765) by Sultan Mohammed ben Abdallah, who commissioned French architect Théodore Cornut to design it as a fortified port city.
It was strategically developed to open Morocco to European trade while limiting the influence of rival powers.