For almost three weeks, President Trump tried to deliver an upbeat message that the United States was ready for anything that the novel coronavirus could throw at it.

But on Monday, he stood on the White House briefing room podium and delivered the unvarnished truth. American life will be turned upside down for at least another five months, he said gravely, and the country could be headed for a recession.

“We have an invisible enemy,” he told a thinned-out, socially distanced room of reporters as he unveiled new guidance on avoiding restaurants, bars, and gatherings of more than 10 people for the next 15 days. "This is a very bad one. This is bad in the sense that it's so contagious."

Aides say the message was days in the making as Trump came to realize that the only way to get the country through the crisis was to admit that a rosy message would not be enough.

Public health experts had despaired of the administration’s approach to a major emergency. Trump consistently played down the risks, accusing the media of exaggerating the extent of the danger and saying as recently as Sunday that young people had nothing to worry about from COVID-19.

[Click here for complete coronavirus coverage]

“It’s a very contagious virus, it’s incredible, but it’s something we have tremendous control of,” he said then, even as the death toll reached 69.

When he tried to seize control with a televised address to the nation last week, the result was confusion. Officials had to play clean up after he announced a partial Europe travel ban, clarifying that cargo was not subject to the restrictions and that insurers had not agreed to waive copayments on coronavirus treatment (they had agreed to waive only copayments for testing).

But allies say that day was a turning point when Trump realized the crisis could not be wished away with Twitter bluster, partisan appeals to supporters, and efforts to juice the markets. Instead, he had to accept that he might have to rethink an election campaign based almost entirely on a booming economy.

“You’re seeing a new Trump totally focused on getting the country through this,” said an adviser.

So, on Monday afternoon, Trump offered a message that stuck more closely to the public health emergency playbook by warning people of difficult months ahead while offering a decisive plan of action and a spot of good news.

He admitted that the crisis could last through the summer.

"It seems to me that if we do a really good job, we will not only hold the death down to a level that is much lower than the other way ... and we have done a good job ... but people are talking about July, August, something like that," he said.

And when a reporter asked whether the crisis would send the country into a recession, he avoided trying to gloss over what everyone in the room knew to be true. "It may be,” he said, before adding that "pent-up demand" could help things bounce back.

The randomness of previous appearances was supplanted by a dose of clarity for frightened and confused viewers. He said a vaccine had entered its first human trials and issued clear guidance for the next 15 days, delivering the message about not gathering in groups of more than 10 people, advising to avoid discretionary trouble, and to school children at home if possible. Entire households should quarantine themselves if anyone tests positive, said the coordinator of his coronavirus task force, Deborah Birx.

"We will rally together as one nation, and we will defeat the virus," said Trump. "We can turn the corner and turn it quickly."

He even praised reporters for their role in tackling the crisis: “I think a lot of the media has actually has been very fair. I think people are pulling together on this.”

There were still Trumpian flourishes, such as giving himself 10 out 10 when asked how well he had responded to the crisis, but the performance won praise from critics as well as supporters.

Tom Bossert, a former Homeland Security adviser to Trump and an early siren that the administration was responding too slowly, said it was “superlative.”

“Targeted, layered, non-pharmaceutical interventions to the letter,” he wrote on Twitter. “Great nuance and clarity on school closures, coordination with governors and G-7 nations. Pitch perfect tone.”

A senior adviser said the shift in tone was simply another example of a leader who knew how to shift and adapt to circumstances.

“Everyone knows Trump wrote The Art of the Deal, but this is the person who wrote the Art of the Comeback,” he said. “He was a billion in debt and survived and succeeded.”