President Trump is signaling that Election Day could be followed by a stretch of uncertainty and chaos as a purge of top officials, legal challenges to election results and potential resistance to a normal transition cloud the prospects for an orderly post-election period no matter who wins.

Among the possible scenarios is a quick effort to fire or sideline Anthony S. Fauci, the nation’s top infectious-disease expert, whose prominence and increasingly pointed criticism of Trump’s handling of the coronavirus pandemic have angered the president.

Other federal health officials whose approach to the pandemic has frustrated the president also may be targeted, people familiar with the discussions say. That means the team leading the fight against the biggest public health challenge in decades could be reshuffled as Trump or Joe Biden bring in new leadership after the election.

Trump, speaking at a rally in Ohio recently, openly suggested that he might throw a wrench in the transition process if Biden prevails, making unfounded claims that his own transition was undermined.

“They ask me, ‘If you lose, will there be a friendly transition?’ Well, when I won, did they give me a friendly transition?” Trump said. “They spied on my campaign. They did all this stuff. That was not a friendly transition.”

Trump has also complained about mail-in voting, erroneously casting much of it as fraudulent and falsely claiming that it is unusual or dangerous to continue counting ballots after Election Day.

That has prompted a frustrated reaction from Biden. “What country are we in?” he said when Trump declined to commit to a peaceful transition. “Look, he says the most irrational things. I don’t know what to say.”

Biden’s team is preparing for the possibility that Trump, should he lose, would block hundreds of Biden officials from gaining access to government resources as required by law.

Top Biden transition members have discussed potential legal responses and are eyeing other ways, should Biden win the election, to begin what could be one of the most volatile transfers of power in American history, occurring at a moment when the economy is in shambles, coronavirus cases are on the rise and emotions are raw after a divisive election.

The Biden campaign has already spent months working closely with career civil servants in a process that happens every four years. For now, some of the ordinary machinery of a presidential transition is running, though it is shadowed by Trump’s comments.

The White House has placed Chris Liddell, a deputy chief of staff, in charge of the transition, according to several officials. Trump was reluctant to sign the administration’s formal transition papers, aides said, and does not like the idea of participating in a transition, believing it is bad karma. He agreed after being told it was statutorily required, but does not want publicity around the effort, the officials said.

There is a memorandum of understanding between the Biden campaign and the White House. The document is four pages and involves the typical minutiae — including agreements on space, lines of communication and non-public information. Liddell has also circulated materials about the transition to other aides, officials said.

“Liddell seems like a smart, competent guy,” said Chris Whipple, an author who recently met with White House officials. “He was very much involved in [Mitt] Romney’s preparations for a transition. But he’s working for someone who is not serious about a transition.”

Liddell told others earlier this fall that intelligence briefings for Biden’s team will not begin until after the election, an official with knowledge said. Through a spokesman, Liddell declined to comment.

“Trump is erratic and unpredictable. He could do anything,” said one person close to the transition process who, like others interviewed for this report, spoke on the condition of anonymity to comment on private discussions. “But so far they’ve taken this very seriously.”

Asked for comment on the transition, White House spokesman Judd Deere said: “The president will accept the results of a free and fair election. The Trump administration is following all statutory requirements.”

Whether he wins or loses, Trump is planning to cut a swath through his own administration’s senior leadership, officials said. He is contemplating replacing FBI Director Christopher A. Wray and Defense Secretary Mark T. Esper, along with a slew of officials at the public health agencies, they added.

Several officials said that if Trump wins, he is likely to replace much of his cabinet, and others are likely to depart on their own.

Polls suggest that Trump’s poor marks for his handling of the covid-19 crisis have caused him considerable political damage. Trump has complained during rallies that he would have had an easy path to reelection if not for what he calls the “China virus,” blaming governors, Congress, Democrats and sometimes his own aides.

The president offered a potential window into a post-election purge at a raucous rally in Florida on Sunday night. Trump stood by as the crowd in Opa-locka began chanting “Fire Fauci!”

Then he told the crowd, “Don’t tell anybody, but let me wait until a little bit after the election — I appreciate the advice.”

Trump later said Fauci was “a nice man,” but he claimed the veteran infectious-disease expert has been wrong about various aspects of the U.S. response to the crisis.

In a tweet Monday morning, Biden wrote, “We need a president who actually listens to experts like Dr. Fauci.” He suggested that he would hire Fauci and fire Trump.

It remains unclear how seriously Trump is considering dismissing Fauci, a career civil servant whose blunt assessments of the pandemic have sometimes angered the president but have gained him a large public following. Since Fauci is not a presidential appointee, Trump does not have the authority to directly fire him — he would have to go through the chain of command at the Department of Health and Human Services.

Francis Collins, director of the National Institutes of Health, would have to agree to fire Fauci, and Collins has said several times he would not fire or demote him.

Collins may also be in Trump’s crosshairs. One scenario might be to sack Collins and install an acting director who was willing to carry out the order to fire Fauci, said Max Stier, chief executive of the nonpartisan Partnership for Public Service.

“You want Dr. Faucis, and you want Dr. Faucis who will tell the truth even if it’s not exactly what the political leadership wants to hear,” Stier said.

If Trump does get rid of Fauci after an election loss, it is widely expected that Biden would hire him back to his post as director of the National Institute of Allergy and Infectious Diseases. Biden has said he would immediately reach out to Fauci and “ask him to continue his incredible service to our country.”

The fate of Health and Human Services Secretary Alex Azar remains uncertain, but several officials close to Trump believe Azar would be replaced in a second term. If Trump loses, however, Azar could remain on the job through the end of Trump’s presidency, in January.

Azar has survived some bumpy episodes with the White House, including Trump’s decision in late February to replace him with Vice President Pence as the leader of the government’s response to the coronavirus. Still, Azar talks to the president frequently — sometimes daily — about the pandemic and other health issues, according to a person close to the secretary.

While few secretaries at HHS, the government’s largest civilian agency, have remained in place for more than one term, Azar has made clear that he would welcome the ability to retain his job if Trump wins the election, said a person familiar with his thinking.

“It’s clear he’s interested in serving as long as his service is desired,” the person said. “He’s got items in the pipeline he wants to see through.”

In addition to Operation Warp Speed, the federal effort to help develop and distribute a coronavirus vaccine, these efforts include a push for changes in the health-care system, from pharmaceutical prices to greater transparency about medical costs.

Also potentially at risk, according to people familiar with the matter, are the heads of the Centers for Disease Control and Prevention and the Food and Drug Administration, which is leading the effort to develop a vaccine.

FDA Commissioner Stephen Hahn clashed with Azar over his decision to strip the FDA of its authority over certain coronavirus tests. Azar was furious about Hahn’s public apology in August for exaggerating the benefits of convalescent plasma — a covid-19 treatment that Trump had called a “historic breakthrough.”

The White House also was upset that Hahn did not block vaccine guidance written by career FDA staffers that made it virtually impossible to meet a key Trump demand — to clear a vaccine by Election Day. Staffers concluded that the timetable was necessary to ensure a safe vaccine, but Trump called the guidance a “political hit job.”

If he wins, Biden is expected to quickly create a transition task force focused on the pandemic. It would be made up of experts and people likely to take leading roles in the administration and would include subgroups focused on issues such as testing, personal protective equipment and vaccine distribution, according to two people familiar with the plans.

“Joe Biden will take immediate action to address the devastation caused by Trump’s failed leadership to manage the pandemic that’s killed over 230,000 Americans and infected more than 9.2 million,” said Biden spokesman Jamal Brown.

While Biden advisers say no final decisions have been made, Ron Klain, a senior Biden campaign adviser who served as the Obama administration’s Ebola “czar,” is expected to play a leading role in the covid-19 response if Biden wins. Jake Sullivan, a top policy adviser to Biden’s campaign, is also expected to be involved and is in line for a top job on health issues.

The next few months are a critical time for agencies fighting the pandemic, with the FDA probably deciding whether to approve one or more coronavirus vaccines.

The agency also is reviewing applications for a new treatment called monoclonal antibodies that Trump received when he was stricken with covid-19 last month. Trump has been telling audiences the therapy will be offered free to anyone who needs it, although it is not clear how he would do that.

Matt Viser, Laurie McGinley, John Hudson and Carolyn Y. Johnson contributed to this report.