After the beginning of the Restoration War in the 17th century, which pitted Portugal against Spain, there was a change in the Portuguese military strategy, with greater attention being paid to land defence on the Spanish border.
Along the coast only batteries were installed, with functions more linked to surveillance than defence.
This approach resulted from the poor state of the Spanish fleet and the signing of a peace agreement with Holland, which had a sizeable fleet.
During the Restoration War the Algarve thus played a very peripheral role, and its defensive structures began to deteriorate.

After the Restoration War, the Algarve coast was frequently attacked by pirates and privateers, so the construction of a network of maritime defences was ordered to protect the city of Lagos, which at that time was the seat of the military government of the Algarve.
Designed by Captain Inácio Pereira, the Ponta da Bandeira Fort began to be built around 1680, by order of Luís Lopo da Silveira, 2nd Count of Sarzedas and Governor of the Kingdom of the Algarve.
It was completed in 1690, under the guidance of Francisco Luís Baltazar da Gama (1636–1707), 6th Count of Vidigueira and 2nd Marquis of Nisa.
The chapel appears to have also been built at that time, since the tiles inside it also date from the 17th century.

The fort was considered one of the most advanced in the Algarve region, reflecting several decades of development of Portuguese military architecture.
It has a very simple shape, being just a square with an elevated terrace facing the ocean that is reached by a ramp.
There are several gun emplacements.
It exemplified the change in military policies after the Restoration War, which reduced emphasis on large coastal fortresses, preferring instead more, but smaller, fortifications.
The strength of its construction has meant that it has remained relatively intact, while other fortifications in the Algarve have been greatly modified or destroyed over the years.
After the beginning of the Restoration War in the 17th century, which pitted Portugal against Spain, there was a change in the Portuguese military strategy, with greater attention being paid to land defence on the Spanish border. Along the coast only batteries were installed, with functions more linked to surveillance than defence. This approach resulted from the poor state of the Spanish fleet and the signing of a peace agreement with Holland, which had a sizeable fleet. During the Restoration War the Algarve thus played a very peripheral role, and its defensive structures began to deteriorate.
After the Restoration War, the Algarve coast was frequently attacked by pirates and privateers, so the construction of a network of maritime defences was ordered to protect the city of Lagos, which at that time was the seat of the military government of the Algarve. Designed by Captain Inácio Pereira, the Ponta da Bandeira Fort began to be built around 1680, by order of Luís Lopo da Silveira, 2nd Count of Sarzedas and Governor of the Kingdom of the Algarve. It was completed in 1690, under the guidance of Francisco Luís Baltazar da Gama (1636–1707), 6th Count of Vidigueira and 2nd Marquis of Nisa. The chapel appears to have also been built at that time, since the tiles inside it also date from the 17th century. 
The fort was considered one of the most advanced in the Algarve region, reflecting several decades of development of Portuguese military architecture. It has a very simple shape, being just a square with an elevated terrace facing the ocean that is reached by a ramp. There are several gun emplacements. It exemplified the change in military policies after the Restoration War, which reduced emphasis on large coastal fortresses, preferring instead more, but smaller, fortifications. The strength of its construction has meant that it has remained relatively intact, while other fortifications in the Algarve have been greatly modified or destroyed over the years.
Fort of Ponta da Bandeira