Until just about 24 hours before the polls closed, the race for Montana’s sole congressional seat seemed to be focused on health care, Donald Trump and gun rights. Republican businessman Greg Gianforte appeared to be headed for a likely victory in the race against another political newcomer, musician and Democrat Rob Quist.

Then came Wednesday night.

As most people seem to now know, Gianforte lashed out at Ben Jacobs of the Guardian when the reporter pressed him for his stand on the House Republican health care proposal. Jacobs’ phone was recording audio that has since ricocheted around the internet.

Within 24 hours nearly one million people had watched the YouTube video posted of the audio – a total about equal to the entire population of Montana.

The result was a firestorm of media coverage and social media bile. And yet Thursday night Montana elected the millionaire software entrepreneur and the nation was left to ask: Why?

Well, as a former political reporter and someone who wrote an encyclopedia about the media and politics (and, yes, I didn’t know people did that, either), I will try to explain what happened under the Big Sky.

Voting early often

Key to the Gianforte win is one simple fact: The incident came after some 250,000 Montanans had already cast ballots in the race. That means 69 percent of voters ended up casting their ballots before the assault. In fact, Democratic Gov. Steve Bullock had pressed for the entire vote to be done by mail, in an effort to reduce costs and potentially increase voter turnout.

Republicans, led by the state party chairman and legislator Jeff Essmann, fought the measure and in the end, the state opened polling places on Thursday. This created the opportunity for voters to weigh in on Gianforte’s behavior.

One of the big questions was: Had too many people already cast their ballots? Unlike some states, Montana does not allow people to change their minds or retract their votes after they are cast. So as the ballots were being counted, people were asking: Did Gianforte have enough of an early voting lead to fight off any voter anger over the assault?

Some indications ahead of the vote gave Republicans reasons to be worried. A week before Election Day, the Billings Gazette reported on the anemic rate of return in the race. Reporter Tom Lutey noted that only 31 percent of the registered voters had cast ballots and that most officials were reporting continued light turnout with people turning in the absentee ballots. Although Montana does not have formal early voting, voters can drop off their absentee ballots in person ahead of Election Day.

That news made the question of turnout the great decider in this race. And in the end, not enough Montanans cast ballots in opposition to Gianforte, and the Republican eked out an 7-point victory.

The victory – coming in at less than half the margin garnered by former Congressman Ryan Zinke only six months ago – was closer than most people had projected a week earlier.

Gianforte entered this race with a lot of wind at his back. He had just run an expensive campaign for governor where he nearly knocked off the incumbent. He spent more than US$5 million of his own money in that race, and when the GOP met to select a nominee for the special election, he could boast more than 80 percent name recognition. He was an experienced campaigner.

He was also competing for a seat Democrats had failed to make a serious run at in 20 years.

But even before the assault, a couple of wild cards threw the politics of Big Sky Country into doubt. Democrats picked a banjo-playing everyman, and health care became a central issue.

Enter the banjo

In all the sturm und drang of the past 24 hours, one of the names that only occasionally cropped up was Rob Quist, the Democrat running against Gianforte. Quist grew up in rural Montana and became a homegrown star as one of the leaders of the Mission Mountain Wood Band, a country rock group started in the 1970s. Always clad in a white cowboy hat and sporting a mustache, Quist stressed his Montana roots and argued Gianforte, who was born in New Jersey, was not “one of us.”

Montana Public Radio’s Eric Whitney quoted one Bozeman supporter as saying, “I think he’s perfect because he’s a native Montanan. He came from an agriculture background. I think he’s qualified because he’s a middle-income person, he’s not a millionaire.”

Quist’s campaign drew in a lot of support, raising more than $5 million, but also faced an onslaught of outside money. The Center for Responsive Politics reported that Republican-aligned groups like the Congressional Leadership Fund, the National Republican Congressional Committee and the Republican National Committee were the top outside spenders, doling out more than $4.7 million in independent expenditures as of a week ago.

Quist, who had to fight stories about failing to pay contractors and tax liens, as well as questions about his support of gun rights, seemed to weather the ads fairly well.

Montana, interestingly, has somewhat of a track record in turning against candidates who receive outside help. In both 2016 and 2014, there have been high-profile Montana Supreme Court races where groups have poured money into attacks on one candidate only to see that candidate turn the spending into an effective argument against their opponent.

Quist had some success playing the same card, seeking to connect it to the message that Greg Gianforte is an outsider.

An actual issue?

The last piece of the puzzle, and the one that triggered the now-infamous assault, was the emergence of health care as a major issue in this campaign.

In 2015, a bipartisan group in the Republican-led Montana legislature worked with the Democratic governor to pass a Medicaid expansion bill. The decision provided 70,000 Montanans – about 7 percent of the state – with health insurance. In a big, sparsely populated state like Montana, rural hospitals and clinics soon found that the coverage helped keep their lights on and provided needed money for services.

The American Health Care Act threatened all of that. Quist’s campaign used it to produce a highly effective one-minute ad that ran all over the state.

The ad put Gianforte on the spot. The Republican had publicly hedged about the plan, saying he wanted to see the full Congressional Budget Office report on the proposal. He was also caught on tape telling donors he was “thankful” for the GOP bill.

It was that dispute that prompted Ben Jacobs to push Gianforte to finally answer the question one way or another.

The rest is history.

Now, Gianforte takes office a deeply scarred politician. He faces a court date in June and has to somehow rebuild a reputation badly tarnished by a 30-second outburst.