WASHINGTON — Members of President Donald Trump’s coronavirus task force and aides in the West Wing were shocked on Thursday when he promoted the use of light and disinfectant to treat the deadly respiratory illness, according to administration officials.

As Trump went off script to suggest people with the virus could be cured by UV rays or disinfectants “by injection inside,” White House officials began texting one another to ask where he got that idea because they thought, as one adviser put it, “this was going to be bad.”

None of them seemed to know, as Trump did not consult with any task force members or administration officials before making his impromptu statement, which has now been universally rejected by health experts, the officials said.

Instead, it appears Trump conflated and misinterpreted scientific information discussed with him in the Oval Office before Thursday’s daily briefing, according to the officials.

During the meeting some advisers — including the acting undersecretary for science and technology, Bill Bryan — shared with the president some new but promising information about testing that’s been done on coronavirus, officials said. It included a discussion about how the virus is killed on surfaces with disinfectants and on hands with soap or sanitizer and studies about the effectiveness of light, temperature and humidity, as well as a mention of treatments for various conditions such as radiation, officials said.

The plan was to stress during the daily White House coronavirus briefing that disinfectants should be used on surfaces, but then “the president took it a couple steps further,” one administration official said.

“It was totally ad-libbed,” the official said, adding, it was “off-the-cuff.”

Download the NBC News app for full coverage of the coronavirus outbreak

“I think what he did was conflate the disinfecting product with heat and light,” the official said. “They are not the same things. The disinfectants are for surfaces.”

Another administration official said Trump took the briefing information on disinfectant and sunlight and appeared to do some “deductive reasoning” that it could be injected into people.

The first official stressed that Trump did not intend to suggest people should inject disinfectants into their bodies, and that the president’s comments stem from his desire to project optimism about the future of the pandemic.

“He wants to always be giving people hope and optimism. He certainly isn’t telling anyone to drink bleach or ingest disinfectant,” the official said.

On Friday Trump told reporters he was being sarcastic when he suggested people inject disinfectant into their bodies.

It’s not the first time the president has claimed that his attempted “jokes” were being misinterpreted after facing intense backlash and widespread criticism. When he referred to himself to reporters as “the chosen one” during an exchange on trade talks with China last year, he argued later that he had just been “kidding” and “having fun.” During the 2016 campaign, after repeatedly saying that then-President Barack Obama was the “founder of ISIS,” he backtracked by saying he was simply being “sarcastic.”

Medical officials cast Thursday’s presidential twist on scientific information as perhaps his most dangerous and misleading attempt yet to project a positive outlook on the coronavirus pandemic.

On Friday the Maryland Emergency Management Agency issued an alert that it had “received several calls regarding questions about disinfectant use” and the coronavirus, warning residents that “under no circumstances should any disinfectant product be administered into the body.”

But Trump’s promotion of light and disinfectant as a possible hope for curing a virus that’s killed some 50,000 Americans is part of a broader posturing that’s designed to make the country feel like the current situation is improving or soon will, officials said.

They said Thursday’s remarks are part the president’s increasing irritation at his health advisers’ constant caution about possible treatments that he wants to promote and warnings about a future wave of the coronavirus. Even if Trump factors their advice into his scripted remarks, they can’t be sure he won’t ad lib to overcorrect what he sees as pessimistic guidance.