Eric Adams, a retired black police captain who has promised to restore order to New York City’s streets, stormed to an early lead in the city’s Democratic party mayoral primary, while entrepreneur Andrew Yang’s efforts sputtered.

Sandwiched between them in a virtual tie were Maya Wiley, a progressive Democrat, and Kathryn Garcia, a moderate — either of whom would be the city’s first female mayor.

The election has been billed as New York’s most consequential in a generation as America’s most populous city attempts to recover from a coronavirus pandemic that has killed more than 33,000 of its residents, decimated its small businesses and exposed deep-rooted social and racial inequalities.

It has also featured a showdown between the Democratic party’s progressive and moderate wings.

A victory for Adams, viewed as a law-and-order moderate, would be a blow to the left wing of the party, which sees the mayoral election as a referendum on many of its biggest priorities including calls to “defund the police”.

Liberal stars such as Alexandria Ocasio-Cortez had endorsed Wiley and hoped to put their stamp on the city’s political agenda. But progressives’ momentum stalled as rising crime rates played into the hands of Adams, who has promised to put more police on the streets.

It also appears to have benefited Garcia, who campaigned as a can-do pragmatist capable of fixing a metropolis following the term of unpopular incumbent Bill de Blasio.

At 11:30pm, with 90 per cent of votes counted, Adams, the Brooklyn borough president, had a commanding lead with just over 30.8 per cent of the vote, according to the Board of Elections.

Wiley, a former counsel to de Blasio who has promised to strip $1bn from the police department budget, stood at 21.6 per cent, while Garcia, the former head of the sanitation department, had 20.4 per cent.

Yang, an affable outsider who made his name with a long-shot bid for the Democratic presidential nomination, had enjoyed frontrunner status for months. But early results showed him stuck at just 11.6 per cent, confirming a drop off in his campaign as election day neared.

“I am not going to be the next mayor of New York City, based upon the numbers that have come in tonight,” Yang told supporters as he conceded the race.

Ray McGuire, a former Citigroup vice-chair who raised huge sums from Wall Street and promised to bring a business executive’s eye to City Hall, polled a mere 2.4 per cent.

It could be weeks before a winner is crowned, as the city awaits the arrival of mail ballots. It is also debuting a ranked choice voting system, in which voters can list their preferences from one to five. Losing candidates are eliminated and their votes redistributed until a winning candidate crosses the 50 per cent threshold. The system has introduced a level of uncertainty not present in previous contests.

Although Tuesday’s vote was a party primary, the winner is widely expected to prevail in November’s general election, given the city’s overwhelming majority of Democratic voters.