Much farther north than the famous fjord inlets, Norway’s northernmost seaboard of Finnmark is a frontier on the edge. Five hundred kilometres inside the Arctic Circle, it is a raw wilderness of abrupt peninsulas and brooding cliffs at the nerve ends of the world, a place where nature has long had the upper hand. In winter, as if by decree of Odin, roads vanish under deep snows that cut off communities for days. And when polar darkness descends, from mid-November to late January, it is near absolute.

It is a raw wilderness at the nerve ends of the world

But as you drive along the deserted, snow-crusted road to Hammerfest, population 10,527, past barely-there fishing hamlets and cod trawlers at standstill, you soon learn that one of the world’s northernmost towns has had far worse problems to deal with than temperatures plummeting below zero.

For Hammerfest’s history is a luckless narrative of natural disasters, fires, plagues and war, spanning a timeline from Napoleon to the Nazis. And despite being one of the most storied settlements in northern Europe, the town’s acutely modern look might strike you as odd. Look around and it feels different to elsewhere this far north.

You may also be interested in:

• A strange life at the end of the world

• Where to drink the world’s purest water

• The code that travellers need to learn

Gone are the clapboard houses so characteristic of Norway. So too are the traditional storefronts from this former whaling town. Instead, facing the harbour is the LED-lit Arctic Culture Centre, a floating glass terminal on stilts. In the middle ground – between the flat Atlantic sky and backdrop of liquefied gas depots – are modern apartment blocks and a cruise terminal. And above that, on main street Kirkegata, is a rocket ship-shaped church, a postmodern homage to Finnmark’s triangular-shaped stockfish racks.

How does Hammerfest explain this extraordinary transformation? Ever since the 18th Century, after the first European (and soon after North American) traders arrived in the ancestral homeland of the indigenous Nordic Sea Sami, the town has been destroyed, ripped apart, razed to the ground and effectively wiped from the map time and again. It has been to hell and back, numerous times, and yet keeps coming back – a phoenix of the far north.

“You can trace our history back some 10,000 years, but in terms of bricks and mortar we’re an exceptionally young town,” said 75-year-old historian Jens Berg-Hansen, when we met on Kirkegata on a bleary November morning for a walk through Hammerfest’s history. “There’s a pioneering spirit here – and that’s the reason people come back. This is a town that engenders self-reliance. We have learnt to pull together.”

What originally brought Europeans here was the town’s ice-free harbour, a result of the warm Atlantic Gulf Stream which is uncommon in such northern waters. The combination saw the development of an international hunting effort that stretched to the Arctic Ocean via the Norwegian and Barents Seas, an era when seals, whales and walruses were butchered for meat, skins and oil. As riches returned from the ocean hunting grounds, the town became an open-air factory where blubber was scraped off the cetaceans’ skins to prevent it turning rancid.

“They used to say you could smell Hammerfest before you could see it,” said Berg-Hansen, describing the town’s boom years in the early to mid-18th Century, which saw the arrival of Russian, German, French, Dutch and American consulate offices. “It brought in trade, money and plenty of international visitors. They also said the ladies here were as beautiful as those in Paris because of how they dressed.” The sense of history is tangible: still today the streets are home to a disproportionate number of boutiques and hairdressers.

Such good times couldn’t last, however, a history documented at the appropriately named Gjenreisningsmuseet, the Museum of Reconstruction for Finnmark and North Troms (named after two neighbouring regions in Norway’s north).

The first blow came when the port – due to its ice-free harbour and strategic location en route to Russia, the Arctic and the UK – was overrun during the Napoleonic Wars. In July 1809, the British plundered and looted Hammerfest during a ­­week-long blockade, leaving the city to starve. Half a century later, a hurricane dismantled the town’s warehouses, before tragedy struck again in 1890 with two-thirds of the harbour’s buildings demolished by a catastrophic bakery fire. Almost unbelievably, considering Hammerfest’s unpredictable weather and inaccessibility, the reconstruction effort led to an extensive modernisation. For example, the next year the town became the first in northern Europe to introduce electric street lights.

Far worse was to come when the town was occupied following Germany’s invasion of Norway in 1940. Anticipating a huge Russian breakthrough at the Eastern Front four years later, Hitler’s scorched-earth retreat saw the town’s battalion of 1,000 Nazi soldiers leave nothing behind. It was October 1944, and with no shelter, food or supplies, the plan was for the Red Army to starve and freeze to death.

Within days, Hammerfest burned. Roads were wiped from the map, telegraph poles were chopped down and communication lines destroyed. The harbour lay ravaged, mines pockmarked the town and the entire population of the surrounding municipality were left homeless. So systematic was the Nazi solution, 10,000 buildings were razed to the ground and the only one left standing was the chapel. Almost unbelievably, the fires raged on for four months, and by the time the locals had fled, Hammerfest had ceased to exist.

It has been to hell and back, and yet keeps coming back – a phoenix of the far north

With such far-reaching consequences, families were evacuated to southern Norway, including that of 84-year-old Randi Simonsen, one of the town’s oldest surviving eye-witnesses, who I’d earlier agreed to meet at the museum.

“The Germans were so thorough they burned our basements,” said Simonsen, pointing to sepia photographs of the aftermath. “But people here were smart and hid their possessions, even if they knew they may one day never return.”

Mercifully, the images of reconstruction at the museum are far more powerful than those of Hammerfest’s destruction. One exhibit shows an American-made barbershop stool, hidden under 3ft of soil by its owner to prevent it from being destroyed. Another reveals two plush velvet armchairs, fully intact if a little worn, also dug up during the post-war effort.

As Simonsen recalled, her family were given two days to prepare to leave, not knowing when or even if they could ever return. Aged 11, she travelled with her family some 2,000km south to Telemark. “My father had the sea in his blood, so only days after peace broke out in May 1945 he was one of the first to return, eventually taking a boat from Tromsø after first travelling north. Nobody thought not to come back.”

Nobody thought not to come back

If the challenge of figuring out how to deal with disaster and recovery in the same breath weighed on Hammerfest, it doesn’t show today. The town may have been left to ruin, but within weeks of the repatriation, numerous buildings and houses had been rebuilt.

“We had no time to deal with trauma,” Simonsen said, adding that she slept on the chapel floor after her family’s return. “People were happy to be home and, anyway, I was a teenager so I was preoccupied with school, fashion and – of course – boys.”

Another eyewitness, 72-year-old retired schoolteacher Gunnar Milch, has another theory about how Hammerfest has learnt to adapt. It’s a happy story, in a way, of triumph over adversity, he told me.

“People sometimes have a romanticised view of the past, but it has always been tough in Hammerfest. For us it was a question of community. When people returned after World War II, they recreated their own community after having been separated from it for so long. The lesson is only we will decide our own fate.”

As history now shows, Hammerfest takes its place alongside Mostar in Bosnia, Hiroshima in Japan and Dresden in Germany as a town that has been destroyed yet has risen from the ashes with a deep and defiant response. Today, Hammerfest is prospering once more due to the arrival of liquefied gas companies in a boom expected to last decades. Of little surprise to the locals, it’s simply a continuation of how the town has reinvented itself for hundreds of years.

Perhaps what captures Hammerfest’s never-say-die spirit best is the town’s mascot and heraldic crest: the polar bear. It embodies the vitality of the community, but also the town’s uncanny ability to survive for centuries in a far-flung corner, on the top of the globe, despite the worst intentions of men.

They could not have hoped for a more enduring symbol.

Join more than three million BBC Travel fans by liking us on Facebook, or follow us on Twitter and Instagram.

If you liked this story, sign up for the weekly bbc.com features newsletter called "If You Only Read 6 Things This Week". A handpicked selection of stories from BBC Future, Earth, Culture, Capital and Travel, delivered to your inbox every Friday.