Eric Adams remained on track to become New York City’s next mayor after a count of absentee ballots released on Tuesday evening showed him maintaining a slim lead over fellow challengers in the Democratic party primary.

According to the board of elections’ latest tally, Adams, the Brooklyn borough president and retired police captain, had a 50.5 per cent to 49.5 per cent lead over Kathryn Garcia, the former head of the sanitation department. They were separated by 8,426 votes, with only about 3,700 outstanding. Maya Wiley, the leading progressive candidate, came third.

In a statement, Adams said: “While there are still some very small amounts of votes to be counted, the results are clear: an historic, diverse, five-borough coalition led by working-class New Yorkers has led us to victory in the Democratic primary for mayor of New York.”

The results were unofficial and may still be challenged, but the Associated Press called the primary for Adams on Tuesday night. Various campaigns threatened legal action after an extraordinary blunder by the board led to a mistaken count a week ago and threw the city’s first ranked choice election into disarray.

The board blamed that mistake, in which 135,000 “test” ballots were included in its count, on human error and pleaded for forgiveness.

Adams, who would be the city’s second black mayor, after David Dinkins, ran as a moderate uniquely capable of using the police to tackle soaring gun violence and hate crime while at the same time reforming the department. Both he and Garcia, who showed a late burst of support, rejected progressive calls to “defund” the police.

Given New York City’s overwhelming number of Democratic voters, the winner of the party’s primary is widely expected to prevail in November’s general election.

Under the ranked choice system, voters were allowed to select up to five candidates on their ballot in order of preference. Losing candidates would be knocked out and their votes successively reallocated until only two challengers remained.

Adams came first after the initial ballot, but his lead shrank to just 15,908 votes after the results of the sorting process were announced last week. When they were corrected a day later, his gap with Garcia was just 14,755 ballots, with about 124,000 absentee ballots to be counted.