TALLAHASSEE — Florida’s historic recount was thrown once more into uncertainty Thursday when a federal judge ruled that voters whose mail-in and provisional ballots were rejected because of issues with their signatures will have two more days to resolve the problems and possibly have their votes counted.

The decision by Judge Mark Walker of the U.S. District Court in Tallahassee came just hours ahead of the Thursday afternoon deadline for elections officials to complete a machine recount. It is particularly notable in the too-close-to-call Senate race, in which Gov. Rick Scott (R) leads Sen. Bill Nelson (D) by fewer than 13,000 votes.

Walker’s decision affects Floridians who cast their ballots by mail, or voted provisionally, but whose signatures did not match records maintained by state officials. More than 4,000 ballots across 45 counties in Florida were set aside because of inconsistent signatures, he wrote in his opinion. In the other 22 counties, the number is unknown.

The judge concluded that mail-in voters weren’t notified of the discrepancy until it was too late to fix, while state law gives provisional voters no opportunity to resolve apparent signature irregularities.

“The precise issue in this case is whether Florida’s law that allows county election officials to reject vote-by-mail and provisional ballots for mismatched signatures — with no standards, an illusory process to cure, and no process to challenge the rejection — passes constitutional muster,” Walker wrote. “The answer is simple. It does not.”

While the ruling gives Nelson new hope for chipping away at his deficit, it falls short of the more sweeping decision his lawyers sought and is probably not enough to change the outcome of the race on its own. The judge, in a decision released early Thursday, stopped short of invalidating the signature-match requirement, concluding instead that the directive had been applied unlawfully. He also declined Nelson’s demand that all the mismatched ballots be counted “sight unseen,” as the judge put it.

Drawing an analogy to the rules governing football, he declined to throw out the regulation just because there had been a faulty call, observing, “Football fans may quibble about the substance of the rules, but no one quibbles that rules are necessary to play the game.”

Still, the order raises new questions about next steps in the recount in three statewide contests — the races for governor and agriculture commissioner, in addition to Nelson’s reelection bid. Unofficial results in the bitter contest over the governor’s mansion showed Rep. Ron DeSantis (R) leading Andrew Gillum, the Democratic mayor of Tallahassee, by nearly 34,000 votes, or roughly .4 percentage points. Scott’s lead over Nelson was .14 percentage points.

In his ruling, Walker said the plaintiffs, the Florida Democratic Party and the Nelson campaign, had established “irreparable injury” to the constitutional right of citizens “to cast their ballots and have them counted.”

“Here, potentially thousands of voters have been deprived of the right to cast a legal vote — and have that vote counted — by an untrained canvassing board member based on an arbitrary determination that their respective signatures did not match,” wrote the judge, appointed to the federal bench in 2012 by President Barack Obama. “Such a violation of the right to vote cannot be undone.”

Walker emphasized that the court was not instructing county canvassing boards to “count every mismatched vote.” But he said the state’s process for curing ballots with irregular signatures had been applied improperly, robbing voters of the chance to make corrections before Nov. 5. State law requires canvassing boards to notify voters “immediately” if they determine that a mail-in ballot contains a signature inconsistent with the one on file.

Officials were therefore required, he argued, to allow voters another opportunity to have their ballots counted before the second official results are certified. “The county supervisors are directed to allow those voters who should have had an opportunity to cure their ballots in the first place to cure their votes-by-mail and provisional ballots now,” he wrote.

The court dismissed the state’s argument that an additional delay would erode faith in the election. There was no reason, the judge observed, why giving all eligible voters the chance to be included would threaten the process.

“Regardless, any potential hardship imposed by providing an actual opportunity to challenge the determination that a signature does not match, and thus, a vote does not count, is outweighed by the risk of unconstitutionally depriving eligible voters of their right to vote and have that vote counted,” Walker found.

Scott’s campaign is expected to appeal the decision.

The ruling was part of a flurry of courtroom activity that could influence the high-stakes Senate race, even as local election officials scrambled to meet the Thursday deadline to complete their work. The dispute over signatures recalls the scrutiny of hanging chads by the same three-member canvassing boards after the contested presidential election in 2000. Florida is again the focal point of a contest over voting and electoral legitimacy.

Election officials in Broward County, a populous Democratic stronghold, maintained that they would meet the 3 p.m. Thursday deadline for completing a machine recount. Officials in Palm Beach County faced problems with the counting machines themselves and have said they can’t guarantee they’ll be done Thursday.

Representatives of the Republican and Democratic parties attended a “walk-through” at the Broward elections office to prepare for the manual recount expected to follow in the Senate race.