Joshua Cole, Democratic candidate for delegate in the 28th district, speaks to protesters gathered outside the Stafford County Government building in Stafford, Va. on Monday, Nov. 13, 2017. The protesters called on the county registrar to count all absentee ballots. (Mike Morones/The Free Lance-Star via AP) (Mike Morones/AP)

A federal judge refused Wednesday to issue a temporary restraining order to stop Virginia’s board of elections from certifying the results in two House of Delegates races in which more than 300 voters were apparently assigned to the wrong races.

It is unclear how many of those voters cast ballots on Nov. 7.

The ruling was a setback for Democrats, whose hopes for taking control of the chamber could rest on one of the two seats. “The job of the board is to certify the count,” Judge T.S. Ellis III of U.S. District Court in Alexandria said in a hearing conducted by telephone. “Let the state process run its course.”

But the judge let the lawsuit stand, meaning Democrats could return to the court after the results are certified by the state board of elections to challenge the outcome and request a new election.

“We don’t have a clear picture, exactly, of the scope of the problem,” Ellis said.

Republicans had unsuccessfully argued the case should be dismissed like two others brought by Democrats or their allies since the Nov. 7 elections.

Amid questions about voting irregularities, the state board of elections has twice delayed certifying the results in the two Fredericksburg-area House races. It is expected to meet Monday.

State elections officials have said 83 Fredericksburg voters were erroneously assigned to the 88th House District instead of the neighboring 28th. It was not clear how many of the 83 voted, but the mix-up has drawn intense scrutiny because one of the races was a squeaker that could tip the balance of power in the House.

Republican Bob Thomas holds an 82-vote lead over Democrat Joshua Cole for the 28th District seat, which is being vacated by retiring speaker William J. Howell (R-Stafford).

The Thomas-Cole contest is one of three close races that could determine which party controls the General Assembly’s lower chamber following a wave of Democratic House wins.

At Wednesday’s hearing, lawyers for the state indicated more voters were affected than previously reported, saying at least 384 voters in the 28th and 88th districts had been assigned to the wrong district.

The latest stories and details on the 2017 Virginia general election and race for governor.

Elections Commissioner Edgardo Cortés did not immediately respond to a request for comment about the higher number.

In addition to requesting a new election, the loser in the 28th District also could contest the outcome in the General Assembly, Ellis said, though he acknowledged that “partisan” considerations might be an obstacle.

“We are in uncharted territory,” said Heather Hays Lockerman, of the Virginia Attorney General’s Office. Members of the board, she said, will probably have “some significant heartburn” when certifying the results, knowing there were problems.

House Republicans have threatened to file a lawsuit of their own if the board does not certify the two elections Monday. Del. Kirkland M. Cox (R-Colonial Heights), who is in line to become speaker if the GOP holds onto the majority, blasted the board for the delays.

“The State Board of Elections exists to be an independent arbiter of our elections, but after the last three days no one could be faulted for questioning the independence of a Board that seems to be working in lockstep with legal counsel for the Democratic Party,” Cox said Wednesday.

Board Chairman James Alcorn said the board needed extra time to “sort out potential irregularities,” as state code allows and said the board was an impartial arbiter.

“As a Board, we attempt to make our decisions in a transparent, nonpartisan, consensus driven manner,” Alcorn wrote in an email to The Washington Post. “For somebody to state that the Board is not independent is just a false allegation.”

The pending lawsuit, filed against the board and Cortés, asserts that voters were cheated out of their right to cast a ballot in the proper race.

“These voters were disenfranchised from voting for the delegate who is to represent them,” said Marc Elias, attorney for House Democrats and Cole. “We have requested that the court issue a temporary restraining order to prevent the State Board of Elections from certifying the results in HD-28 until all voters who were disenfranchised have been given a reasonable opportunity to cast a ballot in the appropriate House District.”

The election is probably headed for a recount, although that cannot begin until after the results have been certified.

Trevor M. Stanley, a lawyer for House Republicans and Thomas, contends that state law leaves the board little choice but to certify results, which he termed a “ministerial process.”

He said certification must take place before any voting irregularities can be rectified — either through a recount or by contesting the results in the House.

“Although we appreciate the Board’s concern that votes be properly counted, delaying certification is counterproductive and harms the ability of interested parties to resolve any issues because, without a certification of the results, any recount or contest cannot proceed in the proper forum,” Stanley wrote in a letter to the board. “Once these results are certified . . . my clients will proudly work to ensure that every lawful vote cast by eligible voters counts in this election.”

But Alcorn contends that the board “does have some discretion.” He pointed to 2008, when the elections board refused to count certain ballots that Chesterfield County had included in its totals for the presidential primary. The discounted ballots had been drawn by hand, after polling places ran out of official ballots.

According to Cortés, in the spring of 2016 Fredericksburg registrar Juanita Pitchford erroneously assigned 83 voters from the 28th House District to the 88th. Pitchford died in April.

Elections officials said they were, at least initially, at a loss to explain why she made the changes. They also said they would look into whether other voters had been misassigned.

The mix-up is not expected to threaten the outcome in the 88th District, where Del. Mark Cole (R-Fredericksburg) won reelection by a wide margin. Mark Cole is no relation to Joshua Cole.

The Democrats’ lawsuit is filed on behalf of three Fredericksburg voters. Kenneth and Dolores Lecky intended to vote for Joshua Cole, the suit says, but they were given District 88 ballots because the poll book incorrectly listed them for that district. The third plaintiff is Phillip Ridderhof, who also planned to vote for Joshua Cole.

He was properly identified in the poll book as a 28th District voter, but a poll worker erroneously gave him a ballot for the 88th.

Elias and the NAACP Legal Defense and Education Fund separately filed two other suits in the race. One asserted that 55 late-arriving absentee ballots should have been counted.

The other said voters who cast provisional ballots were given confusing instructions for how to ensure their votes were counted. Judges threw out both complaints.

Before the election, Republicans enjoyed a 66-to-34 majority in the House. Now the count is 49 Democrats and 51 Republicans, with the 28th District race and two others likely headed for recounts. Democrats, who also swept statewide offices for governor, lieutenant governor and attorney general, need one more House win to force a power-sharing deal with Republicans and two more to take control of the chamber for the first time since 2000.

In the other two close races, Del. Timothy D. Hugo (R-Fairfax) has a 106-vote lead over Democrat Donte Tanner, while Del. David E. Yancey (R-Newport News) is up just 10 votes over Democrat Shelly Simonds.