The buildup to New York’s mayoral primary was dramatic: It was a pandemic-pocked campaign with plenty of late-stage mudslinging, a surprising alliance and a large turnout.

Now, the city must wait.

With nearly 800,000 Democratic votes counted by midday Wednesday, Brooklyn Borough President Eric Adams maintained a comfortable lead in the city’s inaugural ranked-choice election, with nearly 32 percent of first-choice votes for the nomination. But the race is not over — far from it, say Adams’s closest competitors.

Tens of thousands of absentee ballots must still be counted — and the combination of those and the new electoral system means that final results will not be available for weeks. Experts say it is difficult to extrapolate whether the early positioning will hold over the remainder of the count, with voters’ choices still unknown.

Adams, who would be New York’s second Black mayor, celebrated as polls closed Tuesday night, telling a crowd that “the little guy won today.”

But as the tally continued Wednesday, the candidates in second and third — civil rights attorney Maya Wiley and former city sanitation commissioner Kathryn Garcia — asked a place famous for its high-octane politics to exercise patience.

“We now must count every vote,” Wiley said at a brief news conference outside a subway station in Brooklyn. “Every single person who showed up at these polls needs to know their vote counts and that ranked-choice voting is important to our democracy.”

Wiley, who had about 22 percent of first-choice votes Wednesday, asked residents to “wait patiently.” Garcia, who trailed Adams and Wiley at 19.5 percent, was the final candidate with a path to victory after the first round of counting. On Twitter, she said the ranked-choice system “will take time, but it’s worth the wait because this process expands your vote and your voice.”

The city’s system allows voters to list up to five candidates in order of preference. If no one receives more than 50 percent of first-choice votes, the last-place candidate is eliminated and that person’s votes are redistributed to whoever those voters ranked second. In New York, this process repeats until two candidates remain. Whoever has more votes in the final round wins.

No Democratic mayoral candidate was expected to claim an outright majority on Election Day, but because of New York City’s strongly Democratic bent, the eventual primary winner is likely to be elected mayor in November. (The winner will face talk-show host Curtis Sliwa, who was projected to win the Republican primary.)

Historically in ranked-choice elections, the candidate who leads after the first round usually ends up winning. Sean McElwee, executive director of the liberal think tank Data for Progress, said that Adams will most likely prevail but that a number of factors could make the count interesting.

McElwee said the New York race has characteristics of a long-shot scenario in which a candidate comes from behind in subsequent rounds of voting. For one, he said, Wiley and Garcia have some overlapping constituencies and a large number of either candidate’s voters may have picked the other as their second choice.

Then, there is the potential impact of 2020 presidential candidate Andrew Yang’s 11th-hour campaigning with Garcia. Yang, who was the fourth-place finisher and conceded on Tuesday, encouraged his voters to select Garcia as their second choice.

“Adams is very favored, but weird things happen in ranked-choice voting,” McElwee said. But, he added, “in most worlds, he wins this.”

Adams built the bulk of his lead outside of Manhattan, the only one of the five boroughs where he was not leading Wednesday. If Wiley or Garcia is to overtake him, they will need help from the large number of outstanding absentee ballots. According to the New York City Board of Elections, more than 100,000 absentee ballots had been submitted but not yet counted, and as many as 107,549 could still be returned — as long as they are postmarked by June 22 and arrive by June 29. Adams’s lead stood at just over 75,000 votes.

McElwee said Wiley and Garcia need those absentee votes to be “traditional absentees,” from voters who are “a little older, more educated, more Manhattan than average.”

He said the allocation of votes was difficult to predict because voters do not always behave like “highly ideological actors.”

John Mollenkopf, director of the Center for Urban Research at the City University of New York Graduate Center, said that as votes are reallocated, he expects Adams to draw closer to 50 percent, “but whether he makes it there or not is unclear.”

“The question is: Are the seconds going to be distributed roughly the same way the firsts were?” Mollenkopf asked. “If they are, he’s in a good position.”

If not, he said, Wiley or Garcia may be able to make up ground quickly.

Adams’s standing in the outer boroughs showed that he “put together a Black-Latino coalition pretty successfully.” But, Mollenkopf said, he may need to get votes beyond that base to win.

As the coronavirus receded in the city, public safety became the campaign’s central issue. Adams, a former police officer, sought to position himself as the race’s law-and-order candidate. It is too early to tell, Mollenkopf said, but there are signs that it was not “quite the driving message that some people assumed it was going to be.”

Wiley, the only leading candidate arguing for cuts to the New York Police Department’s budget, appeared to outperform public opinion polls, which Mollenkopf said would not have happened had crime and policing been a “decisive wedge issue.”

Also on the ballot Tuesday were city, borough and other positions. So far, analysts say, the results do not fit neatly into any ideological narrative. While some may be tempted to cast an Adams victory as a blow to New York’s liberal political movement, McElwee said other races have confounded that view.

In the Democratic race for Manhattan district attorney — a county position not decided by ranked-choice voting — former state prosecutor Alvin Bragg narrowly led over former federal prosecutor and self-funder Tali Farhadian Weinstein. A number of liberal advocates, including Preet Bharara, a former U.S. attorney for the Southern District of New York, had backed Bragg.

And in the contest for city comptroller, Brad Lander, a liberal city legislator endorsed by ­Rep. Alexandria Ocasio-Cortez (D-N.Y.), was leading City Council Speaker Corey Johnson by nearly 10 points after the first round of voting.

Turnout in this year’s election was on track to far outstrip 2013, the last time there was an open Democratic mayoral primary. That year, nearly 700,000 New Yorkers voted. The state’s governing Democrats expanded absentee and early voting for the 2021 contests, and it is possible that once all absentee ballots are returned, the turnout will exceed even last year’s Democratic presidential primary, when more than 844,000 people voted.

With the tally still underway and five boroughs on edge, candidates were in an unusual position on the day after the election. Instead of continuing their campaigns in a traditional runoff scramble, some were defending the ranked-choice process itself, ensuring the city’s voters that, even though it will take a while, every ballot will be counted.

At her Wednesday news conference, a reporter asked Wiley whether Rep. Hakeem Jeffries (D-N.Y.), a key endorser, and others did Wiley “a disservice” by publicly announcing they would pick Adams as their second choice.

“No,” she said. “I don’t think they did me disservice, because I don’t think you can do anyone a disservice by doing democracy.”

David Weigel and Jada Yuan contributed to this report.