The Castle of Castro Marim is a medieval castle on a hilltop overlooking the civil parish of Castro Marim, in the municipality of the same name, in the Portuguese Algarve. The castle was part of the defensive line controlled by the Knights Templar, a stronghold used during the Portuguese Reconquista, and adapted during the Restoration War to defend the frontier.The castle is located in a unique landscape due to the proximity of salt and mouth of the Guadiana River. Within the castle fortification are two epigraphic inscriptions: one, the first to record a settlement established by a Portuguese monarch, while the second carving identifies the alterations occurring under the reign of King Denis.HistoryIn the vicinity of the fortress there must have existed a castro, dating to the Neolithic period, and successively occupied by Phoenicians, Greeks (854 BC) and Carthaginians (at the end of the 4th century BC). This settlement was finally destroyed in a major cataclysm, before the arrival of the Romans. Following their arrival, the fortification was reconstructed and began occupying an important regional position economically and politically, extending into the Moorish occupation.