Most folk in Cody, an old frontier town founded by Buffalo Bill (real name, William Cody), knew that once they started debating arming teachers in schools they’d eventually end up doing it. The most powerful rifle in America is made here, they boast one of the largest firearms museums in the land and most summer nights there’s a mock gunfight outside the Irma Hotel. Guns rule.

What they didn’t anticipate was pupils who fought it getting apparent death threats from strangers or that once it passed the school board on a four-to-two vote in April whole families would vow to quit town and teachers their jobs. They didn’t see how far it would rip the town apart.

It didn’t have to come to this. Maybe blame Betsy DeVos, the gaffe-prone secretary of education, who singled out this district when asked about the topic during her confirmation hearing on Capitol Hill last year. No one should be shocked, she ventured, if guns were already knocking about schools in this part of north-west Wyoming. They’d be there, “to protect from potential grizzlies”.

Except no. “This has absolutely nothing to do with grizzly bears,” Jenni Rosencranse, a school board member who voted “yes” to arming the staff, made clear. Ms DeVos was mocked for her remark, but there’s little to laugh at here.

“It’s not about grizzly bears,” Ray Schulte, the school’s superintendent, insisted with both a smile and a sigh. “It’s about school threats from other people.”

Anxiety about school safety is hardly limited to this corner of the country. It has been an America-wide fear since the the Columbine High School shooting near Denver nearly 20 years ago. With every subsequent attack it has been compounded, from Newtown, Connecticut, in 2012 (20 pupils dead) to Parkland, Florida, just this February (17 dead).

But it was Donald Trump who did most to challenge the assumption once held by most that schools, places of innocence and learning, should be free of deadly weapons. With the support of the National Rifle Association (NRA), he rehearsed even back in 2016 the opposing view: that gun-free zones attract bad guys with guns and stopping them means giving guns to the good guys, which in this context means teachers.

Early last year, Wyoming took the bait, passing a law allowing individual school districts for the first time to make their own decisions on introducing guns to classrooms. At that point, said Ms Rosencranse, there was no avoiding the topic in District 6, in which Cody, a gateway to Yellowstone National Park, is the largest town. As a first step, the board sent a survey to 2,400 of its roughly 10,000 residents asking what they thought of teachers potentially packing heat.

The results showed no fewer than 74 per cent of respondents in favour, a margin wide enough to spur the board immediately to begin drafting an ordinance. Elsewhere in the country, school boards are taking less drastic steps, from increasing security at school doors to giving teachers less deadly weapons. In Pennsylvania, one town recently distributed miniature baseball bats to its 500 teachers and another is equipping them with buckets of small rocks.

But, again, this is Cody, where guns are as common as snowflakes in April. They are in the town’s heritage and its soil. “Good, bad or indifferent, firearms now are part of all our shared story,” explained Danny Michaels, the assistant curator at the Firearms Museum, housed inside the Buffalo Bill Centre of the West, the town’s biggest attraction.

Peek in the backs of students’ trucks at the high school, noted its headmaster, Jeremiah Johnston, and as likely as not you’ll see multiple weapons inside. “It’s not illegal,” he said. “They will go out after school and go hunt.”

Greg Buchel, owner of Big Horn Armoury, maker of the SpikeDriver, a lever gun that boasts more punch, at least up to a distance of 200 yards, than anything else on the American firearms market, supported holstering up the teachers, “within reason”, and scoffs at bats or rocks as defensive weapons versus a loaded pistol.

“Which one do you think is more effective against anybody who has got a firearm or who’s got a knife, even a knife?” he asked in his workshop, a 10-minute drive from town. “Most of us understand the game of rock, paper, scissors.”

An antique musket in the Cody Firearms Museum with a decorative Abraham Lincoln hammer (David Usborne)

Even so, the lopsidedness of the survey result surprised almost everyone. It was “the tipping point for the whole adoption of a policy”, to arm teachers, said Mr Schulte, sipping a pink Shirley Temple virgin cocktail at the bar inside the antique Irma Hotel, built by Buffalo Bill for his daughter of the same name in 1902. “Seventy-four per cent of anything is a pretty high number.”

“I was stunned,” recalled Yancy Bonner, who, despite owning guns with her husband and taking them on camping trips with their 11-year-old daughter into the hills towards Yellowstone, fought furiously to defeat the policy. She and like-minded friends in Cody quickly mobilised, attending every public hearing arranged by the school board dressed in protest red with badges declaring their opposition.

“I feel that it is a reactionary policy that is fed by paranoia. We are not doing anything to make our kids safer by introducing more guns into the equation,” she said.

While she and her allies usually outnumbered supporters at the hearings, they felt the battle was already lost.

Two of the six board members were themselves in the firearms business, including Ms Rosencranse and also Scott Weber, owner of Gunrunner Firearms and Auctions in town. “I would say to all of you who would say no to this policy, I’m going to give you a fact,” Mr Weber declared angrily at one of the meetings. “There are three people currently incarcerated who have said they will come into our schools and kill all our children… RIGHT NOW!”

“The soundbites and the talking points they bring up are straight out of the NRA talking points,” Ms Bonner, who has an interior design business in Cody, claimed. “Our kids are sitting ducks and all the rhetoric we get from the NRA was heard loud and clear here in Cody during this debate.”

A towering, stuffed grizzly bear welcomes visitors to the Cody Firearms Museum (David Usborne)

If some parents felt besieged, so did the handful of students who dared speak out against the policy. “It was nerve-wracking, I was convulsing the whole time,” Trisha Tamblyn, 18, recalled of the time she addressed the board. But she didn’t waver in her conviction, even if among students she was in a small minority. “We are answering a problem that involves guns, by adding more guns to the equation and that just doesn’t make sense to me,” she explained, adding she worries about the short fuses of some teachers and students. “I have seen teachers scream at students to the point where they are red in the face. I have seen students flip desks.”

If Ms Tamblyn received rivers of invective from fellow students and even one infuriated parent for taking the position she did, she was at least spared the experience of one of her friend, Lucille Sax, 18, who spoke at three of the hearings to urge the board to change course.

One day on Facebook she had a message from someone she didn’t recognise. It read: “You obviously don’t know how guns work. But I would love to show you.” Was that tantamount to a death threat? “I took it that way,” she told The Independent. Certainly she was sufficiently unnerved that she approached the police officer assigned to the high school to report it. As far as she knows, however, the police department never followed up.

Ms Rosencranse admitted the debate was rough. “Could things have been handled better? Absolutely, they always can be,” she said.

But she defended the policy as eventually drafted. In theory, everything will be in place for the start of the next academic year in September. Much will depend on teachers actually agreeing to bear arms.

Those who do will be subjected to “suitability and psychological” vetting and will have to undergo 24 hours of weapons training. If they are approved to carry weapons, their identities will be kept a secret. Those teaching high, middle and elementary school are invited to volunteer. So too those teaching kindergarten children.

Another pupil, Reese Romero, 18, a county shotgun champion who also competes nationally, is deeply sceptical the teachers will be ready to kill if necessary. “I don’t think 24 hours is near sufficient. I’ve never been in a position of having to defend myself or my family but I can’t tell you honestly if I’d be able to pull the trigger on a person.” For that reason alone, he thinks the new policy foolish.

Mr Romero, Ms Sax and Ms Tamblyn will graduate this year and won’t see the new policy in action. But some of the grownups who opposed it now face tough choices. Ms Bonner said she and her husband have already agreed to pull their daughter out of the Cody school system. They will either take her 20 minutes every day to a neighbouring district that has just eschewed putting guns in the classrooms or arrange homeschooling.

A close friend, Catherine Thompson, 45, said the vote was the decisive factor in persuading her and her husband to leave Cody altogether with their two daughters aged 11 and six. They are moving to Boulder, Colorado. She fears there will be “an accident or unintended consequences” from arming teachers and thinks proponents exaggerated the likelihood of a shooting here which she called “vanishingly small”.

Also headed for the hills – actually Missoula, Montana – is Chris Bosshardt, a substitute teacher in the Cody elementary and middle schools. He’d been considering leaving for a while, but made the decision a day after the school board voted. “Is this the best they could come up with?” he asked, wondering out loud what a teacher with a gun would do if the alarm is sounded that a shooter is somewhere else in the school.

“Are they going to leave a classroom of elementary-aged kids and go and get in a gunfight? Is that what they’re looking for to happen? I just think that that’s bizarre, it’s uneducated and it’s ridiculous. I can’t imagine my child being in a classroom where the teacher says, ‘There is an emergency. I have to leave. Good luck.’”