President Trump for weeks dismissed the danger of the novel coronavirus. He distracted himself by stoking unrelated feuds and nursing grievances. He shared little concrete information about the spreading pandemic, and much of what he did share was false.

Governors and mayors, as well as leaders of businesses large and small, stepped into the leadership vacuum to make difficult decisions affecting their constituents, employees or customers. In the absence of unambiguous guidance from the president for the citizens he was elected to lead, the frustration of governors boiled over.

And then on Monday, nearly eight weeks after the first coronavirus case was reported in the United States, Trump conveyed that he at last recognizes the magnitude of the crisis that is threatening lives across the nation, disrupting the economy and fundamentally upending the daily rhythms of American life.

“We have an invisible enemy,” Trump said at a news conference Monday, where he presented a notably changed demeanor and tone from his previous coronavirus briefings.

Trump and his team of public health experts laid out detailed guidance for state and municipal leaders, as well as for individual families. They recommended closing schools, restaurants, bars, gyms and other such venues, and limiting gatherings to no more than 10 people.

The president — who six days earlier promised “it will all go away” and as recently as Sunday advised Americans to “just relax” — suggested Monday that the outbreak could last until July or August.

Trump had whacked a beehive of angst earlier Monday when he convened a conference call with the nation’s governors. He told them that the states should not rely on the federal government to provide respirators, ventilators and other equipment to aid the infected, and that states should work on obtaining their own.

Virginia Gov. Ralph Northam (D) compared the comment to being at war and “we just heard our leader say you all need to get your own weapons at the state level to defeat this. But that’s the way it’s been.”

Maryland Gov. Larry Hogan (R), who chairs the National Governors Association, said in an interview that “some of my colleagues were pretty upset,” although he allowed for the possibility that the president may have misspoken.

“There’s not enough supplies,” Hogan said, explaining that there has been a backlog getting items distributed from a federal stockpile. In addition, he said, “There’s the issue of testing, there’s sort of these all-day-long issues. But it’s not about who said what, or whose feelings were hurt or what happened. It doesn’t do any good to be Monday-morning quarterbacking. We just have to get this stuff done. There’s a lot of tension and frustration [among] the governors.”

On Monday morning, the governors of Connecticut, New Jersey and New York announced an emergency joint action, directing all restaurants and bars, gyms, movie theaters and casinos in the tri-state area to close.

New York Gov. Andrew M. Cuomo (D), whose state has become an epicenter of coronavirus cases, decried the “hodgepodge” of efforts in various states to mitigate the spread, which he blamed on an absence of presidential leadership that has created “chaos” and a feeling that “the country’s out of control.”

“This is a national problem, and there are no national rules,” ­Cuomo said at a morning news conference, before the call with Trump. “If the federal government isn’t going to do what it should do, then the states have to try their best.”

The president admonished Cuomo on Twitter, writing that the New York governor ought to “do more.”

Cuomo tweeted back at Trump, “I have to do more? No — YOU have to do something! You’re supposed to be the President.”

About a half-hour later, Trump stepped into the White House press briefing room to unveil the new federal guidelines.

Some Republican governors also have sought to lead where Trump had not until Monday, most especially Ohio Gov. Mike DeWine, who has been at the forefront of enforcing social distancing.

Midday Sunday, as Trump tweeted about Hillary Clinton’s emails, a possible pardon for former national security adviser Michael Flynn and the “Fake and Corrupt News,” DeWine was busy finalizing a dramatic order to make Ohio the first state to close restaurants and bars.

And Sunday evening, as Trump watched the Democratic presidential debate and rendered his judgment to his 73 million Twitter followers — “I must say, that was a VERY boring debate” — the governors of California, Illinois, Maryland, Massachusetts and Rhode Island, as well as Connecticut, New Jersey and New York, announced or prepared to roll out similarly strict regulations in their states.

A pandemic does not respect state or municipal boundaries, yet the nation’s response mechanisms differ by locality. In some states, schools and restaurants are closed; in others, families pack amusement parks or revelers party in the streets.

One reason for the varying approaches is a void in guidance from Washington. Although the Centers for Disease Control and Prevention has issued a steady stream of direction, Trump had until Monday said little about how Americans should adjust their lives to reduce the threat of the coronavirus, aside from urging people to wash their hands and, as he tweeted Saturday, “SOCIAL DISTANCING!” Much of what Trump has said has been contradictory or false.

Former Virginia governor Terry McAuliffe (D) explained the challenge for state or municipal leaders to make decisions about a widespread public health crisis without the broad data and technical expertise of the federal government.

“If you’re a governor, you deal with earthquakes and tornadoes and flooding and blizzards,” he said. “They’re in your state, you’ve got the information and you make a calculated decision about what’s in the best interests of your citizens. But something like this, a pandemic, you’re only relying on the federal government.”

Historian Doris Kearns Goodwin drew a parallel from today to the Great Depression in the early 1930s, when President Herbert Hoover was so lacking in leadership and unwilling to commit federal aid to help those suffering that it fell to governors to protect their citizens. That was when a New York governor named Franklin D. Roosevelt rose to national prominence by talking about the government’s responsibility to lift up society and launched the first public works programs for unemployed citizens. Roosevelt was elected president in 1932.

“We have to have this national leadership right now, which the country is crying out for,” Goodwin said.

She added, “Why is it that most of the presidents we remember the best had moments of crisis, whether it’s George Washington or Abraham Lincoln or Franklin Roosevelt? It’s because they were able to communicate to the people what the crisis was, to make the people feel inspired to be part of working it out through empathy, taking responsibility and setting an example, and then to mobilize every resource in the country.”

The vacuum in presidential leadership that Cuomo and other governors decried was evident at Sunday’s White House coronavirus briefing, which occurred after Trump had tweeted earlier that day about seven unrelated topics.

“We’re going to all be great,” Trump said. “We’re going to be so good.”

The president celebrated the Federal Reserve’s extraordinary decision to lower interest rates to zero as “phenomenal” and “terrific,” adding that it made him “very happy.”

Then he read a list of names of grocery chain executives with whom he had spoken earlier that day and congratulated them: “Very impressive people,” he said, “the biggest in the world, in the world of stores and groceries and all.” And Trump sought to offer assurances to anyone who might be anxious by empty store shelves.

“Just relax,” he said, imploring Americans not to stock up on emergency supplies of food and other essentials because “it all will pass.”

Then Trump, after scolding the media, walked away without answering questions from reporters. He ceded the stage to Vice President Pence and the public health experts on the White House task force — the most prominent of whom shared a far different outlook.

“As I’ve said many times, and I’ll repeat it: The worst is, yes, ahead for us,” Anthony S. Fauci, the longtime director of the National Institute of Allergy and Infectious Diseases, said Sunday. “It is how we respond to that challenge that’s going to determine what the ultimate endpoint is going to be. We have a very, very critical point now.”

By the time Trump reemerged in public view Monday, he was singing the same tune as Fauci.

“Every one of us has a critical role to play in stopping the spread and transmission of the virus,” Trump said, exhorting all Americans, including the young and healthy, to distance themselves socially.

“This is a very bad one,” he added. “This is bad in the sense that it is just so contagious, sort of record-setting type contagion. . . . My focus is really on getting rid of this problem.”

Erin Cox in Annapolis and Gregory S. Schneider in Richmond contributed to this report.