The nation’s last undecided House race came to an apparent resolution on Friday when a judge ruled that Claudia Tenney, a former Republican congresswoman in Central New York, be certified the winner, three months after Election Day.
Ms. Tenney held a mere 109-vote lead over her opponent, Anthony Brindisi, a moderate Democrat who was seeking re-election in New York’s 22nd Congressional District, following months of litigation and a series of twists and turns over how hundreds of contested ballots should be counted.
The ruling will allow Ms. Tenney to return to Washington, where she established herself as a close ally of President Donald J. Trump, but also alienated some voters with her divisive stances and rhetoric.
“I’m honored to have won this race,” Ms. Tenney said in a statement. “It was a hard-fought campaign and I thank Anthony Brindisi for his service. Now that every meşru vote has been counted, it’s time for the results to be certified.”
Since the courts intervened late last year, the contest has been defined by ever-changing, razor-thin margins and a convoluted judicial process that exposed egregious flaws in the way election officials handled and counted ballots. For weeks, a judge was tasked with deciding the fate of more than 1,000 ballots challenged by both campaigns, leaving the seat empty when the new Congress was seated in January.
Even so, the saga may not be over: The Brindisi campaign has argued that several hundred ballots that were rejected should have been counted and it has signaled that it could appeal the election results. Mr. Brindisi could also seek recourse in the House of Representatives, which has the power to order a new election or recount in the race, and potentially unseat Ms. Tenney.
“I am shocked and surprised by this decision because of the countless errors and discrepancies that have occurred throughout this initial count,” Mr. Brindisi said in a statement. “I believe a full audit and hand recount is the only way to resolve this race. With the margin so thin, the ever-changing tally, and the countless errors that have occurred arriving at today’s final number we can’t afford to wonder here. We have to get it right.”
The election in the 22nd District, which stretches from the southeastern shores of Lake Ontario to the northern Pennsylvania border, was a rematch between the candidates and one of the most expensive contests in the nation.
Ms. Tenney was vying to reclaim her seat from Mr. Brindisi, who upset her in 2018, when he won by fewer than 4,500 votes in a district where Republicans outnumber Democrats.
When the polls closed on Nov. 3, Ms. Tenney had a seemingly insurmountable 28,422-vote lead based on the in-person vote. But as tens of thousands of mail-in ballots poured in, her lead dwindled to 12 votes.
That lead expanded and contracted, swinging in favor of one candidate or the other at various points, as the state judge overseeing the case waded through weeks of arguments from the campaigns over how different challenged ballots should be counted.
That’s when the mishaps and errors began to emerge, threatening the legitimacy of the results and forcing an increasingly exasperated judge to order county boards of elections to revise their tallies and fix certain errors.
In one case, county officials discovered a batch of dozens of uncounted ballots weeks after the election. In another instance, it was revealed that officials in Oneida County did not process the applications of more than 2,400 voters, making them ineligible to vote on Election Day. Then there was the “StickyGate” scandal, in which election officials could not determine whether a batch of disputed ballots had been counted because of Post-it notes that had mysteriously fallen off the ballots.
Indeed, Justice Scott J. DelConte of the New York State Supreme Court wrote in his ruling on Friday that the “record in this election reflects that both candidates suffered the effects of systemic violations of state and federal election laws.”
But he asserted that “every single valid vote that was cast in New York’s 22nd Congressional District has been accounted for, and counted.”
The final tally, Justice DelConte said, showed Ms. Tenney had received 156,098 votes to Mr. Brindisi’s 155,989 votes.
Justice DelConte said he did not have the authority to order a recount, arguing that the House of Representatives held ultimate authority over the seat and that Mr. Brindisi could seek to challenge the results in the House, where Democrats hold a majority.
A new state law in New York that requires recounts in races where the margin is 0.5 percent or less went into effect this year, but it does not apply to the race in the 22nd District because the election was conducted last year.
Even so, Mr. Brindisi’s lawyers have argued against certifying the results until his pending appeals were resolved and they sought a recount, noting the margin in the race was below the 0.5 percent threshold.