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.