– Summoned to the Oval Office on the spur of the moment, the South Korean envoy found himself face-to-face with President Donald Trump one afternoon last week at what he thought might be a hinge moment in history.

Chung Eui-yong had come to the White House bearing an invitation. But he opened with flattery, which diplomats have discovered is a key to approaching the volatile American leader. “We could come this far thanks to a great degree to President Trump,” Chung said. “We highly appreciate this fact.”

Then he got to the point: The United States, South Korea and their allies should not repeat their “past mistakes,” but South Korea believed that North Korea’s mercurial leader, Kim Jong Un, was “frank and sincere” when he said he wanted to talk with the Americans about giving up his nuclear program. Kim, he added, had told the South Koreans that if Trump would join him in an unprecedented summit meeting, the two could produce a historic breakthrough.

Trump accepted on the spot, stunning not only Chung and the other high-level South Koreans who were with him, but also the phalanx of U.S. officials who were gathered in the Oval Office.

Those officials thought the president would take more time to discuss such a decision with them first. Defense Secretary Jim Mattis and Lt. Gen. H.R. McMaster, the president’s national security adviser, both expressed caution. If you go ahead with this, they told Trump, there will be risks and downsides.

Trump brushed them off. I get it, I get it, he said.

Where others see flashing yellow lights and slow down, Trump speeds up. And just like that, in the course of 45 minutes in the Oval Office, Trump threw aside caution and dispensed with decades of convention to embark on a daring, high-wire diplomatic gambit aimed at resolving one of the world’s most intractable standoffs.

The path to a possible meeting led through a thicket of hostility and feints.

Throughout his first year in office, Trump ratcheted up economic sanctions while rattling his nuclear saber at “Little Rocket Man” and threatening to “totally destroy North Korea.”

Kim could match the president he called “the mentally deranged U.S. dotard” bombast for bombast. In a New Year’s Day speech, he said he had “a nuclear button on the desk” that could launch missiles capable of reaching the U.S. Trump responded with a tweet saying that “I too have a Nuclear Button, but it is a much bigger & more powerful one than his.”

But South Korea’s president, Moon Jae-in, focused on the other part of Kim’s speech, when he declared that he would send athletes to the Winter Olympics, which would be held the next month in South Korea. A flurry of negotiations ensued at Panmunjom, the “truce village” inside the Korean Demilitarized Zone.

With the Olympics over, it was time for Moon to make his move. Last week, he sent two trusted aides on a two-day trip to Pyongyang: Chung, his national security adviser, and Suh Hoon, his National Intelligence Service director.

Black limousines took the South Koreans to Azalea Hall in the ruling Workers’ Party headquarters, Kim’s workplace. They found Kim and his sister waiting to greet them with broad smiles. Chung and Suh were the first South Koreans to set foot inside the party headquarters since the Korean War.

Chung had barely launched into his talking points when Kim said “I know” and “I understand you.” Then he laid out his proposal: talks with the U.S. on denuclearizing his country; a suspension of nuclear and missile tests during the talks; and his understanding that the U.S. and South Korea must proceed with annual joint military exercises.

After returning to Seoul, the South Korean officials briefed Moon and then South Korean reporters. After his news conference, Chung called McMaster and told him that he was carrying a message from Kim to Trump. Only several people at the Blue House knew that the message included a proposal for a meeting with Trump.

Chung flew to Washington and met with McMaster at the White House on Thursday for half an hour while Suh met separately with Gina Haspel, the deputy CIA director.

The four then got together and were soon joined by other U.S. officials, including Vice President Mike Pence; Mattis; Dan Coats, the national intelligence director; Gen. Joseph Dunford, the Joint Chiefs of Staff chairman; and John Kelly, the White House chief of staff.

The South Koreans were not supposed to meet with Trump until Friday, but when he heard they were in the building, he called them to the Oval Office.

Kim’s invitation to meet was not a complete surprise to Trump’s team. A U.S. official said they had learned about it from intelligence agencies Thursday morning, so before the arrival of the South Koreans, Trump talked by phone with Secretary of State Rex Tillerson, who was traveling in Africa, about the prospect. What he did not tell Tillerson was that he was going to accept the invitation.

Trump’s quick decision caught many off guard, including U.S. allies, as well as Tillerson. Trump called Prime Minister Shinzo Abe of Japan, who has worked assiduously to cultivate a close relationship with Trump but was left out of the loop.

The fact that the announcement came on the same day that Trump slapped tariffs on imported steel that would hurt Japan added to the sting.

Trump did not reach President Xi Jinping of China until the next morning. China has backed Trump on North Korea, generating good will between Trump and Xi. But China refused in February to go along with a U.S. plan to interdict oil tankers bound for North Korea on the high seas, demonstrating that there were limits to how far China would go in punishing Kim, given the risk of a North Korean collapse on its borders.

Trump tweeted Saturday that he has the backing of Abe and Xi.

Xi “appreciates that the U.S. is working to solve the problem diplomatically rather than going with the ominous alternative,” Trump tweeted. “China continues to be helpful!”

Less than an hour later, the president tweeted that Abe was “very enthusiastic about talks with North Korea.”

For now, Trump is juggling all these dynamics and preparing for a meeting with the most hermetic leader in the world. To his advisers, Trump has said he is impressed that Kim at such a young age has outmaneuvered almost everyone inside and outside his country, but he has added that the North Korean leader is a wild card who cannot be predicted.