Mr. Trump’s reversal drew cries of diplomatic malpractice from Democrats — Senator Christopher S. Murphy of Connecticut said it was “as discombobulated as everything else in this White House’s foreign policy” — and support from Republicans — Senator Mitch McConnell of Kentucky said that “they did exactly the right thing.”

But the process exposed visible differences in tone between Mr. Trump and the people working for him. While the president continued to speak of the possibility of a meeting, a senior official briefed reporters about the “trail of broken promises” that led to its cancellation.

Mr. Trump’s national security adviser, John R. Bolton, infuriated North Korean officials by proposing the voluntary disarmament of Libya in 2003 as a precedent for North Korea. Under that deal, Libya gave up its entire arsenal without receiving any incentives.

Then, Mr. Pence warned that Mr. Kim could meet the same fate as Libya’s leader, Col. Muammar el-Qaddafi, if he did not make a deal with the United States. Libyan rebels, aided by a NATO bombing campaign, killed Colonel Qaddafi during the Arab Spring upheavals in 2011. That prompted a North Korean official to call him a “political dummy.”

“We will neither beg the U.S. for dialogue nor take the trouble to persuade them if they do not want to sit together with us,” said Choe Son Hui, a vice foreign minister. She asked whether “the U.S. will meet us at a meeting room or encounter us at nuclear-to-nuclear showdown.”

At the time that Mr. Trump accepted Mr. Kim’s invitation, several officials said they believed that there was less than a 50 percent chance that the meeting would actually happen.

But the president dispatched Mr. Pompeo to work out the logistics for a meeting, and he, too, expressed optimism about the encounter. In addition to blowing up the nuclear site, North Korea pledged to halt nuclear and missile tests, and it released three Korean-Americans imprisoned there — which Mr. Trump acknowledged in the letter was a “beautiful gesture.”