The story of how it happened depends on who is telling it.

For Dino Casimiro, a local sports teacher, the tale began in 2002, when he and a group of friends set up a club in 2002 to help popularize water sports among locals, and publicize Nazaré’s waves among foreigners.

For Jorge Barroso, the former mayor, the turning point was in 2007, when he first gave Mr. Casimiro permission to hold a water sports competition off the most northerly — and the most deadly — of the town’s two beaches.

And for the town’s current mayor, Walter Chicharro, the story starts soon after his election in 2013, when he pumped more money into publicizing and professionalizing the town’s surfing scene.

But the watershed moment really came in 2010, when Mr. McNamara finally took up a five-year-old invitation from Mr. Casimiro to come to Nazaré, and try out the waves that break off the town’s north beach.

For all concerned, these were uncharted waters — literally and metaphorically. Not only had Mr. McNamara never visited Europe, but the villagers, many of whom knew someone who had died at sea, had never considered their tallest waves swimmable, let alone surfable.