In 1506, the king of Portugal, D. Manuel I, ordered a fortress to be built there, named Castelo Real de Mogador. Altogether, the Portuguese are documented to have seized six Moroccan towns and built six stand-alone fortresses on the Moroccan Atlantic coast, between the river Loukos in the north and the river of Sous in the south. Four of them only had a short duration: Graciosa (1489), São João da Mamora (1515), Castelo Real of Mogador (1506–10) and Aguz (1520–25). Two became permanent urban settlements: Santa Cruz do Cabo de Gué (modern Agadir, founded in 1505–06), and Mazagan, founded in 1514–17. Following the 1541 Fall of Agadir, the Portuguese had to abandon most of their settlements between 1541 and 1550, although they were able to keep Ceuta, Tangier and Mazagan. The fortress of Castelo Real of Mogador fell to the local resistance of the Regraga fraternity four years after its establishment, in 1510. The Portuguese-built Castelo Real of Mogador was defended under Abd el-Malek II by a garrison of 100 Moroccans. It was drawn by Adriaen Matham in 1641. During the 16th century, powers including Spain, England, the Netherlands and France tried in vain to conquer the locality. Essaouira remained a haven for the export of sugar, molasses and the anchoring of pirates.