Fierce disputes between the early Portuguese kings and the local overlords over the Port of Varzim and the town's lands lead to ravages and the establishment of the municipality in 1308.