By GARY FINEOUT and BRENDAN FARRINGTON , Associated Press

TALLAHASSEE, Fla. (AP) — A federal judge early Thursday ordered that voters in Florida be given until this weekend to fix their ballots if they haven't been counted due to mismatched signatures.

The ruling by U.S. District Judge Mark Walker came just hours before a 3 p.m. deadline counties have to finish recounts that could determine the next senator and governor in one of America's top political battlegrounds. Republicans said they would immediately appeal.

State officials testified that nearly 4,000 mailed-in ballots were set aside because local officials decided the signature on the envelope didn't match the signature on file. These voters now have until 5 p.m. Saturday to turn in affidavits including a copy of valid identification so that their votes will be counted. If so, they'll be included in the final official returns, due from each county by noon Sunday.

Walker's decision does not directly affect the ongoing recount, which could stretch into the weekend. The election supervisor in the Democratic stronghold of Palm Beach County warned they may not meet Thursday's initial deadline. U.S. Sen. Bill Nelson and Democrats want that looming deadline set aside, and other lawsuits could lead to more delays.

More than a week after Election Day, an immediate resolution seems remote.

Once the machine recount is complete, state law requires a hand review of races with margins of less than 0.25 percentage points. This almost certainly means another recount in the Senate race, with unofficial results showing Republican Gov. Rick Scott ahead of Nelson by 0.14 percentage points.

Also, the election won't be certified until Tuesday, even though the machine recount may essentially bring a conclusion to the governor's race, where Republican Ron DeSantis leads Democrat Andrew Gillum by 0.41 percentage points in unofficial results.

Nelson, a three-time incumbent, has defended his legal strategy that resulted in Walker's ruling, saying in a statement Wednesday that "it remains the most important goal of my campaign to make sure that every lawful vote be counted correctly in this Senate race, and that Floridians' right to participate in this process is protected."

Republicans, however, say in their own lawsuits and motions that Democrats are trying to change the rules after the voting didn't go their way.

"We will continue to fight to defend Florida law and uphold the will of the voters," said Chris Hartline, a spokesman for Scott.

Another hearing was under way in Walker's court on Thursday as six lawsuits remain pending in Tallahassee.

Nelson and Democrats had wanted Walker to order the counting of all mail-in ballots rejected for a mismatched signature, arguing that local election officials aren't handwriting experts.

Walker said he could not go along with that suggestion.

"Let this court be clear: It is not ordering county canvassing boards to count every mismatched vote, sight unseen," Walker wrote in his 34-page ruling. "Rather, the county supervisors of elections are directed to allow those voters who should have had an opportunity to cure their ballots in the first place to cure their vote-by-mail and provisional ballots now, before the second official results are fully counted. This should give sufficient time, within the state's and counties current administrative constraints, for Florida's voters to ensure their votes will be counted."

Lauren Schenone, a spokeswoman for Scott, called Walker's ruling "baseless" and said they were "confident" it would be overturned by the Atlanta-based appellate court.

The developments are fueling frustrations among Democrats and Republicans alike. Democrats want state officials to do whatever it takes to make sure every eligible vote is counted. Republicans, including President Donald Trump, have argued without evidence that voter fraud threatens to steal races from the GOP.

Just when state officials will get recount results from all counties remains unclear. Tallying machines overheated earlier this week in Palm Beach County. That caused mismatched results with the recount of 174,000 early voting ballots, forcing staffers to go back and redo their work.

The county's Supervisor of Elections Susan Bucher said the machines underwent maintenance right before the election, but "I don't think they were designed to work 24/7."

More From KTEM-AM