SEOUL, South Korea — The moment had been portrayed by North Korea’s leader, Kim Jong-un, as a show of good faith ahead of his meeting with President Trump: the destruction of North Korea’s only known nuclear test site.

With foreign journalists watching on Thursday, the North Koreans detonated explosives to destroy tunnels and buildings at the site in the country’s remote mountains.

But then, only hours later, Mr. Trump abruptly canceled the June 12 summit meeting, turning North Korea’s seeming gesture of good will into a potential embarrassment by its longtime enemy, the United States.

Mr. Trump’s move blindsided the North Koreans so completely that the invited foreign journalists learned about the cancellation on their smartphones — even before some of their hosts did. One of the journalists, Will Ripley from CNN, read the text of Mr. Trump’s withdrawal letter to their official North Korean chaperones on the return train ride from the remote nuclear test site, Punggye-ri.

“I can tell you there was a real sense of shock,” Mr. Ripley said in a phone interview with CNN. “They immediately got up and left.”

Mr. Trump’s letter to Mr. Kim attributed the cancellation to what the American president called the “tremendous anger and open hostility” displayed by North Korean officials in recent statements. But the timing of the letter coincided almost precisely with North Korea’s public relations effort to present itself as transparent and flexible on the nuclear issue.

North Korea said on Friday that it was still willing to give Mr. Trump “time and opportunity” to reconsider his decision, according to a statement carried by the official Korean Central News Agency.

Less than two weeks ago, Mr. Trump welcomed North Korea’s plans to dismantle the test site as a “very smart and gracious gesture” ahead of what would have been the first face-to-face meeting between leaders of the two countries.

North Korea allowed a select group of journalists from Britain, China, Russia, South Korea and the United States to watch its engineers detonate blasts in the tunnels in Punggye-ri, where the country has conducted all six of its nuclear tests. No independent outside nuclear monitors were invited to verify the dismantlement of the site.

In the ceremony on Thursday, North Korea set off explosives in three of its four tunnels at the Punggye-ri site, according to dispatches by reporters at the scene. The fourth tunnel had already been closed for fear of contamination after the North’s first nuclear test in 2006.

The North Koreans also blew up test-observation facilities, as well as barracks for site personnel and a metal foundry, the reports said.

Two dozen international journalists were invited to witness explosives rigged inside the tunnels, and they were then escorted outside to viewing decks 500 yards away, where they filmed the detonations.

North Korea invited mostly TV journalists to ensure that its action would be broadcast worldwide.

Even before Mr. Trump canceled the summit meeting, some analysts feared the moves would be reversible — as when the North disabled and then restarted a nuclear reactor years ago. But Thursday’s reported demolition at the test site was the first concrete step North Korea had taken under Mr. Kim toward what Washington had been hoping would be a complete nuclear dismantlement.

North Korea announced last month that it would end all nuclear and long-range ballistic missile tests, as well as close the test site. It said it no longer needed to conduct such tests because the country already had nuclear weapons and wanted to focus on rebuilding its economy.

It is still not known whether the country will give up its nuclear arsenal — an uncertainty that has only intensified now that the much-anticipated meeting between Mr. Trump and Mr. Kim has been canceled.

Since no weapons experts were present Thursday, it is not even clear whether North Korea destroyed all of the tunnels at the test site, or if the explosions would prevent the site from being used again.

When Mr. Kim met the leaders of South Korea and China in recent weeks, he told them he was willing to discuss relinquishing his country’s nuclear arsenal in return for security guarantees, the lifting of sanctions and other incentives from the United States.

But North Korea abruptly changed its tone last week, warning that Mr. Kim would not meet Mr. Trump if Washington insisted on its quick and “unilateral nuclear abandonment” without offering incentives.

Some analysts had played down the significance of North Korea’s decision to shut down the site. They said that after six tests, all conducted in deep tunnels, the site had most likely caved in and become too unstable for another test.

But when he met with President Moon Jae-in of South Korea last month, Mr. Kim rebuffed skeptics, saying that at the time, the Punggye-ri site still had two functioning tunnels where nuclear tests could be conducted.

Other analysts cautioned that the North might be shuttering the site in a way that could allow it to be reopened quickly.

“It’s true that shutting down the Punggye-ri test site does not prevent North Korea from ever testing again,” said David Wright, a senior scientist at the Union of Concerned Scientists. “If negotiations fail or situations change in the future, it could decide to tunnel at a different site and build the required infrastructure needed to test.”

But Mr. Wright called the development on Thursday “a meaningful and pretty dramatic action nonetheless.” It could take the North months or longer to reverse the disabling of the facilities at the site, he said.

North Korea said it had invited outside journalists to the dismantling ceremony to ensure transparency. But it waited until just a day before the event to let South Korean journalists into the country.

“Dismantling the nuclear test ground was done in such a way as to make all the tunnels of the test ground collapse by explosion and completely close the tunnel entrances, and at the same time, explode some guard facilities and observation posts on the site,” the North’s Nuclear Weapons Institute said in a statement.

The institute said there was no leakage of radioactive materials during the explosions. It said that the entire site would be closed after further removal of aboveground structures and personnel, adding that North Korea was committed to building “a nuclear-free peaceful world.”

A version of this article appears in print on , on Page A8 of the New York edition with the headline: Destruction of Test Site Is Viewed by Journalists. Order Reprints | Today’s Paper | Subscribe