RIVIERA BEACH, Fla. — A manual recount in the Florida Senate race was ordered Thursday by the secretary of state after Gov. Rick Scott, a Republican, marginally increased his lead over Democratic Sen. Bill Nelson in a machine recount.

Scott leads Nelson by 12,603 votes — or about .15 percent — which is less than the .25 percent margin he would have needed to forestall a hand recount. But there won't be a manual recount of the governor's race, in which Republican Ron DeSantis is ahead by about 34,000 votes — or .41 percent — after the machine tally.

Under the order, Florida's counties have until Sunday at noon to complete manual recounts of "over-votes" and "under-votes" — where machines interpreted that the voter either marked multiple candidates in one race or voted in some races and not others, or had marked the ballot in an ambiguous way that didn't indicate a clear preference for a candidate.

There are believed to be tens of thousands of ballots statewide that will need to be closely examined.

While most of Florida handled the machine recount with little fanfare, the state's second- and third-largest counties, Broward and Palm Beach, failed to meet the 3 p.m. Thursday deadline. Susan Bucher, the supervisor of elections for Palm Beach County, said mechanical issues hobbled the process.

Bucher said the deadline passed despite a "heroic effort" by her staff. As a result, the results Palm Beach County originally reported to the state — not those from a machine recount — stood. The state's election results are to be certified by Tuesday.

In Broward County, election officials thought they had sent machine-tabulated totals to the state in time but missed the mark by two minutes, prompting the secretary of state to reject the results.

In Palm Beach County, there are roughly 5,900 ballots for which an over- or under-count could affect the Senate race totals, according to Bucher. Manual recount tables already had been set up on folding tables at a warehouse here in South Florida by the time Bucher spoke.

"The reality is that we were very close two nights ago and then our machines went down. It's not for lack of human effort," Bucher had said earlier in the day, referring to an overheating issue with the county's out-of-date equipment.

On the eve of the deadline Wednesday night, ballot-counting machines sat idle and the counting floor sat empty for hours, even as other counties' offices have hummed with activity 24/7.

Bucher had said earlier Wednesday that the machines were working again, but by sundown, she waved away reporters who asked why none of them were running before climbing into her black Mercedes and driving away from the facility at around 9 p.m.

Miami-Dade, the state's largest county, completed their recount a day and a half ahead of schedule, while officials in neighboring Broward County, which has had its own problems, was among the counties that made the Thursday deadline.

Bucher said her team had expected a quiet midterm election and did not anticipate the need to run the county’s machines, manufactured by a now defunct company, all day and night during a multi-race recount.

The county has set aside more than $11 million to purchase newer machines, but Bucher said she had been waiting for the state legislature to tweak a new law that she says, once it goes into effect in two years, would make the new machines obsolete.