A New York state judge Tuesday ordered ballots retallied in one of the closest House races in history, which could leave the question of who will represent the 22nd Congressional District potentially unsettled into the new year.

New York State Supreme Court Justice Scott J. DelConte ordered officials in eight counties to recanvass ballots after a Monday hearing in which, according to media reports, he expressed frustration with lawyers for both incumbent Rep. Anthony Brindisi (D) and his Republican opponent, former congresswoman Claudia Tenney.

The decision to order a districtwide review, however, is good news for Brindisi, who currently trails by 12 votes under the most recent districtwide count. His lawyers had hoped to limit recounts to certain absentee ballot disputes, but DelConte ordered a full recanvass — wholly rejecting Tenney’s request that he simply order the election’s certification, setting aside alleged errors and newly found ballots.

That means each county must reexamine thousands of ballots anew, including potentially hundreds of provisional ballots and disputed absentee ballots that were not handled by elections officials according to state law.

The process, which is likely to include further court challenges, could take weeks to conclude — raising the possibility that neither Brindisi nor Tenney, who held the seat from 2017 to 2019, will be sworn in Jan. 3.

“It is more important that this election is decided right, than that it is decided right now,” DelConte wrote.

Brindisi called the decision “a win for the people of the 22nd District.”

“This margin is too small and the stakes too high to rush to judgment,” he said in a statement. “We owe it to voters, our democracy, and each other to let this process move forward without attacking each other, promoting conspiracy theories, or fanning the flames of division.”

Tenney campaign spokesman Sean Kennedy said the ruling “will see to it that every legal vote is counted.”

“If the proper legal procedures are followed, we are confident that we will prevail and Claudia will assume office,” he added.

Counting votes has been a roller-coaster ordeal in the district, which stretches from Binghamton on the Pennsylvania border up to the eastern shore of Lake Ontario. Tenney held a strong Election Day lead, but Brindisi steadily made up ground as New York sluggishly tallied its absentee votes.

But hundreds of those ballots remain under dispute, and missteps by elections officials in several counties have thrown the count into turmoil and vexed DelConte, who has broad authority under New York state law to manage the process.

One county, for instance, labeled challenged ballots using Post-it Notes that later fell off, making it impossible to match the ballots with the grounds for challenge. Another county discovered 55 ballots after the unofficial count concluded, leaving DelConte to decide whether they should be counted.

In his decision Tuesday, DelConte did not conceal his frustration with the county election officials who did not follow the letter of state law in reviewing challenged ballots — including, in one case, allowing campaign officials instead of election workers to review a pile of questioned ballots.

“To be clear, there is absolutely no evidence or even an allegation before this court of any fraud on the part of the Boards or the campaigns. Nor is there any evidence that the Boards’ failures and errors were a result of the pandemic, recent amendments to the election law, or a strain upon the Boards of Elections’ capacity and resources,” DelConte wrote. Instead, he said, they simply did not follow state law out of carelessness — thus impeding the court’s ability to rule on genuine challenges.

While the judge dismissed Brindisi’s desire to conduct a more limited review — one that could allow the election to be certified before lawmakers are sworn in Jan. 3 — he entirely rejected Tenney’s request to simply order the election’s certification.

That, he wrote, “would require that this court ignore multiple errors by the Respondent Boards of Elections, disregard proper challenges to invalid ballots that were counted and valid ballots that were not counted by both parties, and ignore hundreds of ballots that were never canvassed in the first place.”

“That is not the role of the Court. The winner of this election must be decided by the real parties in interest: the voters,” he added. “And to do so, every valid vote must be counted.”

The Brindisi-Tenney race isn’t even the closest congressional race in the country at the moment.

In Iowa’s 2nd Congressional District, Mariannette Miller-Meeks (R) won by six votes over Rita Hart (D), according to the state-certified results. But Hart is continuing to challenge the result, asking a House committee to review the election and potentially count additional ballots under the Federal Contested Elections Act.

Hart’s decision has already sparked a sharp partisan backlash, with Republicans protesting that Hart is appealing to the Democratic House to overturn the will of Iowa voters. Hart’s campaign said it is simply seeking to count all legal ballots.

“This isn’t about politics. It’s about protecting every Iowan’s ability to have their voice heard,” a spokesman, Riley Kilburg, said last week.

Pending the results in New York and Iowa, Democrats have won 222 House seats — just four more than the bare majority of 218. With that tight margin and several House Democrats angling for positions in President-elect Joe Biden’s administration, the outcome of the uncalled races could have significant governing implications.