Florida’s election torment is set to continue after officials ordered a hand recount of ballots in the knife-edge US Senate race between the Republican Rick Scott and the Democrat Bill Nelson.

After a troubled machine recount finished on Thursday, Scott had a lead of 12,603 votes, or 0.15 percentage points – within the threshold of 0.25 points that by state law triggers a manual recount.

But the eagerly watched and acrimonious race for governor appeared to be over, with the Republican Ron DeSantis virtually assured of victory over Democrat Andrew Gillum, according to unofficial results posted on the Florida secretary of state’s website. Gillum, bidding to become the state’s first African American governor, did not have enough votes to force a manual recount.

Scott, currently the state’s governor, tweeted: “With the statewide machine recount finished, our margin of victory has increased by nearly 1000 votes. @SenBillNelson, it’s time to admit this race is over.”

But there was no sign of Nelson throwing in the towel. His lead campaign lawyer, Marc Elias, announced a lawsuit against Palm Beach county, which failed to meet the recount deadline due to malfunctioning equipment.

“We have sued Palm Beach County and the Florida Sec of State to require a hand count of all ballots in the county due to systematic machine failure during the machine recount,” he tweeted.

Elias also noted that Hillsborough and Broward counties were reporting incomplete results. “We are monitoring the situation but we will take steps to ensure that every lawful vote is counted.”

As chaos reigned, it emerged about three hours after the 3pm machine recount deadline that the heavily populated and Democratic-leaning Broward county had also missed the deadline – by two minutes - meaning the frantic process there was for naught.

The county had previously claimed a successful recount, with Brenda Snipes, the county’s widely criticised elections supervisor, initially telling reporters: “We are excited to be at this point.”

The Florida secretary of state will now use the first count totals from Palm Beach and Broward. Neither county’s recounts produced a substantial change from the first count. But if the final statewide result narrows down to a few thousand votes, the blunders could prove costly and prompt yet more legal challenges.

In a mark of the confusion prevailing in Florida for the past eight days, Snipes also admitted that the total included 23 invalid provisional ballots that were mistakenly mixed in with valid ones and were now impossible to separate.

The drawn-out recounts will drag into the weekend and have revived uncomfortable memories of the disputed 2000 presidential election between George W Bush and Al Gore, which ended only after the US supreme court stopped the counting and in effect put Bush in the White House.

About 8 million people voted in Florida’s midterm elections. Initial counts before the recount showed Scott with a narrow lead over incumbent senator Nelson.

On Thursday, the US district judge Mark Walker in Tallahassee cleared the way to include ballots from as many as 5,000 people across the state who submitted ballots by mail that were rejected by election officials.

Counties have until Sunday to inspect the ballots that did not record a vote when put through the machines. Those ballots are re-examined to see whether the voter skipped the race or marked the ballot in a way that the machines cannot read but can be deciphered. The election will be certified on Tuesday, a full week after the election.

In a conference call with reporters, Elias acknowledged Nelson’s deficit is now roughly the same as it was going into the machine recount.

He remains confident the gap will disappear, however, after winning a lawsuit over the inclusion of some postal and other ballots, and he believes the hand recount will also boost Nelson.