Even as a coronavirus outbreak has upended the White House, Democrats and Republicans have been gaming out another potential crisis that experts agree could plunge the country into unprecedented turmoil: a contested election in the weeks after Nov. 3.

House Speaker Nancy Pelosi (D-Calif.) has recently spoken in multiple meetings about preparing for a situation in which neither candidate attains the 270 electoral votes needed to win the presidency, according to multiple Democrats familiar with her remarks — a historic development that would throw the outcome to the new Congress in January.

She has also directed some of her members to be ready if GOP legislatures in states with narrow margins or unfinished counts seek to appoint their own electors, a situation Democrats hope to head off with an obscure law from the 19th century that allows Congress to intervene.

The internal talks are among a number of strategy sessions taking place in political and legal circles in anticipation of a post-Election Day fight. The campaigns of President Trump and former vice president Joe Biden are preparing for all scenarios, each amassing robust legal teams to prepare for post-Nov. 3 disputes, in addition to monitoring Election Day activity and ballot counting.

An uncharted battle over who the next president will be, after a campaign that has roiled and exhausted Americans, could severely test the nation’s faith in its election system — and undermine the principle that the president should be selected by voters rather than Congress or the courts, experts said.

“These are all terrible scenarios to contemplate,” said Richard H. Pildes, a professor of constitutional law at New York University. “Nothing is more explosive in a democratic system than a disputed election for the chief executive, because so much turns on who holds that office.”

Campaign operatives, election lawyers and constitutional scholars say there are several scenarios that could push the outcome of the White House race to Congress for the fourth time in history — or to the Supreme Court, as happened in the contested 2000 election.

While most agree such possibilities are slim, Trump has heightened concerns — and preparations — by repeatedly refusing to commit to conceding if he loses, while declaring that he wants the courts to play a role in deciding the race.

During the first presidential debate last week, the president repeated his unsubstantiated claims that voting by mail will lead to widespread fraud, adding that he wants the Supreme Court “to look at the ballots.”

“If it’s a fair election, I am 100 percent on board,” Trump said. “But if I see tens of thousands of ballots being manipulated, I can’t go along with that.”

Many legal and voting rights experts who have been studying the arcane rules that would govern a contested election say they are less worried about Trump refusing to concede if he loses decisively than they are about a complicated delay over disputed ballots.

Myrna Pérez, director of the Voting Rights and Elections Program at the Brennan Center for Justice, said she fears that there will be “no limits to the political hardball” and “no things that are off the table when people are trying to translate votes into political victories.”

“I wonder what that’s going to leave us with, if we don’t have any shared-upon norms, when there’s not a basic understanding that winning at all costs is not good for us,” Pérez said during a virtual panel discussion last week.

Biden’s continued strength in national and battleground-state polls has heartened Democrats, who are hopeful that he will win by such a large margin that it will be pointless for Trump to challenge the results.

“If Biden is going to have the kind of blowout victory we’re looking at, there are not really any constitutional ploys that could save Trump’s presidency,” said Rep. Jamie B. Raskin (D-Md.), who has been working alongside House Democratic Caucus Chairman Hakeem Jeffries (D-N.Y.) to look at all the possibilities.

Raskin said they are preparing for Republican “electoral-college pranks,” adding that the chances such tactics work “go up in an extremely close election.”

The Biden campaign declined to comment.

For its part, the Trump campaign said that its goal is for every “valid” ballot to count — and that Democrats are trying to “shred” election integrity.

“The Lawyers for Trump coalition, which grows daily, will rally support for President Trump as they lend their time and legal expertise to protect the integrity of November’s election,” Matthew Morgan, the Trump campaign’s general counsel, said in a statement. “Republicans are preparing every day for the fight and will be ready on Election Day and after.”

House Democrats are planning in conjunction with the Biden campaign, while the Trump campaign and Republican National Committee are leading efforts to monitor results, challenge ballots and litigate as necessary.

A spokesman for the National Republican Congressional Committee, Michael McAdams, declined to describe House Republicans’ plans. “We don’t publicly engage or comment on hypotheticals,” he said.

Counting votes

Strategists and scholars agree that the results of the White House race might not be available on election night if at least one pivotal battleground state has not finished counting mail ballots by then. Election officials across the country are experiencing a surge of mail ballots from voters seeking to avoid coronavirus infection at the polls.

Two key battlegrounds, Wisconsin and Pennsylvania, do not permit local election officials to begin processing mail ballots until Election Day. During Pennsylvania’s June primary, some counties were still counting ballots more than two weeks after voting had ended.

And roughly two dozen states plan to allow ballots to arrive days after Nov. 3, including the key battlegrounds Michigan, Pennsylvania, Ohio, North Carolina and Iowa. In Michigan, the deadline is Nov. 17. Depending on the overall electoral count, a close race in any of these states on Election Day could leave the overall outcome uncertain until most ballots are received.

Even in states where counting is completed on Nov. 3, a very close margin is likely to prompt the campaigns to scrutinize ballots for opportunities to challenge their eligibility, over issues such as signature matching, witness signatures or the use of an outer security envelope where one is required.

Both sides are prepared to take such challenges to court, a scenario that could again put the Supreme Court in the position of effectively deciding the outcome of the election, as it did in the 2000 contest between George W. Bush and Al Gore.

Congress’s role, meanwhile, will hinge on whether any difference-making disputes remain unresolved by Dec. 14, when all states’ electors are required to cast their votes.

In the first scenario in which Congress could decide the election, neither candidate is able to reach the 270 electoral votes needed to claim victory, triggering a provision in the Constitution’s 12th Amendment sending the decision to Capitol Hill.

Under that exceedingly rare scenario, which has happened only twice in U.S. history, the House would choose the president, and the Senate would select the vice president. Federal law sets such a “contingent” election for Jan. 6, after the new Congress is seated.

A 269-to-269 tie in the electoral college is among the circumstances that would prompt such a contingency — though scholars and election modelers say that even in a close election, the odds of such an outcome are extremely low. A narrow electoral-college vote of 270 to 268 could also be thrown into a tie by a “faithless elector” — an elector who votes for someone other than their party’s nominee. No presidential outcome has ever been determined by a faithless elector.

Alternately, a winning candidate could die after Nov. 3, freeing his electors to vote for someone else and potentially dividing them among multiple choices.

Courts have ruled that electors can be forced to take pledges to support their party’s nominee, and earlier this year the Supreme Court said electors can be legally bound by that pledge. However, not all states have adopted the kind of binding law that the high court approved, leaving the electoral college as a whole still vulnerable to the whims of a faithless elector.

Trump’s battle with the coronavirus over the past week has prompted discussions about such a scenario, several scholars said.

In the case of any of those scenarios forcing a contingent election, each state delegation in the House would receive a single vote, meaning a candidate would need 26 votes out of 50 to win the presidency.

Republicans currently control 26 delegations, and Democrats control 22. That is one of the reasons Pelosi has been so focused in recent weeks on trying to flip GOP-led delegations or take control of tied ones, so the House would have the votes to elect Biden if necessary.

During a phone call last week with Democrats, she identified her targets as Alaska, Montana, Pennsylvania, Florida and Michigan — states where she is directing campaign funds and seeking donors to do the same, according to people familiar with the call.

Flipping a single delegation would block Trump from having the 26 delegations needed for the win in the House.

“The speaker, as an extreme precaution, is raising consciousness about how this works,” said Rep. Gerald E. Connolly (D-Va.). “She’s reminding Democrats that we need to win as many state delegations as possible in this election cycle.”

Pelosi told reporters last week that “what we hope to accomplish is to send a very clear message on Election Day to the president: There ain’t no light at [the end of] the tunnel for you in the House of Representatives.”

“So don’t cause chaos because you think it will lead to a light at the end of the tunnel,” she added, “because that light at the end of the tunnel in the House is going to be a train coming right at your plans.”

Date to watch: Dec. 14

The House has chosen the president this way only twice — in 1801 and 1825.

A more likely scenario, scholars say, is the popular vote remaining in dispute, or uncounted, in one or more states by Dec. 14, the date when all electors in the electoral college are required to meet and vote.

“The way things could go very sideways is if the election starts turning on narrow margins of late-counted mail-in ballots in swing states,” said Lawrence R. Douglas, a legal scholar at Amherst College and author of the book “Will He Go?: Trump and the Looming Electoral Meltdown in 2020.”

Federal law empowers state legislatures to step in and appoint electors if an election has “failed” to produce a result. But what constitutes a “failed” election is the subject of much dispute — one of dozens of reasons so many of these scenarios would be likely to wind up in court.

Consider what could happen if the race comes down to Pennsylvania, where Republicans control the legislature and Gov. Tom Wolf is a Democrat. If Trump is ahead in the state as Dec. 14 approaches but outstanding ballots are expected to favor Biden, “that would create an opportunity for the state legislature to say: ‘We have to act. We can’t wait for this, so we’re going to certify Trump based on the returns we have in our hands,’ ” Douglas said.

In turn, if additional ballots were then counted, putting Biden ahead, the executive branch might subsequently certify Biden as the winner and seat his electors. If that happened, two rival sets of electors could meet and vote on Dec. 14 — because not doing so would mean missing the deadline and effectively forfeiting the election, several scholars said.

At that point, an obscure 19th-century law called the Electoral Count Act lays out the role for Congress. The act, which was passed after states submitted competing slates of electors in the contested presidential election of 1876, gives Congress the power to settle state-level disputes with a vote in both chambers to decide which candidates’ electors will be recognized.

The law is widely regarded by scholars as confusing. If it is invoked, litigation is almost guaranteed, said Edward B. Foley, a professor of constitutional law at Ohio State University. But Foley said he was doubtful that the Supreme Court would take such a consequential case involving Congress’s constitutional powers.

The Electoral Count Act would come into play if states with divided governments — in which one party controls the legislature and the other controls the governorship — submit rival sets of electors.

Pennsylvania is one of four key battlegrounds, along with Wisconsin, Michigan and North Carolina, that have Republican-led legislatures and Democratic governors. All have recent histories of exceedingly close elections.

The Electoral Count Act has never been tested in a rival-electors scenario. The 2000 battle over Florida between Bush and Gore came close, but the Supreme Court ended a recount in that state on Dec. 12, allowing election officials to certify the results for Bush and seat his electors, who cast their electoral votes ahead of the deadline.

Unlike a contingent election, resolving a dispute over seated electors for the presidency falls to the entire Congress, not just the House. If Republicans retain control of the Senate in the new Congress and Democrats do the same in the House, then the two chambers could deadlock over such disputes. In that case, scholars said, the electors seated by a state’s executive branch — its governor or secretary of state — would prevail over those seated by the state legislature (though that scenario, too, would be likely to prompt litigation).

If the decision does go to Congress, many smaller variables could play a role, and lawyers for the campaigns are studying all of them. If Sen. Kelly Loeffler (R-Ga.) fails to win a majority in her special election on Nov. 3, for instance, a runoff election could preclude her being seated in January — giving Democrats an edge in that chamber, depending on how many other seats they win or lose.

Another possibility: Neither candidate reaches 270 electoral votes, the decision goes to the House, and the House’s state delegations deadlock at 25 to 25. If the House is unable to choose the next president, under the 12th Amendment, the Senate’s choice for vice president becomes the acting president until the House can resolve its differences.

If the Senate deadlocks, too, and no president is selected by Inauguration Day, Jan. 20, the speaker of the House, upon resigning the speakership and the seat in Congress, becomes acting president until the dispute is settled.

Foley noted with some optimism that none of the post-election crisis scenarios he has been studying for much of his career is likely to happen.

“This specialty is like hurricanes or pandemics,” he said. “You never want disasters to happen, and this is an electoral disaster. We avoid this if, on December 14, in each and every state there is just one set of electors chosen by the popular vote.”