Members of the Virginia House of Delegates vote in February 2017. (Bob Brown/RICHMOND TIMES-DISPATCH VIA AP)

A Stafford Circuit Court judge on Tuesday threw out a lawsuit brought over a squeaker House of Delegates election that could determine whether Republicans hold their grip on the chamber.

But hours later, the Democrat trailing in that race filed another lawsuit in federal court.

The first lawsuit, filed by the NAACP Legal Defense and Educational Fund, asserted that local elections officials gave “conflicting and misleading instructions” to voters who were required to cast provisional ballots on Election Day.

The suit was just one front in the struggle for House control, which could turn on three exceedingly close elections. All three appear headed for state-funded recounts. In one of the three, 10 votes separate the candidates.

Stafford County Circuit Court Judge Victoria Willis denied the legal defense fund’s request for an injunction, which would have required local elections officials to wait a week before declaring a winner in the race.

The judge ruled that the group lacked standing to bring the suit because it was not clear that the two voters named as plaintiffs had been harmed.

The suit claimed that local elections officials gave confusing directions to voters about what they could do to ensure that their provisional ballots would be counted.

Sherrilyn Ifill, president of the legal defense fund, told the judge that she had been unable to confirm reports that one or both of the plaintiffs had attended an elections board meeting a day earlier to defend their votes. Ifill said she had not been able to reach either.

Ifill indicated in court that the group would seek to file another lawsuit on behalf of other voters who cast provisional ballots.

In the meantime, Willis’s ruling cleared the way for the county electoral board to begin counting provisional ballots cast in the race to succeed retiring House speaker William J. Howell (R-Stafford).

On election night, Republican Robert Thomas led Democrat Joshua Cole by 86 votes, a margin later adjusted to 84 after a few errors were corrected. After tallying provisional ballots Tuesday, Cole picked up two votes, shaving Thomas’s lead to 82.

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

The board also voted against counting 55 absentee ballots that were in dispute. The Democratic Party of Virginia said on Veterans Day that those ballots, believed to be from active-duty military voters, were left in the registrar’s mailbox on Election Day.

But elections officials, Democrats and Republicans alike, said that was not the case. The ballots were run-of-the-mill absentee ballots and were not delivered until 10 a.m. Nov. 8, the morning after the election, they said.

Electoral Board Chairman Doug Filler, whose daughter is Del. Eileen Filler-Corn (D-Fairfax), argued that the ballots should be counted, suggesting that the post office might have been responsible for their delayed arrival.

But the two other board members — Republican Gloria ­Chittum and Democrat Marie Gozzi — said state law was clear that they could not count absentee ballots that arrive after polls close at 7 p.m.

By Tuesday night, the Virginia House Democratic Caucus announced it had filed a lawsuit on Cole’s behalf in Federal Court in Alexandria, demanding that the 55 absentee ballots be counted.

“We are disappointed with today’s decision of the Stafford County Electoral Board not to count the 55 absentee ballots erroneously excluded from this year’s election results,” Marc Elias, the caucus’s attorney, said in a written statement.

House Majority Leader Kirk Cox (R-Colonial Heights), who is in line to become speaker if the GOP holds the majority, praised Stafford’s board for voting “to uphold the law.”

“Despite multiple unsuccessful attempts by Democrats to litigate the results of this election, the law was applied fairly and evenly by the commonwealth’s judges and electoral boards, preserving the integrity of the electoral process as well as the constitutional rights of all voters who lawfully participated in the election,” Cox said.

On Nov. 7, Democrats made huge gains in the House and swept statewide offices for governor, lieutenant governor and attorney general.

Before the election, Republicans enjoyed a 66-to-34 majority in Richmond’s lower chamber. Now, Democrats are within striking distance of taking control. They need one more victory to force a power-sharing deal with Republicans and two more to take the reins of the chamber for the first time since 2000. Democrats have secured wins in 49 out of 100 seats, with Republicans holding narrow leads in the Thomas-Cole contest and two others.

After elections officials examined provisional ballots cast in District 40 on Monday, Del. Timothy D. Hugo (R-Fairfax) saw his 115-vote lead over Democrat Donte Tanner shrink to 106 votes. In District 94, Del. David E. Yancey (R-Newport News) had his 13-vote lead over Democrat Shelly Simonds dwindle to 10.

Recounts cannot begin until election results are certified shortly before Thanksgiving.