New York City residents cast ballots in a Democratic primary Tuesday that will all but certainly select the next mayor tasked with shaping the post-pandemic future of America's largest metropolis.

Ex-policeman Eric Adams is the frontrunner in a diverse group of 13 candidates vying for the job often called "the second-most difficult" in the United States after that of president.

New York City Democratic mayoral candidate Eric Adams smiles during a event in Brooklyn on June 21, 2021, the eve of New York City's primary election day New York City Democratic mayoral candidate Eric Adams smiles during a event in Brooklyn on June 21, 2021, the eve of New York City's primary election day Photo: AFP / TIMOTHY A. CLARY

Voters headed to polls with Covid-19 still casting a long shadow over the Big Apple, the epicenter of America's early outbreak, and which has lost 33,000 people to the virus.

But the city is now coming back to life -- virtually all coronavirus restrictions have been lifted, and 66 percent of adults have received at least one vaccine dose.

A crowded field of progressives and moderates face off in a race made all the more uncertain by a new ranked-choice system of voting that has clouded all predictions.

Residents vote during the New York City mayoral primary election at the Brooklyn Museum polling station on June 22, 2021 in New York City Residents vote during the New York City mayoral primary election at the Brooklyn Museum polling station on June 22, 2021 in New York City Photo: AFP / Angela Weiss

The winner of the vote is unlikely to be known for several weeks.

Since New York is a Democratic stronghold, though, they are virtually guaranteed to win November's mayoral election against whomever Republicans choose as their candidate.

Residents vote during the New York City mayoral primary election at the Brooklyn Museum polling station on June 22, 2021 in New York City Residents vote during the New York City mayoral primary election at the Brooklyn Museum polling station on June 22, 2021 in New York City Photo: AFP / Angela Weiss

"There's a lot at stake here," said Columbia University politics expert Lincoln Mitchell, citing issues ranging from the post-pandemic recovery to climate change.

Unemployment, homelessness, shootings and homicides have all surged since the coronavirus struck. Thousands of businesses have closed, tens of thousands of wealthier residents have fled and most office workers are still working from home.

Progressive mayoral candidate for New York Maya Wiley campaigning in Brooklyn on June 21, 2021 Progressive mayoral candidate for New York Maya Wiley campaigning in Brooklyn on June 21, 2021 Photo: AFP / Ed JONES

The pandemic, demonstrations sparked by the murder of George Floyd in May 2020 and attacks on Asian Americans have also highlighted the extent of racial inequalities in the city of 8.5 million.

New York mayoral candidate Andrew Yang campaigns in Brooklyn on June 21, 2021 New York mayoral candidate Andrew Yang campaigns in Brooklyn on June 21, 2021 Photo: GETTY IMAGES NORTH AMERICA / Michael M. Santiago

New York's first new mayor in eight years will have to contend with projected budget gaps of several billion dollars each in the next few years.

They will succeed unpopular left-wing Democrat Bill de Blasio, who has been mayor since January 2014.

"It's time for a change," said Esther Rombaut, 48, after voting at the Metropolitan Museum of Art on Manhattan's Upper East Side.

"It's going to be critical for the next person to figure out what to do with fiscal policy and how to get our kids back in school," she added.

For Susan Green, a 74-year-old interior designer, one issue topped the others.

"New York needs law and order, and a great deal of it," she told AFP, before voting for tech entrepreneur Andrew Yang, a moderate who ran for president.

Yang, 46, led in polls for much of the campaign but went into primary day trailing 60-year-old Adams, who is also a moderate.

The Brooklyn borough president, who is Black, has put public safety at the forefront of his campaign.

Kathryn Garcia, another moderate, and Maya Wiley, a Black lawyer specializing in civil rights who was endorsed by progressive star Alexandria Ocasio-Cortez, are bidding to become New York's first woman mayor.

The new voting system, which asks voters to rank up to five candidates in order of preference, makes predictions almost impossible.

Unless a candidate immediately garners more than 50 percent of the votes -- an unlikely scenario -- the candidate who came in last is eliminated, and the ballots cast for them are redistributed to voters' second choice, and so on until a candidate finally exceeds the 50 percent threshold.

This may not produce a clear winner until mid-July.

More than 191,000 people voted during the nine-day early voting period that ended Sunday. Tens of thousands of absentee ballots will also need to be counted.