SEOUL, South Korea (TNS) — President Donald Trump scored a diplomatic victory Wednesday as North Korea freed three imprisoned U.S. citizens to return to the United States with Secretary of State Mike Pompeo, a goodwill gesture from the North's dictator, Kim Jong Un, ahead of his summit with the president.

Trump announced the men's release on Twitter early Wednesday, and two reporters traveling with Pompeo later saw the three Korean American men boarding the secretary's plane without assistance as he was set to return to Washington. Trump said he and Vice President Mike Pence would meet the plane at 2 a.m. EDT Thursday at Joint Base Andrews in Maryland.

"I am pleased to inform you that Secretary of State Mike Pompeo is in the air and on his way back from North Korea with the 3 wonderful gentlemen that everyone is looking so forward to meeting," Trump tweeted.

Later, talking briefly to reporters before a Cabinet meeting, Trump thanked Kim in language that was unimaginable just months ago, as the two exchanged threats of nuclear annihilation. "I appreciate Kim Jong Un doing this and allowing them to go," Trump said.

The president also credited the leaders of China, Japan and South Korea for their help in nudging the North Korean leader, and Trump indulged in some self-congratulation as well. Asked whether he thought he personally deserved a Nobel Peace Prize, Trump replied, "Everyone thinks so but I would never say it."

The administration was eager to win the men's release to provide good diplomatic news to offset the international opprobrium after Trump on Tuesday withdrew the United States from the 2015 multinational nuclear agreement with Iran. Last week the president had tweeted that the three men's freedom was "imminent."

Despite the gesture from Kim, Trump acknowledged that his meeting with the North Korean leader — the first between a sitting American president and a leader of the long-isolated country — could still be "scuttled." The U.S. is demanding that North Korea unilaterally give up its nuclear arsenal and program to develop such weapons, something Kim is widely expected to resist.

"Everything can be scuttled," Trump said.

"People never thought you were going to have a situation where we're having serious and positive communication with North Korea, and we are," he added. "What happens? Who knows? We have a chance at something really great for the world."

Kim's overture on the prisoners, two of whom were detained last year and one late in President Barack Obama's tenure, came after he and Pompeo met for 90 minutes in Pyongyang, the North Korean capital, to finalize plans for Kim's meeting with the president. Trump told reporters that the two sides had agreed to a place and time. It would not be held in the demilitarized zone separating North and South Korea, he said, though more details weren't immediately available.

Pompeo's short trip — his second visit to Pyongyang in just over a month — came a day after Kim flew to China — North Korea's closest ally and protector — to confer with President Xi Jinping. It was Kim's second meeting with Xi in as many months as China has sought to exert its influence over its client state.

The administration had faced questions for weeks about whether it would demand that the imprisoned men be freed as a precondition for the summit.

The three citizens are Kim Dong-chul, a businessman arrested in 2015 and serving 10 years on espionage charges; and Kim Sang-duk and Kim Hak-song, professors associated with the Pyongyang University of Science and Technology who were arrested last year. Kim Sang-duk, who also goes by Tony Kim, graduated from the University of California, Riverside with a master's degree in 1990.

Trump and Pompeo said the men appeared to be in good health. "Doctors are with them now," Pompeo told the two reporters aboard his plane after takeoff. "All indications are that their health is as good as could be, given what they have been through."

Their release comes less than a year after the death of Otto Warmbier, an American college student detained on theft charges in Pyongyang in 2016. The North released Warmbier in a coma, and he died a week after returning to the United States.

His father, Fred Warmbier, sought to remind the world about the case amid the diplomatic glow celebrating the two Koreas' seeming rapprochement during the recent Winter Olympics in South Korea. He traveled in February to the Games in Pyeongchang and attended the opening ceremony to point up North Korea's record of human rights abuses.

For Pompeo, just two weeks into his job as the nation's top diplomat, the release of the three men — together with planning what could be a historic summit meeting — has made for a heady start. His previous visit with Kim was over Easter weekend, when Pompeo was still CIA director, awaiting Senate confirmation to become secretary of state.

The release was not without last-minute drama.

After his 90-minute discussion with Kim, Pompeo returned to his hotel, and when reporters asked whether there was good news on the detainees, he crossed his fingers.

A North Korean official later sought out Pompeo at his hotel and informed him that Kim had granted the men "amnesty," according to an account from a senior U.S. official present for the exchange.

"We're granting amnesty to the three detained Americans," the North Korean emissary told Pompeo. "We issued the order to grant immediate amnesty to the detainees."

"That's great," Pompeo said.

"It should be a very brief ceremony," the North Korean continued, referring to something of a legal process. He added in closing, "You should make care that they do not make the same mistakes again. This was a hard decision."

The emissary told Pompeo that the men would be released at 7 p.m. Carl Risch, the assistant secretary of state for consular affairs, and a doctor then went to another hotel to pick the men up and accompanied them to the airport.

Forty minutes after leaving the hotel, they arrived at the airport at 8:25 p.m. The former prisoners were in the air with Pompeo, headed for the U.S., less than an hour after leaving custody.

All three men were accused by Pyongyang of subversion and "anti-state" activities. That is a catchall phrase North Korea uses to incarcerate people, often foreigners, for a range of supposed crimes, big and small.

Yoon Young-chan, a spokesman for South Korean President Moon Jae-in, welcomed the North's action as a positive step toward a successful summit between Kim and Trump.

He also noted that the North's decision to release the three ethnic Koreans could signal that Pyongyang might release six South Koreans detained there, as Moon recently requested during a summit with Kim. South Korean officials expressed hope that the United States would help.