Spend enough time in Churchill, and you will hear the stories.

Of hearing a noise outside, pulling open the drapes and seeing a polar bear looking in through the window.

Of walking around a corner at night, coming face-to-face with a bear and, implausibly, scaring it off with the strobe light on a cellphone.

Of encountering an old man with a walker, determinedly clacking past a puzzled bear that peered at him from behind a rock and muttering defiantly: “If it gets me, it gets me.”

Of being about to, against all better judgment, walk the couple of hundred yards from restaurant to hotel room at night, only to be pulled back by a warning that a pair of polar bears had been spotted across the street.

(OK, the last story is mine. The line between being a teller of tales and the subject of an obituary can be thinner than one might like.)

Such is everyday life, particularly during October and November, in this small town on the shores of Canada’s Hudson Bay. A little more than 1,000 miles north of the provincial capital of Winnipeg, Churchill is not just remote, it is defiantly so, accessible overland only by rail, its residents bonded by the conjoined challenges of living on the fringes of the Arctic and sharing their streets with the largest land carnivore in the world.

Aerial view of Churchill, Manitoba, Canada. Photograph: All Canada Photos/Alamy

“If you were to build a town today, you would never put it here,” explains Geoff York of Polar Bears International, a research and advocacy organization whose members, understandably, spend much time in Churchill each year. “Polar bears are creatures of the sea ice, and they come ashore in the summer here when the sea ice on Hudson Bay melts and then they wait for the ice to return.” That return tends to begin sometime in November; by October, the bears are already stirring, wandering in anticipation toward the bay along a route that takes them past, and sometimes directly through, Churchill.

From a cold war peak of about 5,000 people, when it hosted a military base, Churchill is now home to roughly 900 year-round inhabitants, slightly more than half of whom are Native. Theirs can be a harsh and at times tenuous existence, one that is leavened by the income from tourists who come to gaze at the northern lights in the winter, paddle among the hundreds of belugas that throng the river in summer and, in October and November, visit the polar bear capital of the world.

Polar bears have made Churchill famous, and led to it being dubbed the “jewel of Manitoba” and one of the top destinations in Canada. But as it emerges from the most testing two years in its modern history, Churchill may be about to embark on an entirely different path, as this frequently frigid community considers embracing a warmer future.

Tour groups view polar bears along the Hudson Bay on a cloudy autumn morning. Photograph: Paul Souders/Alamy

It is estimated that about 10,000 people descend upon Churchill annually during the five- or six-week “bear season”. The bulk of bear viewing takes place on the tundra outside of town, from the safety of bespoke vehicles approximately the size of school buses atop airport fire truck wheels, the immense size of which enables the trucks to traverse treacherous terrain and keep their occupants beyond the reach of even the largest and most curious bear.

The challenge for Churchill residents is to encourage the bears to head to the tundra without tarrying in town. In the past, the policy was less one of deterrence than immediate destruction. “When I was growing up, it was common for conservation officers to shoot 25 bears a season,” explains the mayor, Mike Spence, who is of Cree and Scottish descent. These days, the community, in conjunction with the Manitoba department of conservation, employs a different approach: the Polar Bear Alert Program.

Signs around the town remind residents and visitors alike to exercise caution and report bear sightings on the hotline – 675-BEAR. Culvert traps, baited with seal scent, line the perimeter of the community; bears that are caught in them are taken to a holding facility, popularly known as the polar bear jail, where they are held for up to 30 days (without food, to enhance the deterrence factor of the experience), before being drugged and helicoptered to a spot safely away from town – or, if late enough in the season, on to the sea ice.

If a bear does make it past the perimeter defense and into town conservation officers’ first plan is to help it on its way, motivating it to leave by firing cracker shells (loud, blank shotgun shells) and following it with vehicles. Only the recalcitrant and the repeat offenders are incarcerated.

A polar bear at a car window in Churchill, Canada. Photograph: Konrad Wothe/Alamy

For residents, living with polar bears is an unavoidable fact of life, and one that instils an understandable caution. As one former resident once said to me with a chuckle: “In Winnipeg, they say you can tell when someone is from Churchill because they always look carefully before walking around a corner.”

House and vehicle doors are always unlocked, should anyone need to fling one open and leap to shelter. As much as they can, residents simply avoid peak bear sites – anywhere along the coast or the riverbanks, in the willows on the edge of town, alleyways – especially at night, and particularly during peak bear season. For some, however, that isn’t always an option. Parker Fitzpatrick works for Manitoba Hydro, the provincial utility company, and if a line is down, he and his team have to repair it, no matter when and where. As a result, they exercise due caution.

“You try your hardest to not put yourself in that predicament,” he explains. “But if you have to go out in an area that’s a bad area or where bears have been spotted, and there’s a line down, I always get resources: set up security fences, for example, and carry shotguns with cracker shells. Ninety per cent of bears won’t bother you at all, but there are some who are hungry or are curious and want to bat you around like a baseball.”

Since the establishment of the Polar Bear Alert Program in 1983, serious attacks have been rare. There has been just one fatality, during the program’s first season: a homeless man, Tommy Mutanen, was rummaging through the freezer of a fire-damaged motel, stuffing meat into his pockets, when he rounded a corner and bumped into a bear. Nearby residents heard his screams, but although they rushed to his aid, they could not make the bear stop his attack, and by the time they shot it, Mutanen was dead.

There has, however, been one exceptionally close shave.

Erin Greene first arrived in Churchill from her native Montreal in 2012; she planned to spend a few months working at a local restaurant and then go back home, but she liked it so much she returned to stay the following summer.

“And then,” she said, “I got mauled by a polar bear.”

One of many polar bear alert warning signs posted inside the town of Churchill, Manitoba. Photograph: Paul J Richards/AFP/Getty Images

On Halloween night 2013, Greene and two friends were walking home in the early hours from a party when, she later recalled: “We all looked and there was a polar bear that was barreling down the street, just running towards us. Our first instinct was to run.”

Her friends escaped, but the bear caught Greene and grabbed her by the head and shoulders, tearing off part of her scalp as it tossed her around like a rag doll. As blood poured down her body, Erin was convinced she was going to die, and she might well have done, had it not been for a 69-year-old man with a shovel named Bill Ayotte.

Ayotte heard Greene’s screams and, clad only in a sweater and his pyjamas, ran toward the scene and brought his shovel down as hard as he could between the bear’s eyes.

The bear dropped Greene, who scrambled toward the safety of Ayotte’s house, and turned its attention to Ayotte instead, tearing off an ear and clamping down on a leg. Other residents arrived, firing cracker shells and, ultimately, driving at the bear with headlights flashing and horn blazing, sending it off.

Greene and Ayotte were airlifted to Winnipeg. Greene’s scalp was repaired; Ayotte’s ear was reattached. Both spent weeks recuperating in the hospital; both returned to Churchill.

Today, Greene teaches yoga in the community; during bear season, she works at a gift shop and, in the summer months, leads standup-paddleboard tours on to the river when the belugas are at their peak.

She could not, I suggest, have been blamed had she elected not to return to the scene of such an ordeal.

“I was trying to heal myself from the trauma I had experienced, and I believe that facing it head on is the way to do it,” she said. Besides, the community had helped pay her medical bills; she could hardly abandon them. “Knowing that this community produced someone who would risk their life to save another person’s, I definitely wanted to be somewhere where humans turned out like that.”

The sense of community, of a populace that bonds together and looks out for each other, is a common theme among residents. It was both tested and strengthened over the last two years, when the very viability of Churchill was threatened as never before.

It all began with the largest blizzard anyone could recall.

A member of the RCMP watches for polar bears at the Cape Merry national historic site in Churchill. Photograph: Chris Wattie/Reuters

The blizzard began on 7 March 2017 and lasted for 57 hours. As the snow fell, it was driven by 120 km/h winds into massive drifts. By the time it was over, drifts in some places were 25 to 30 feet high; “huge stretches” of roads were buried under eight to nine feet of snow.

“We had to tunnel out of our house, tunnel up and out,” recalls Sandra Cook, a local artist. “My son Max was 13 at the time, so we figured he was the strongest and the thinnest. So, we dug this tunnel up and sent Max up there. He had to lay down on the top of the snow pile, because he couldn’t stand up [because of the wind], and shovel until [Sandra’s husband] Kevin could get out. Then Kevin and Max went out and started shoveling out others. People were looking out across the street, looking out for neighbors. The whole community came together. Our streets were like tunnels. It was an extraordinary amount of snow.”

The response to the blizzard, said Cook, “brought out the best in people”. But the community would face a bigger challenge two months later, one that stretched it to the limit.

The snow melted.

A polar bear walks on the frozen tundra next to Hudson Bay. Photograph: Paul J Richards/AFP/Getty Images

The melt caused massive flooding which, among other things, damaged the final 249km stretch of the railway track connecting Churchill to Winnipeg and thus the world. An engineering study found 20 washouts and damage in 130 places. The estimated repair bill was $43.5m. OmniTrax, the Colorado-based company that owned the track and which was already looking for a way to offload it, said it couldn’t afford to foot the repairs and wouldn’t. The federal government took the company to court. And Churchill found itself effectively isolated.

A week without the train became a month. A month became two, then three, then six, then 18.

With no road connection to the outside world, the only way out for residents was a $1,200 round-trip air ticket that few could afford. Everything that the town needed – every nail and screw, every can of beer, every pallet of produce – had to be flown in at exorbitant cost. Residents found themselves with far less cash on hand. Business at some stores in town dropped 90%.

The hit to the community was not just financial. “There are kids in this town who haven’t seen their grandparents for a year and nine months,” said Dave Daley, a Métis community leader and owner of a dog mushing company that caters to tourists. “A lot of families constantly go back and forth; there’s been none of that.” The school hockey team had to content itself with practice, because there was no way for them to travel and compete. For some, the uncertain future was too tenuous to risk staying.

“I think there were 40 less kids in the school last year,” said Daley. “There were some people struggling with addiction, some families breaking apart,” said Cook. “We had a spurt of crime, which is normally very low here.”

Railroad tracks near Churchill. Photograph: Ian Willms/The New York Times/eyevine

The impasse was finally broken when a consortium of industry and First Nations communities banded together as the Arctic Gateway Group to buy the rail track and the port in late August. Repairs to the rail line began almost immediately, and on 31 October last year, the still of the Churchill night was pierced, for the first time in 18 months, by the whistle of an approaching train.

“People were just stunned,” recalls Cook. “I was handing out Halloween candy and I suddenly thought, ‘What am I hearing?’ The smiles plastered on people’s faces were unbelievable.”

The following day, the prime minister, Justin Trudeau, flew into town to formally announce the restoration of the railway and increased funding to improve the line and repair and redevelop the port. A street party celebrated the start of a new chapter. On the deck of the Seaport Hotel, owned by Spence, a sign declared: “The hostages are free.”

But with new beginnings come new challenges, and as it emerges from its darkest hour, Churchill finds itself at a crossroads.

“I think there’s a bright future for us,” asserts Daley. “But we have to be careful: we don’t want Churchill to lose its identity. I don’t want a road here. The minute we get a road here, we lose our identity and who we are.”

A mother polar bear and her cub sleep near the ice outside Churchill. Photograph: Jonathan Hayward/AP

Even without a road, that identity may ultimately face a reckoning. The challenge isn’t posed by a renovated railway, but by the prospect of a refurbished and revitalized port, the decrepit husk of which looms over the town. In the past, the port regularly exported grain and provided diesel fuel to remote Nunavut communities, but the new owners have a much grander vision: of links to Europe and India and the possible export of oil and gas.

“A few years ago, OmniTrax raised the prospect of shipping oil through the community, and unequivocally the community was resolutely against doing so for a number of reasons, the biggest one being that the shipping industry at the time was ill-equipped to deal with the prospect of accidents or disasters,” said John Gunter of Frontiers North Adventures, one of the premier ecotourism companies in town. “So, it looks like we’ll have to deal with that prospect again in the future.”

Of course, for a port in an Arctic environment to become truly viable, it will require shipping lanes that aren’t clogged with ice much of the year; and so Churchill may ultimately find itself as both the most famous home of the ultimate icon of climate change and a community that, in the words of Spence, “will have to take advantage” of that warming climate.

“The Northwest Passage offers a 7,000km shortcut from New Jersey to Shanghai,” Murad al-Katib, CEO of Arctic Gateway, said at the railway reopening ceremony. “Churchill is the only commercial deep-water port in northern Canada, and climate change has extended the shipping season.” It is a view cautiously echoed by many in town, even as they express anxiety about not losing what makes Churchill unique.

“I’m not against oil, because I think it can be done safely,” said Daley. “With global warming and the strait open more often, I think there’s a market for it. But this is the jewel of Manitoba – it’s the jewel of Canada – and we have to protect it. The port will in time become viable, but our economic future is tourism.”

For a community that in the last two years has been buried by snow and cut off from the world, and that even in the best of times must beware of polar bears around the corner, it is just the latest challenge among many. But at least, for now, with the sound of the train whistle regularly reminding the community of its re-connection with the outside world, there is hope.

“We find a way; it’s what we do,” saids Cook. “We hang in there, and we’re going to find a way.”