By GARY FINEOUT and BRENDAN FARRINGTON, Associated Press

TALLAHASSEE, Fla. (AP) — A federal judge slammed Florida on Thursday for repeatedly failing to anticipate election problems, and said the state law on recounts appears to violate the U.S. Supreme Court ruling that decided the presidency in 2000.

"We have been the laughing-stock of the world, election after election, and we chose not to fix this," U.S. District Judge Mark Walker said in court.

Walker vented his anger at state lawmakers but also Palm Beach County officials, saying they should have made sure they had enough equipment in place to handle this kind of a recount. Walker also said he's not happy about the idea of extending recount deadlines without limit.

The overarching problem was created by the Florida Legislature, which Walker said passed a recount law that appears to run afoul of the 2000 Bush v. Gore decision, by locking in procedures that don't allow for potential problems.

A total of six election-related lawsuits are pending in Tallahassee. Earlier Thursday, Walker ordered that voters be given until 5 p.m. Saturday to show a valid identification and fix their ballots if they haven't been counted due to mismatched signatures.

Florida's 67 counties have faced a 3 p.m. Thursday deadline 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. If these voters can prove their identity, their votes will now be counted and included in final official returns due from each county by noon Sunday.

Meanwhile, the ongoing recount threatens to stretch into the weekend. The election supervisor in Palm Beach County, a Democratic stronghold, 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.

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."