President Donald Trump canceled his historic nuclear summit with Kim Jong Un on Thursday, accusing North Korea of "tremendous anger and open hostility." The meeting, which would have marked the first face-to-face encounter between a sitting U.S. president and a North Korean leader, was set for June 12 in Singapore. "Sadly, based on the tremendous anger and open hostility displayed in your most recent statement, I feel it is inappropriate, at this time, to have this long-planned meeting," Trump wrote in a letter to Kim, which was released Thursday morning. The president dictated every word of the letter himself, a senior White House official told reporters. The senior White House official also said that North Korea had suspended direct communication with the U.S. over the past week. Stocks fell after news of the cancellation broke, although equities rebounded from lows somewhat later in the day. Much of the letter was written in seemingly friendly terms, including praise for North Korea's recent release of three American prisoners. In contrast, Trump also appeared to issue a threat that conjured memories of his war of words with Kim last year.

"You talk about your nuclear capabilities, but ours are so massive and powerful that I pray to God they will never have to be used," Trump wrote. The Wall Street Journal, citing a White House official, reported that Trump, in a bid to avoid leaks, ordered the letter released without first telling U.S. allies. The cancellation took South Korea's government by surprise. The nation's president, Moon Jae-in, had played a pivotal role in setting up recent diplomatic developments. A representative of Moon's office said the South Korean administration was "trying to figure out what President Trump's intention is and the exact meaning of it," according to the country's Yonhap News Agency. Moon and his aides convened emergency meetings to address the shock announcement, which broke shortly before midnight in Seoul. Moon and the national security council met for an hour, starting a midnight, according to a statement from the South Korean presidency. The rest of the statement reads: It is very regretful and disconcerting that the US-NK summit will not happen as planned. Denuclearization and the lasting peace on the Korean peninsula cannot be abandoned or delayed as they are the historical assignment. The sincerity of the affected parties who have been working to resolve the problem has not changed. It is hard to resolve sensitive and difficult diplomatic issues with the current way of communications. (We) hope that the leaders resolve problems through direct and close dialogue. The news came as North Korea made a show of dismantling a nuclear test site, but also on the heels of some sharp words from the North Korean government about America denuclearization demands. Trump's decision also comes more than two weeks after he withdrew the U.S. from the Obama-era Iran nuclear deal, which had lifted sanctions on the Middle Eastern country as long as it limited its nuclear program. Read more: Congress reacts to Trump's decision to cancel his summit with Kim Jong Un Doubts had grown in recent days about whether Trump's summit with Kim would actually happen. North Korea abruptly canceled talks with South Korea last week out of anger over joint military tests with the U.S. in the Korean peninsula. While Trump had repeatedly played up the historic significance of his planned meeting, he also often leavened his optimism with a cautious "we'll see." On Tuesday, Trump said there was a "substantial" chance that the meeting might not take place at the planned time and location. Thursday's development marked yet another dramatic, sudden turnaround in the Trump-Kim saga. Without many details or diplomatic ties established, the president agreed on March 8 to the summit, when South Korean officials told Trump about the North Korean leader's Kim's eagerness to meet.

You talk about your nuclear capabilities, but ours are so massive and powerful that I pray to God they will never have to be used. President Donald Trump

North Korea took offense to remarks on Monday by Vice President Mike Pence that the communist country could end up like Libya if it doesn't make a nuclear deal with Washington. Before Trump's cancellation, a top North Korean official, Choe Son Hui, lashed out at Pence's remarks. "As a person involved in U.S. affairs, I cannot suppress my surprise at such ignorant and stupid remarks gushing from the mouth of the U.S. vice president," Choe said, according to KCNA.

The vice president's comments also echoed those of Trump's national security advisor, John Bolton, who had suggested the U.S. could pursue a Libya-style denuclearization plan with North Korea. Years after that nuclear deal, Libyan leader Moammar Gadhafi was overthrown and slain, a move the U.S. supported. North Korea's Kim is concerned about regime change. Trump's cancellation earned quick praise from Republican lawmakers. Sen. Marco Rubio, R-Fla., said in a tweet that the president's move was "100% the right decision." RUBIO TWEET House Speaker Paul Ryan also weighed in, but in more measured tones. "The North Korean regime has long given ample reason to question its commitment to stability," Ryan said in a statement. "We must continue to work with our allies toward a peaceful resolution, but that will require a much greater degree of seriousness from the Kim regime." Trump's critics also seized on the news, but as a way to hammer the White House. "The art of diplomacy is a lot harder than the art of the deal. The reality is, is that it's pretty amazing that the administration might be shocked that North Korea is acting as North Korea might very well normally act," Sen. Bob Menendez, D-N.J., said in a hearing involving Secretary of State Mike Pompeo. While he was still CIA director, Pompeo met with Kim over Easter weekend to establish diplomatic ties and work toward setting up the summit. Pompeo had also secured the release of the three American prisoners released by North Korea earlier this month. In his letter to Kim, Trump thanked him for the release but referred to the prisoners in non-diplomatic language. "I want to thank you for the release of the hostages who are now home with their families. That was a beautiful gesture and was very much appreciated," Trump said. At the Senate Foreign Relations, Pompeo said Thursday that North Korea did not respond to preparation teams for the summit. There were no immediate details about how the administration would continue to pursue diplomacy with North Korea, which is the only nation to conduct nuclear-weapons tests this century. Yet Trump left the door open for arranging a new meeting with Kim. "If you change your mind having to do with this most important summit, please do not hesitate to call me or write," the president wrote. "This missed opportunity is a truly sad moment in history." Read the full text of the letter here: May 24, 2018 His Excellency

Kim Jong Un

Chairman of the State Affairs Commission of the Democractic People's Republic of Korea

Pyongyang Dear Mr. Chairman: We greatly appreciate your time, patience, and effort with respect to our recent negotiations and discussions relative to a summit long sought by both parties, which was scheduled to take place on June 12 in Singapore. We were informed that the meeting was requested by North Korea, but that to us is totally irrelevant. I was very much looking forward to being there with you. Sadly, based on the tremendous anger and open hostility displayed in your most recent statement, I feel it is inappropriate, at this time, to have this long-planned meeting. Therefore, please let this letter serve to represent that the Singapore summit, for the good of both parties, but to the detriment of the world, will not take place. You talk about your nuclear capabilities, but ours are so massive and powerful that I pray to God they will never have to be used. I felt a wonderful dialogue was building up between you and me, and ultimately it is only that dialogue that matters. Some day, I look very much forward to meeting you. In the meantime, I want to thank you for the release of the hostages who are now home with their families. That was a beautiful gesture and was very much appreciated. If you change your mind having to do with this most important summit, please do not hesitate to call me or write. The world, and North Korea in particular, has lost a great opportunity for lasting peace and great prosperity and wealth. This missed opportunity is a truly sad moment in history. Sincerely yours, Donald J. Trump

President of the United States of America CNBC's Eamon Javers and Amanda Macias contributed to this report.

WATCH: The Trump-Russia ties hiding in plain sight