Regardless of the winner, the specter of a June court date for Mr. Gianforte on a misdemeanor assault charge was a humiliating coda for Republicans at a difficult moment. The party had already been forced to spend millions of dollars to prop up its nominee in a race being pored over for clues about the national political environment in the tumultuous first months of Donald J. Trump’s presidency.
On Thursday, Mr. Gianforte’s conduct appeared to be a last straw.
“He’s the problem,” Corry Bliss, who runs a “super PAC” aligned with House Republicans, said of Mr. Gianforte. When the contest began, Mr. Bliss said, private polling showed that Mr. Gianforte was as unpopular as he was popular, a leftover result of his failed campaign for governor last year.
“This race was essentially an unpopular incumbent trying to get re-elected,” said Mr. Bliss, whose Congressional Leadership Fund spent nearly $2.7 million on Mr. Gianforte’s behalf. “And in this environment, C-minus candidates aren’t going to cut it.”
Elected Republicans in Washington also expressed frustration, publicly scolding Mr. Gianforte.
The House speaker, Paul D. Ryan, called on him to apologize and predicted that Mr. Gianforte, a wealthy former software executive, would publicly address the episode.
“Should the gentleman apologize? Yeah, I think he should apologize,” Mr. Ryan said. “I know he has his own version, and I’m sure he’s going to have more to say, but there’s no call for this, no matter what — on any circumstance.”
Senator Steve Daines of Montana, the state’s most prominent Republican and a former employee of Mr. Gianforte’s, said in a television interview that he was “very surprised” by his colleague’s behavior.
“I think Greg should apologize,” he told NBC News. “That’s warranted. And we’ll let the people of Montana decide what happens tonight.”
Mr. Gianforte’s outburst placed Republicans in a distinctly awkward position as ballots were being cast, with victory in the race suddenly looking as uncomfortable as defeat. Should Mr. Gianforte lose, it would be an embarrassing setback and would encourage Democrats hoping to take control of the House next year.
But if Mr. Gianforte won, it would force Republicans in Congress to interact with, and address the behavior of, a man summoned to the Gallatin County Courthouse on June 7 to answer an accusation that he “purposely or knowingly” caused “bodily injury to another.”
National Democrats, long skeptical of their prospects in Montana, said they would target Mr. Gianforte in 2018 if he prevailed on Thursday, given his fresh political vulnerabilities.
In the past, lawmakers have been pressed to defend or denounce colleagues of the same party ensnared in scandals, like former Representative Anthony D. Weiner of New York, the Democrat caught sending lewd photographs online.
Republicans had hoped to spare themselves much of the anxiety and expense of a contentious special election campaign by nominating Mr. Gianforte, who was well known in Montana and wealthy enough to advance himself politically.
Yet Mr. Gianforte also carried considerable baggage: While the governor’s race raised his profile, Montanans also spent months watching Democrats’ negative commercials attacking Mr. Gianforte’s views and branding him as a self-interested tycoon with no roots in the state or respect for its traditions.
While private polling has consistently shown him ahead of Mr. Quist, Republicans have fumed for some time that Mr. Gianforte seemed unable to establish a dominant lead in the race.
Though the prospect of Mr. Gianforte’s arrival in Washington as a congressman-elect unsettled some Republicans, House leaders gave no indication on Thursday that they might block him from being seated.
If Mr. Gianforte wins, Mr. Ryan said, “he has been chosen by the people of Montana.”
In Montana, the news of the altercation Wednesday evening at Mr. Gianforte’s campaign headquarters spread like a Big Sky wildfire. It dominated newspaper front pages and local television news in Bozeman, Mr. Gianforte’s adopted hometown, and across the sprawling state. Three of the largest daily papers in the state rescinded their endorsements of him.
Mr. Gianforte was silent on Thursday, and his campaign aides did not respond to messages.
Democrats here expressed newfound hope about their chances but stopped short of predicting victory, given that more than 250,000 votes had been cast by Wednesday. There are fewer than 700,000 voters in the state, and few political veterans expect turnout to reach much higher than 60 percent.
“There are a considerable number of independent voters in Montana who, unfortunately, make up their mind at the last moment,” said former Representative Pat Williams, the last Democrat to represent the state in the House, more than 20 years ago. “This event could have some effect on them.”
But in downtown Bozeman, many said they had already voted — or were unmoved.
“I was already going to vote for Rob Quist,” said Ariel Lusty, a 22-year-old graduate student at Montana State, who sported an “I Voted” sticker as she sat inside Wild Joe’s Coffee Spot.
And Richard Shanahan, a 75-year-old architect in Bozeman, said he had already voted by mail for Mr. Gianforte and was largely unbothered by the ugly end to the campaign.
“It doesn’t change my mind at all,” said Mr. Shanahan, who remarked on how ubiquitous the news had become overnight. “I think it’s being blown out of proportion.”