It had rained overnight, and the cement paths around the Tidal Basin were messy with mud and puddles of water.

Scattered visitors walked quietly amid boughs of cherry blossoms weighed down with raindrops. Peak bloom was only hours away.

“There’s a certain solitude about it,” said Hamilton Loving, who had come from McLean, Va., to see the blossoms.

This was Thursday morning. But as the sun emerged — and the weekend neared — the solitude vanished.

Throngs of sightseers, runners, photographers, people with dogs, people pushing baby carriages, even a police officer with his camera showed up, coronavirus warnings or not.

Official alarm spread. To prevent the spread of the novel coronavirus, people were not supposed to be gathering.

And as a result, over the weekend, the District and the National Park Service essentially shut off access to one of the city’s most historic and hallowed events — the annual rite of the cherry blossoms.

“The measures we employed are pretty extraordinary,” Mayor Muriel E. Bowser (D) said Monday. Streets were closed off, and pedestrians and bikers were discouraged from going to see the blossoms.

It may be the most sweeping action in more than a century, since the trees — a gift from Japan — were planted in 1912.

In 1941, four of the trees were chopped down in apparent retaliation for the Japanese attack on Pearl Harbor.

In 1999, a beaver family was relocated from the Tidal Basin after gnawing through several trees.

But nothing in recent memory has been like this.

Many of the bold blossom viewers last week said they were local and taking advantage of the promise of smaller crowds. They knew that the annual bloom regularly draws tens of thousands to jammed pathways around the Tidal Basin.

And the lure of the pale blossoms overcame fear of the virus.

But as cases and viewers grew, local officials became worried.

By Friday, Bowser was so concerned that she spoke on the phone with Interior Secretary David Bernhardt. The Department of the Interior oversees the National Park Service, which is the steward of the cherry trees.

“I let him know that we were updating our guidance on parks and that we wanted to see restricted access to the Tidal Basin,” Bowser said at a Monday news briefing.

“They made some changes with vehicular access on parking and the like and made those announcements,” she said. “But people still flocked to those sites.”

On Saturday, the park service tweeted that it was “implementing traffic control measures, including closing the already limited parking areas, to discourage excessive visitation.”

“We strongly urge anyone considering a visit to see the cherry blossoms to reconsider and to help prevent the spread of infectious diseases.”

Saturday night, with a forecast for nice weather and more visitors on Sunday, Bowser took further action.

“Even though we canceled the parades, closed the restaurants [and] the museums . . . the trees will still bloom as they do every year,” she said. “And people from not just D.C. but all over the region were flocking to the location.”

The D.C. police announced late Saturday that they were restricting traffic on numerous streets around the Tidal Basin starting Sunday morning.

“I decided to use D.C. police,” Bowser said. “The D.C. police work for us. The Park Police work for the park service.”

“We do not police national parks,” she said. “So for us to use our local police resources to basically police a national park is an extraordinary use, but we thought very necessary.”

The police department said in a statement Saturday night: “To help flatten the curve, we strongly discourage any Tidal Basin visits because social distancing has not been possible due to visitor volume.”

The park service did not immediately have further comment.

Visitors who had made it to the see the blossoms last week said Bowser had done the right thing.

“I think the mayor . . . had no choice but to say that this would be a large gathering . . . [and] that it really put the public health and welfare at risk,” said Ashley Darcy-Mahoney, who, with her family, saw the blossoms last week from the safety of a Tidal Basin paddle boat.

“From the perspective of a health-care provider, we’re really calling upon the public to help us,” said Darcy-Mahoney, a nurse practitioner who teaches at George Washington University’s School of Nursing.

“From my perspective as a D.C. resident and as a nurse, I think [Bowser’s action] was the right decision,” she said Monday.

As for the visit she made last Thursday with her husband, Kevin, and their children Jack and Connor, “we were quite lucky to be in the middle of the Tidal Basin,” she said.

Groves of cherry trees ring the basin.

“We really were thoughtful about when we went,” she said.

They rode their bicycles from the Shaw neighborhood, where they live. They scouted around and found no line for the popular paddle boats, which enabled them to see the blossoms without being in a crowd.

“It was an awesome alternative to be really able to just be with our immediate family with distance from everybody,” she said. “I think we felt lucky to have followed the public health guidelines while still being able to see” the blossoms.

She said everybody in her family remains in good health.

Robert Wallace, of Reston, a career CIA officer who also took in the blossoms last week, said he has had no second thoughts.

“My wife and I, we’re all in good health,” he said. “It wasn’t crowded. We kept a respectable distance from everybody.”

“And . . . I don’t have any issue with the [officials] making decisions they think are necessary,” he said. “They’ve got that responsibility, and I respect that. I was in government myself, and I had responsibilities.”

“I’m delighted we got there, though,” he said Monday. “We got wonderful photos, had a great experience.”

“This is going to be one of those historical cases [where] we’re not going to know what the best call was probably for some time,” he said. “History will be very wise when we look back on it.”

But for now, Bowser said Monday: “Stay away from the Tidal Basin.”

“Too many people have the idea that they can social distance from others,” she said. “They can’t.”

Magda Jean-Louis contributed to this report.