Maryland overwhelmingly voted for Democratic presidential nominee Joe Biden, returned eight congressional incumbents to Congress, and appeared poised to approve a statewide measure to legalize sports betting, according to preliminary election returns.

Clad in masks and face shields, Marylanders oscillated between feelings of anxiety and determination as they headed to the polls earlier in the day, performing an Election Day ritual made fraught by the pandemic, the president’s allegations of voter fraud and rumblings of post-election unrest.

By the end of the night, more than 2.8 million Marylanders had voted, narrowly exceeding the total in 2016. The vast majority of people — 2.3 million — had cast their ballots before Election Day through early voting or mail-in voting.

On Wednesday morning, more than a million votes were still not counted. They included at least 30 percent of the approximately 1.3 million mail-in votes, along with Election Day ballots at the vast majority of vote centers in Maryland’s most populous jurisdictions: Montgomery, Prince George’s, Baltimore and Anne Arundel counties and Baltimore City.

The huge counting slowdown was because of the shift from neighborhood precints to county-vote centers, officials said. Vote-counting software wasn’t designed for the switch, and larger counties were forced to use a cumbersome manual override process to tabulate votes. Officials said those jurisdictions might not be able to finish the process on Wednesday.

Statewide, the first results were not posted online until around 11 p.m. Tuesday, because of long lines in rural Calvert County that kept the polls there open until after 10 p.m. By morning, unofficial returns showed Biden with a 30-point lead over President Trump. Maryland’s eight congressional incumbents all won decisive victories over their challengers, including Rep. Kweisi Mfume (D), who led Trump-backed Kimberly Klacik (R) by nearly 45 percentage points in the Baltimore-based 7th District.

Measures to legalize sports betting and shift control of the state budget appeared popular, with a majority of tabulated votes indicating approval.

In Baltimore, Brandon M. Scott (D), 36, looked set to become the city’s youngest mayor, while in Montgomery County, voters leaned toward passing two county-backed ballot initiatives that would change property taxes and the council’s structure. There were also some local school board and municipal races.

Deep-blue Maryland, which has 10 electoral college votes, had been expected to vote for Biden.

Results were initially less certain for down-ballot initiatives, such as the proposal to legalize sports betting. Gambling companies spent millions supporting the measure, which lawmakers say could generate up to $40 million in tax revenue for public education. But polling from February showed Marylanders deeply divided on the issue.

In the nine days of in-person voting, those who flocked to the polls in the heavily Democratic suburbs bordering Washington were mostly focused on one task: getting rid of the incumbent president.

“He needs to go,” said Gladis Richardson, 63, who waited in line for more than an hour on a broken ankle to vote for Biden in Prince George’s County. “I’m excited about Joe, and the man could not be worse than what we have now.”

In neighboring Montgomery County, Dijana Trajkovic, 42, said her plan to vote against Trump was four years in the making. Originally from Bosnia, Trajkovic applied for citizenship days after Trump was elected with the express aim of voting him out of office. She had moved to the United States 16 years ago but never felt urgency to become a citizen until 2016, she said.

Not all voters made up their minds about Trump four years ago. Some said they were apolitical or disenchanted during the last election, but became driven to participate this year because of Trump’s record. Biden supporters cited the president’s insults toward military veterans, his crackdown on immigrant communities and his handling of the coronavirus crisis; Trump supporters pointed to his foreign policy, which they see as effective.

“The guy gets stuff done,” said Tim Dull, a Republican in Howard County who said he voted for Trump this year but not in 2016. “Peace in the Middle East, nobody said he could do it,” said Dull, 64. “Nobody pushed back on the Chinese until he did.”

David Rucker, 51, said he was among the 1.4 million eligible voters in Maryland who sat out the 2016 election. He had “trust issues” with both candidates, he said, but has since grown increasingly alarmed by Trump’s proposals to overhaul Social Security.

“Hopefully this makes a difference,” Rucker said before casting his vote for Biden.

Sandra Anaya O’Brien, 56, and her daughter Isabel O’Brien, 18, also held out hope that their votes would matter as they left a polling site in Silver Spring on Friday. As Trump supporters, they know they are a minority in liberal Montgomery County and try to avoid airing their political views in public. But amid such a divisive election, the older O’Brien said, they wanted their votes to show that Montgomery is not as monolithic as some might assume.

“It’s important that people know we live here,” she said. As an immigrant from El Salvador and a devout Catholic, O’Brien said, she balances her ambivalence toward Trump’s immigration policies with her support of his antiabortion views.

When it comes to the U.S. House, all eight incumbents in Maryland — seven Democrats and one Republican — were expected to pull off reelection smoothly.

The race in the 7th District, formerly represented by Rep. Elijah E. Cummings, garnered national attention after one of Klacik’s provocative campaign ads went viral, earning her a speaking slot at the Republican National Convention. But Mfume, a seasoned figure in Maryland politics, beat her with nearly 75 percent of the vote during a special election in April and was expected to defeat her again.

A 45-year-old woman who went by the name Queen said before voting in Baltimore on Monday that she was undecided on the presidential election but supported Mfume.

“I have only seen or heard from Kimberly Klacik for the past three months,” she said. “And while I have some issues with Mfume, he graduated from Morgan [State University] and knows this community.”

More than the presidential or congressional races, the statewide measure to approve sports betting drew divided perspectives from voters at the polls.

Potomac residents Shruti and Frank Abbato, 48 and 47, both voted for Biden but were split on sports betting.

Shruti Abbato approved of legalization because she had read that the generated tax revenue would help pay for an elaborate but expensive plan to revamp the state’s public school system. Her husband disagreed: “Gambling distributes money from the poor to the rich,” he said. “I’m against that.”

After a 2018 Supreme Court ruling, dozens of jurisdictions across the country have legalized sports betting, including D.C., Virginia and West Virginia.

Voting in Rockville on Election Day, Nathan Barash, 31, said Maryland could lose business and tax revenue by keeping sports betting illegal.

“If people want to bet, then they’re going to,” said Barash, who voted “yes” on the measure. “Those dollars are going to be spent somewhere. Why not here?”

Jorge Perez, president of MGM National Harbor in Prince George’s County, said the corporation spent $500,000 to persuade voters to approve the measure. Recent surveys suggest the effort was effective.

“It’s not a guarantee,” Perez said Monday. “But things are looking optimistic.”

In Montgomery, voters were also deciding on four local ballot initiatives. Questions A and B were competing proposals on how to calculate property taxes. Questions C and D were competing measures on how to change the structure of the council.

Current and former politicians led a broad coalition of groups to rally support for the council-backed options — Questions A and C — which appeared to prevail when early voting data was released. At the polls, however, many voters seemed undecided or unaware of all the ballot initiatives. Some said after voting that they indicated “yes” on all four questions, even though they presented conflicting proposals.

Stephen Kim, of Rockville, said he voted against both measures to change the council structure because he worried that they would add more red tape to the legislative process. While advocates say increasing the council size would improve representation for a county that has grown in population, Kim, 40, said, “That’s just a political tool.”

Council member Evan Glass (D-At Large), who spearheaded Question C, said it was unfortunate that the presidential election drowned out attention for down-ballot initiatives that have the potential to more directly affect residents.

Nonetheless, he added, “I will always put my faith in the voters … Ultimately, they’ll make the right decision.”

Erin Cox and Maya Smith contributed to this report.