Little history is recorded on Agadir before the 12th century.

In the 2nd century AD, the historian Polybius referred to North Africa on the Atlantic, a place called cap Rhysaddir, that may have been located near Agadir but its location is still under debate.

The oldest cartographic mention of Agadir is on a map from 1325: at the approximate location of the modern city there was an indication of a place called Porto Mesegina, after the name of a Berber tribe already mentioned in the 12th century, the Mesguina, that is to say the Ksima.

At the end of the medieval period, Agadir was a town of some notoriety.
The name itself, Agadir al-harba, was attested to for the first time in 1510.

In 1505, the Portuguese, who were already installed on the Moroccan coast, founded a trading post and a fort at the foot of the hill to the sea, Santa Cruz do Cabo de Aguer on the site of the now-vanished neighborhood of Founti (named after the Portuguese word fonte meaning fountain) under a governor.

Quickly, the Portuguese were exposed to the hostility of the tribes of the region.
From 1530, they were blockaded in Santa Cruz.
Portuguese weakness showed itself on 12 March 1541 when Sherif Saâdien Mohammed ash-Sheikh captured the fortress of Santa Cruz de Aguer.
Six hundred Portuguese survivors were taken prisoner, including the governor, Guterre de Monroy, and his daughter, Dona Mecia.
The captives were redeemed by the holy men mostly from Portugal.
Dona Mecia, whose husband was killed during the battle, became the wife of Sheikh Mohammed ash-Sheikh but died in childbirth in 1544.
In the same year, Mohammed ash-Sheikh released the Governor Guterre de Monroy, whom he had befriended.

The Portuguese possessions in Morocco, acquired between 1505 and 1520, were regressing.
After the loss of Agadir, the Portuguese were obliged to abandon Safi and Azemmour.
Morocco was beginning to be less important for Portugal which now turned to India and Brazil.
After 1550, the Portuguese no longer held anything in Morocco other than Mazagan  (now El Jadida), Tangier and Ceuta.

The story of the Portuguese presence (from the installation in 1505 until the fall on 12 March 1541) is described in  manuscript (published for the first time, with French translation, by Pierre de Cenival in 1934) entitled "Este He O Origem e Comeco e Cabo da Villa de Santa Cruz do Cabo de Gue D'Agoa de Narba", written by anonymous who was captured in 12-III-34 and was five years imprisioned in Taroudannt (cf. "
Santa Cruz do Cabo de Gue d'Agoa de Narba – Estudo e Crónica", Joao Marinho e Santos, José Manuel Azevedo e Silva e Mohammed Nadir, bilingual edition, Viseu 2007).

In 1572, the Casbah was built on top of the hill by Moulay Abdallah al-Ghalib, successor to Mohammed ash-Sheikh.
It was now called Agadir N'Ighir, literally: fortified granary of the hill in Tachelhit.

In the 17th century, during the reign of the Berber dynasty of Tazerwalt, Agadir was a harbour of some importance, expanding its trade with Europe.
There was, however, no real port nor a wharf.
Agadir traded mainly in sugar, wax, copper, hides and skins.
Europeans brought their manufactured goods, particularly weapons and textiles.
Under the reign of Sultan Moulay Ismail (1645–1727) and his successors, the trade with France, until then an active partner regressed to the English and the Dutch.

In 1731, the town was completely destroyed by an earthquake.
The harbour of Agadir was then ordered to be closed when Essaouira was established farther north.

In 1746, the Dutch set up a trading post at the foot of the Casbah under the authority of the Sultan, and undoubtedly participated in the restoration of the city.
Above the door of the Casbah, the Dutch inscription can still be seen with its transcription in Arabic: "Vreest God ende eert den Kooning", which means "Fear God and honour the King", and the date 1746.

After a long period of prosperity during the reigns of the Saadian and Alawite dynasties, Agadir declined from 1760 because of the pre-eminence given to the competing port of Essaouira by the Alawite Sultan Mohammed be
Little history is recorded on Agadir before the 12th century.
In the 2nd century AD, the historian Polybius referred to North Africa on the Atlantic, a place called cap Rhysaddir, that may have been located near Agadir but its location is still under debate.
The oldest cartographic mention of Agadir is on a map from 1325: at the approximate location of the modern city there was an indication of a place called Porto Mesegina, after the name of a Berber tribe already mentioned in the 12th century, the Mesguina, that is to say the Ksima.
At the end of the medieval period, Agadir was a town of some notoriety. The name itself, Agadir al-harba, was attested to for the first time in 1510.
In 1505, the Portuguese, who were already installed on the Moroccan coast, founded a trading post and a fort at the foot of the hill to the sea, Santa Cruz do Cabo de Aguer on the site of the now-vanished neighborhood of Founti (named after the Portuguese word fonte meaning fountain) under a governor.
Quickly, the Portuguese were exposed to the hostility of the tribes of the region. From 1530, they were blockaded in Santa Cruz. Portuguese weakness showed itself on 12 March 1541 when Sherif Saâdien Mohammed ash-Sheikh captured the fortress of Santa Cruz de Aguer. Six hundred Portuguese survivors were taken prisoner, including the governor, Guterre de Monroy, and his daughter, Dona Mecia. The captives were redeemed by the holy men mostly from Portugal. Dona Mecia, whose husband was killed during the battle, became the wife of Sheikh Mohammed ash-Sheikh but died in childbirth in 1544. In the same year, Mohammed ash-Sheikh released the Governor Guterre de Monroy, whom he had befriended.
The Portuguese possessions in Morocco, acquired between 1505 and 1520, were regressing. After the loss of Agadir, the Portuguese were obliged to abandon Safi and Azemmour. Morocco was beginning to be less important for Portugal which now turned to India and Brazil. After 1550, the Portuguese no longer held anything in Morocco other than Mazagan  (now El Jadida), Tangier and Ceuta.
The story of the Portuguese presence (from the installation in 1505 until the fall on 12 March 1541) is described in  manuscript (published for the first time, with French translation, by Pierre de Cenival in 1934) entitled "Este He O Origem e Comeco e Cabo da Villa de Santa Cruz do Cabo de Gue D'Agoa de Narba", written by anonymous who was captured in 12-III-34 and was five years imprisioned in Taroudannt (cf. "Santa Cruz do Cabo de Gue d'Agoa de Narba – Estudo e Crónica", Joao Marinho e Santos, José Manuel Azevedo e Silva e Mohammed Nadir, bilingual edition, Viseu 2007).
In 1572, the Casbah was built on top of the hill by Moulay Abdallah al-Ghalib, successor to Mohammed ash-Sheikh. It was now called Agadir N'Ighir, literally: fortified granary of the hill in Tachelhit.
In the 17th century, during the reign of the Berber dynasty of Tazerwalt, Agadir was a harbour of some importance, expanding its trade with Europe. There was, however, no real port nor a wharf. Agadir traded mainly in sugar, wax, copper, hides and skins. Europeans brought their manufactured goods, particularly weapons and textiles. Under the reign of Sultan Moulay Ismail (1645–1727) and his successors, the trade with France, until then an active partner regressed to the English and the Dutch.
In 1731, the town was completely destroyed by an earthquake. The harbour of Agadir was then ordered to be closed when Essaouira was established farther north.
In 1746, the Dutch set up a trading post at the foot of the Casbah under the authority of the Sultan, and undoubtedly participated in the restoration of the city. Above the door of the Casbah, the Dutch inscription can still be seen with its transcription in Arabic: "Vreest God ende eert den Kooning", which means "Fear God and honour the King", and the date 1746.
After a long period of prosperity during the reigns of the Saadian and Alawite dynasties, Agadir declined from 1760 because of the pre-eminence given to the competing port of Essaouira by the Alawite Sultan Mohammed be
Agadir