A revised count of New York City mayoral ballots published on Wednesday showed Kathryn Garcia even closer to frontrunner Eric Adams than a botched tally on Tuesday that thrust the race into chaos.

The latest tabulation gave Adams, a retired police captain and Brooklyn borough president, 51.1 per cent of the vote, with Garcia, the former head of the sanitation department, at 48.9 per cent, unchanged from the previous count.

Yet the margin between the Democratic contenders shrank from 15,908 votes to 14,755 votes, with roughly 124,000 absentee ballots still to be counted.

The third-place candidate, Maya Wiley, said the election was “still wide open” and demanded every vote be counted.

The city’s board of elections released the recount on Wednesday evening with an apology after its extraordinary failure a day earlier led to about 135,000 ballots from a test run of the system being erroneously included in the tally. The blunder prompted outrage from the candidates and mockery from New York residents.

The board, no stranger to controversies and criticism, blamed “human error” for the error.

The election was the first in which the city is using ranked choice voting, giving each voter the option to list up to five candidates on their ballot in order of preference. The losing candidates are eliminated in successive rounds, with their votes reallocated until only two finalists remain.

“Yesterday’s ranked choice voting reporting error was unacceptable and we apologise to the voters and to the campaigns for the confusion,” two members of the board, president Frederic Umane and secretary Miguelina Camilo, said. “Let us be clear: [ranked choice voting] was not the problem, rather a human error that could have been avoided.”

The board insisted that new layers of review had been introduced and that it could report with “certainty” that the latest tabulation was accurate.

Garcia, a pragmatist whose campaign enjoyed a late surge, said: “While we remain confident in our path to victory, we are taking nothing for granted and encourage everyone to patiently wait for over 124,000 absentee ballots to be counted and included in the ranked choice voting tabulation.”

It was the Adams campaign that discovered on Tuesday night that more than 100,000 additional votes appeared to have been added to the count since election night a week earlier.

His campaign noted that he had been ahead on election day, adding: “There are still absentee ballots to be counted that we believe favour Eric — and we are confident we will be the final choice of New Yorkers when every vote is tallied.”

Adams appeared to have a commanding lead on election night, with 31.8 per cent of voters ranking him as their first choice. He was trailed by Wiley, a former lawyer for Mayor Bill de Blasio and the leading progressive candidate, with 22.2 per cent. Garcia was in third place at 19.3 per cent.

But Garcia benefited as ballots went through the ranked choice process. She overtook Wiley by just 347 votes after entrepreneur Andrew Yang was eliminated from the race and his ballots redistributed. Wiley’s elimination gave Garcia another boost.

The election has been regarded as the most consequential in a generation for New York City as it tries to recover from a pandemic that has killed more than 33,000 residents, levelled small businesses and torn at the city’s social fabric.

It has also been being closely watched beyond America’s largest city as an indication of the broader struggle between the Democratic party’s moderate establishment and a rising progressive wing.

Whichever candidate wins the Democratic primary is almost certain to prevail in a general election in November given the city’s overwhelming number of Democratic voters.