This interesting example of 17th century military architecture, was built to withstand possible Spanish attacks during the Restoration wars (1640-1668).
Praia Norte - Praia da Cidade
Viana do Castelo
It was part of a defensive line strategically placed on the banks of the River Minho and along the Atlantic Coast, achieved through the remodeling of old fortifications, such as the Castles of Valença, Vila Nova de Cerveira and Santiago da Barra (V. do Castelo), or the construction of new forts, such as Lobelhe (VNCerveira), Ínsua (Caminha) and Paço (Carreço), among others. Some of these fortresses played an important role, not only in the War of the Restoration, but also during the Napoleonic invasions, and their strategic military function was sometimes reactivated in the liberal struggles of the 19th century.
http://www.cm-viana-castelo.pt/pt/percursos-culturais