TOKYO — It was as if the Japanese capital was collectively gripped with a form of spring fever. The sun was shining, the cherry blossoms were blooming, and the capital seemed all at once to decide it had had enough of social distancing.

Two months into the coronavirus pandemic here, and the parks last weekend were full in Tokyo with people gathering to view cherry blossoms. The temples were packed with those seeking blessings for the spring, and bars and restaurants were filled.

Just north of Tokyo, a martial arts event attracted about 6,500 people who packed into the Saitama Super Arena on Sunday, despite the local governor’s pleas for restraint. On Saturday, more than 50,000 gathered in Sendai, north of Tokyo, to see the Olympic flame, newly arrived from Greece, burning in a golden cauldron.

Japan had so far dodged the worst of the pandemic, but last weekend, the capital was proof of what many experts have long warned: People might put up with social distancing for a few weeks, but they would eventually tire of remaining indoors and seize on the smallest piece of good news as an excuse to venture out again.

It does not bode well for the idea that Europe and the United States will be able to maintain social distancing for months on end to combat the novel coronavirus that causes the disease covid-19.

“I am very concerned about complacency and fatigue,” said Kentaro Iwata, an infectious disease expert at Kobe University. “People cannot stand remaining in a restricted lifestyle for a long, long time.”

Japan has been a puzzling outlier in the coronavirus pandemic.

Despite limited testing in the early weeks of the outbreak and cold weather perfect for spreading respiratory infections, the country has avoided the kind of explosive growth in infections seen in South Korea, Europe and the United States.

Japan added 38 new cases on Monday, bringing the number of confirmed infections to 1,140, with 42 deaths, not including cases from the Diamond Princess cruise ship, which was moored off the coast of Japan for weeks in February with hundreds of infected people aboard.

The sense here is that Japan has dodged a bullet, either by luck or judgment, but experts warn that the country is not invincible.

“I’m deeply concerned about the current situation in Japan,” said Hitoshi Oshitani, a virology professor at Tohoku University’s School of Medicine and a member of the government’s expert advisory panel.

“Now the first wave is almost under control . . . but the second wave has already started,” he said. “It is probably going to be much worse, and we are going to have more outbreaks, and some of them are going to be big.”

Some critics say Japan has been deliberately burying its head in the sand, either to protect its economy from a damaging shutdown or in an ultimately unsuccessful bid to lower the chances of an Olympics postponement or cancellation.

On Tuesday, the International Olympic Committee agreed with Japanese Prime Minister Shinzo Abe to postpone the Olympics and Paralympics. Previously scheduled to start in July, organizers hope to stage the Games by the summer of 2021.

But by rationing tests only to people with prolonged fevers and more serious symptoms, they argue, the government has undercounted the number of infections and lulled the country into a false sense of security.

“The government has given an optimistic picture all along, and so people don’t have an image of it being that scary,” said Masahiro Kami, executive director at the Medical Governance Research Institute, who has been calling for more extensive testing. “That’s natural if you see just the numbers.”

But Oshitani and Iwata say the government has been wise to concentrate its resources and its testing capabilities on people with more serious symptoms and that it needs to strike a balance between strict measures and sustainable ones.

Each region, Iwata says, needs to make its own decision on how strict to be in imposing social distancing measures, depending on its caseload — because strict controls cannot be sustained forever and should be reserved for when they are most needed. Many people did stay home last weekend in cities such as Osaka and Kobe, where infection rates have been climbing, he said.

But that doesn’t excuse what happened in Tokyo, Saitama and Sendai last weekend, critics say.

They bemoan a lack of leadership from Abe, who has personally done little to drive home the importance of social distancing to the public and often seems to have taken a back-seat role to Health Minister Katsunobu Kato.

“It’s situations like this where Abe has not stepped up,” said Jeff Kingston, a professor at Temple University Japan. “It’s a familiar situation during this crisis where Abe has been [missing in action].”

In Tokyo, some people are working from home, but commuter trains remain packed during rush hours. Kami is worried that the government seems to be putting the economy ahead of the public’s health.

Whether Japanese habits — wearing masks and bowing rather than shaking hands — have helped slow the epidemic’s spread remains an open question.

But good habits won’t protect Japan if complacency sets in, especially with a new wave of infected people entering the country from Europe and the United States, experts say.

Oshitani said he expects the government to come down more firmly this week to limit social interactions, as it now understands how dangerous the situation has become.

“Our enemy is optimism,” said Kuni Miyake, president of the Foreign Policy Institute, quoting President Franklin D. Roosevelt’s remark in his inaugural address in 1933 that only “a foolish optimist can deny the dark realities of the moment.”

“I don’t want to be a foolish optimist,” he said. “I want to be a wise pessimist.”

Akiko Kashiwagi contributed to this report.