A miffed President Trump pulled out of next week’s second presidential debate on Thursday after organizers said it would be held virtually “to protect the health and safety of all involved” given his coronavirus diagnosis — only to have his campaign demand hours later that the event go on as originally planned.

The gyrating series of demands started with a decision by the nonpartisan debate organizing commission to try to protect the participants, moderator and guests who would have attended the Oct. 15 event. In response, Trump promptly announced he was “not going to waste my time in a virtual debate.”

“That’s not what debating is all about — you sit behind the computer and do a debate, it’s ridiculous,” he said on Fox Business in his first interview since announcing one week ago that he had tested positive for the coronavirus. “And then they cut you off whenever they want.”

In a statement a few hours later, Trump campaign manager Bill Stepien said the second debate should be pushed back to Oct. 22, the planned date of the third debate, and that another debate should be held on Oct. 29, five days before the election.

Joe Biden’s deputy campaign manager, Kate Bedingfield, said Biden agreed to the Oct. 22 session but turned down the idea of a later meeting. She said that once Trump canceled, Biden scheduled a solo town hall on Oct. 15; ABC News later said it was hosting the event.

Late Thursday, Stepien took another position, demanding that the Oct. 15 debate take place as originally planned, citing a new report by White House doctor Sean Conley that anticipated Trump would be cleared for public events as of this weekend.

But Frank J. Fahrenkopf Jr., the head of the debate organizing commission, said Trump’s initial decision to withdraw might have made the demand moot. Fahrenkopf said he had spoken to Biden campaign officials and they appeared committed to their replacement event.

“Once they said no, Biden scheduled something else,” he said.

He said the Oct. 15 debate would only occur if both Biden’s team and the Cleveland Clinic, which is handling safety protocols for the debates, signed off on it.

Fahrenkopf added that there would be no debate after the last scheduled one on Oct. 22, despite the Trump campaign’s demands. “Nashville on the 22nd is the last debate,” he said.

The day-long battle centered on plans for the highest-profile events remaining in the general election campaign.

With less than four weeks to go before Election Day, Trump remains cloistered in the White House, where on Thursday aides again declined to clarify details of his illness, including when he last registered as negative, a time element necessary to chart the likelihood of him spreading it.

Trump came out aggressively in the first debate on Sept. 29, brawling with Biden and moderator Chris Wallace. But it did nothing to improve his standing in the race; Biden leads both in national polls and in several states Trump needs to win to secure a second term.

The second and third debates had loomed as having the most potential to alter the course of the race, an opportunity that Trump cut in half by refusing to take part in the sort of virtual replacement that has become commonplace for schools and businesses since the pandemic exploded this spring. He also put himself in the position of arguing against safety precautions that might protect others in proximity to him.

Plans for the fall gatherings were upended early last Friday, when Trump announced via Twitter that he had tested positive for the coronavirus. That came little more than two days after the first presidential debate.

Biden has since undergone testing for the coronavirus, out of concern that the president might have been contagious during the event. Biden’s campaign said he remained negative in tests for the virus, most recently Thursday morning.

Soon after returning to the White House on Monday after four days at Walter Reed National Military Medical Center, Trump announced that he would attend next week’s debate.

Yet a person involved in the debate commission’s discussions said there was trepidation from staff members, and others who produce the debate, about being near Trump and his team so soon after his diagnosis and as additional members of his White House staff and other allies continue to test positive for the virus.

Concerns also rose because the president’s entourage at the first debate, in Cleveland, had violated rules requiring all parties inside the debate hall to wear masks, removing theirs even as the Biden team wore facial coverings.

On Wednesday night, with the same mask mandate in effect, Vice President Pence’s wife, Karen, walked onto the stage after her husband’s debate with Sen. Kamala D. Harris (D-Calif.) ended, hugged him and turned to wave at the audience, maskless.

The changes for the next debate were announced nine hours later.

“In order to protect the health and safety of all involved with the second presidential debate . . . the second presidential debate will take the form of a town meeting, in which the candidates would participate from separate remote locations,” the commission said, setting off a firestorm from the president and his team.

After Trump pulled out, his campaign manager Stepien launched a fusillade of insults at the debate organizers, calling the virtual format “a sad excuse to bail out Joe Biden” and saying the president will “hold a rally instead” on Oct. 15.

“For the swamp creatures at the Presidential Debate Commission to now rush to Joe [Biden’s] defense by unilaterally canceling an in-person debate is pathetic. That’s not what debates are about or how they’re done,” Stepien, who has been in isolation due to his own coronavirus diagnosis, said in a statement. “Here are the facts: President Trump will have posted multiple negative tests before the debate, so there is no need for this unilateral declaration.

Stepien then made his alternative pitch for an Oct. 22 debate and another on Oct. 29. “Americans deserve to hear directly from both presidential candidates on these dates,” Stepien said.

Bedingfield dismissed that proposal outright, noting that the campaign agreed to the original dates in June.

“Trump chose today to pull out of the October 15th debate,” she said in a statement. “Trump’s erratic behavior does not allow him to rewrite the calendar, and pick new dates of his choosing.”

Biden told reporters in Phoenix, where he traveled Thursday for campaign events, that Trump’s refusal to take part in the virtual debate was “not surprising.”

“Look, we agreed to three debates back in the summer,” he said. “This has been going on since the early ’90s. First debate, person-to-person, second debate, town-hall format. Third debate, person-to-person. We set the dates. I’m sticking with the dates, I’m showing up. I’ll be there. And in fact, if he shows up, fine. If he doesn’t, fine.”

Fahrenkopf said both campaigns were given five minutes’ notice before the announcement that the Oct. 15 debate would be virtual. The campaigns were not asked to consent to the decision, he said.

He said the commission had evaluated the safety implications of an Oct. 15 debate with the Cleveland Clinic in light of the diagnosis of the president and others, and decided that it would be safest hold to it virtually.

“There is no requirement that any presidential candidate debate,” he said. “It is up to the candidate to decide whether or not he or she wants to debate.”

He added: “It has to be safety first.”

The Republican National Committee on Thursday afternoon targeted debate commission members, sending out a statement critical of them individually.

Since arriving back at the White House, Trump, 74, has insisted that his condition has improved, and said Thursday that he does not think he is contagious. He has not supplied results of any tests confirming that contention, nor have his doctors in the limited information they have released.

But health officials have suggested that the president could be contagious through Oct. 15, which had raised questions about the safety not only of Biden, 77, but also the moderator and questioners.

In Wednesday’s vice-presidential debate, Pence and Harris were seated at separate tables and separated by plexiglass after days of back-and-forth between the campaigns about safety precautions given the coronavirus outbreak at the White House.

All told, at least 21 known cases are connected to the White House and the Trump campaign.

Annie Linskey contributed to this report.