HYDER, Alaska — If libertarians had an earthly paradise, it would probably be in Hyder, Alaska.

Separated from U.S. governments and bureaucracies by immense wilderness, Hyder has no property taxes or police, and citizens can carry firearms openly. Yet the village, right on the Canadian border, has long relied on neighbouring Stewart, B.C., for groceries, electricity and other services.

So July 4 might be called Interdependence Day here. That’s when Canadians cross an unguarded U.S. border into Hyder and continue the Canada Day party that begins on July 1 — and that the Yankees heartily join.

In Hyder, the celebration includes a pet parade (“people dress ’em up and walk ’em down the street”) and an ugly vehicle contest (“they have to run, and that’s about it”). There is also a competition known as the Bush Woman Classic, in which women — and a few men in drag — must chop wood, flip a pancake, catch a fish (in a bucket), shoot a water gun at a man in a bear costume and then apply lipstick on the way to the finish line.

The spirit of international co-operation between Hyder and Stewart goes back to the early 1900s, when the communities were founded as mining towns on the shores of a fjord abundant with salmon, seals and halibut.

While they may be in separate countries, daily life has bound them ever closer through marriages, blizzards and bears that fail to respect international boundaries. U.S. President Barack Obama even alluded to the bond when Prime Minister Justin Trudeau visited the White House in March.

“It’s basically the same town. We’re just a little more free over here,” said Joel Graesser, a steel sculptor who fled New York City a decade ago for Hyder, where wolves occasionally venture into his outdoor studio.

The easternmost town in Alaska, Hyder sits below snowcapped peaks and glaciers that glint cerulean blue in the sun. To reach the rest of the state, the 87 or so people recorded in the past census have to wait for the U.S. mail plane that flies from Ketchikan twice a week, weather permitting.

The only road into Hyder winds under a hand-painted sign that reads, “The friendliest Ghost Town in Alaska,” and past the old U.S. customhouse (which closed during the Carter administration), a bar and some stores before leading to a few residential streets and a post office nearly hidden by towering pines.

Alaskans here set their watches an hour ahead of the rest of the state to match Stewart in the Pacific time zone, and accept Canadian currency. For years, Hyderites sent their children over the border to the school in Stewart, which has roughly 500 permanent residents, the only grocery store for a long way and not much else.

Neither town has a bank. To save money, Hyder residents often team up to buy bulk orders of food or shop for goods online, all of which arrive on the mail plane.

“If you’re into travel or ‘bright lights, big city’ you’re out of luck,” said Kris Wagner, 41, a bartender at the Glacier Inn, one of Hyder’s two saloons. The inn’s walls are covered with $95,000 in autographed currencies dating to 1956.

The two towns were once home to about 10,000 people, during the gold rush more than a century ago, when Hyder was built on stilts over tidal flats and Stewart was notorious for its brothels.

But the population dwindled as the mines shut down. Many of the Hyderites who stayed and the more recent arrivals say they came largely to answer the call of the wild.

Jim Wilson/The New York Times

“I’m into bears,” said Susan Craft, 71, a retired accountant from Texas who moved here with her family 40 years ago after several visits to Alaska. “My husband wanted to stay married, and he figured I wasn’t leaving.”

Carl Bradford, 60, known as Bar Fly, showed up around the same time, looking for work after a run-in with the law in the lower 48 states. Before the Granduc copper mine closed in 1984, he could make $150 a night sweeping up at the Sealaska bar just by picking up dropped money. But it was the great outdoors that kept him here.

“At 3 a.m. the moon is out, the mountains are glowing with snow and you can hear wolves howling in the valley,” said Bradford, a part-time U.S. Forest Service worker. “There’s just no comparison.”

Jim Wilson/The New York Times

The landscape has a similar effect on folks in Stewart. “I like to take a bong toke and stare at the mountains,” said Janna Watson, a 20-year-old waitress.

Tourism has largely replaced mining in these parts. Residents say more than 100,000 people arrive by car, motorcycle and recreational vehicle in the summer, drawn by natural monuments such as the vast Salmon Glacier, about 30 kilometres from town in B.C. Local guidance is necessary: just about everyone can recall close encounters with black bears or grizzlies in town, some of which have not ended well.

Without authorities to protect them from the wildlife, Hyderites tend to be well armed, which sometimes comes as a shock to their Canadian neighbours.

“When I first went to Hyder and saw them all walking around with guns, I was like, ‘Holy cow, this is America,’” said Twyla Korgel, 46, who works at the King Edward Hotel and Liquor Store in Stewart.

Firearms are not allowed past the Canadian customs checkpoint. Still, Hyderites have occasionally broken the law, like that time Caroline Stewart slung on her 12-gauge shotgun and strapped a .357 Magnum revolver on her hip to defend a Canadian customs officer being harassed by a bear.

“That’s what you do here,” said Stewart, 61, the owner of a Hyder gift shop, who arrived with her “doomsday prepper” parents in 1972. “I’m not going to let some line in the sand stop me from saving my neighbour’s life.”

Guns are not the only reason for the Canadian checkpoint. Many years ago, Stewart said, large shipments of U.S. liquor, cartons of cigarettes and groceries were smuggled into Canada under cover of darkness to avoid the higher taxes.

These days, however, it is simpler for Canadians just to drink in Hyder. “Might as well go over there, get good and liquored up and have someone bring you home,” said Liz Nelson, 50, a waitress at the Silverado Cafe & Pizza Parlor in Stewart.

Still, the border offers a lure for certain Hyderites: a legal drinking age of 19, two years lower than in Alaska.

For those even younger, crossing into Canada has been a necessity during periods when Hyder had fewer than 10 children, the minimum required for Alaska’s government to send in a teacher. The Hyder school reopened two years ago in a former bottling plant, and it will have about a dozen students in the fall, ranging from kindergarten through high school.

Some rare diplomatic friction occurred last year when the Canadian government closed the border between midnight and 8 a.m. to save costs. “So much hell was raised,” Bradford said. Residents complained that they could be cut off from emergency medical care or worse, that tourists would be unable to see the bears at Alaska’s Fish Creek Wildlife Observation Site.

In protest, some Hyderites installed a sign near the crossing that declares “Checkpoint Charlie” and then “You are leaving the American sector.” The Canadians eventually relented, but only after Lisa Murkowski, one of Alaska’s U.S. senators, got involved.

These days, things are back to normal, said Carly Staehlin, 42, a Texas native and cafe owner who lives in Stewart with her Canadian husband. But Staehlin still likes to spend time in Hyder, where the Stars and Stripes flap in the wind and she finds a familiar sense of freedom.

“Every time I cross that border,” she said, “it’s like I’m coming home.”