Essaouira History

The area where Essaouira now stands has been determined by archaeologists to have been inhabited for thousands of years by native tribal people. The spot, because of its advantageous location on the Morraccan coast, has always been a desirable one, and from very early times the city served as an important port. The Portuguese claimed the city for themselves in the 16th Century, establishing a settlement there, but resistance from the local people to their presence caused the colony to fail. After the demise of the Portuguese settlement, several other European countries attempted to claim the city including Spain, England, France, and the Netherlands. None were successful for any notable period of time.
Essaouira as it stands today was built in the 18th Century by Mohamed III , the Sultan of Morocco, so that he would have a base from which to do business with the Western European countries. Prior to this time the city had been known as Mogador, named for Sigi Mogdoul, a Muslim saint who is buried there.

Google