Americans were freed 1 hour before flight out of Pyongyang

In this May 3, 2018 photo, people watch a TV news report screen showing portraits of three Americans, Kim Dong Chul, left, Tony Kim and Kim Hak Song, right, detained in the North Korea, at the Seoul Railway Station in Seoul, South Korea   President Donald Trump says Secretary of State Mike Pompeo is on his way back from North Korea with three American detainees, saying they "seem to be in good health."  (AP Photo/Ahn Young-joon)
In this May 3, 2018 photo, people watch a TV news report screen showing portraits of three Americans, Kim Dong Chul, left, Tony Kim and Kim Hak Song, right, detained in the North Korea, at the Seoul Railway Station in Seoul, South Korea President Donald Trump says Secretary of State Mike Pompeo is on his way back from North Korea with three American detainees, saying they "seem to be in good health." (AP Photo/Ahn Young-joon)

PYONGYANG, North Korea (AP) - After months of anticipation and drama, the release of three American detainees by North Korea played out amid high-stakes diplomacy and was only sealed about an hour before the U.S. secretary of state was wheels-up from Pyongyang.

The three men, Kim Dong Chul, Kim Hak Song and Tony Kim, walked on their own from a van and onto the plane of top diplomat Mike Pompeo. It was the culmination of Pompeo's 12-and-half-hour visit to the North Korean capital, which included a 90-minute meeting with leader Kim Jong Un.

Returning to his hotel from that meeting, Pompeo had given reporters a fingers-crossed sign when asked if there was good news about the detainees. A North Korean official came to the hotel shortly after to inform Pompeo that Kim had granted amnesties to the three and that they would be released at 7 p.m. local time, according to a senior U.S. official present for the exchange. Carl Risch, the assistant secretary of state for consular affairs, and a doctor went to another hotel to pick up the men and bring them to the airport, the official said.

They finally left custody at 7:45 p.m., and by 8:42 p.m. they were flying home.

As soon as the plane cleared North Korean airspace, Pompeo called President Donald Trump to inform him of the releases with the men all apparently in good health; then other officials notified their families.

Even before Pompeo's plane had touched down for a stopover at Yokota Air Base in neighboring Japan, the president announced to the world by Twitter that the "3 wonderful gentlemen" were free.

They are the latest in a series of Americans to be held in North Korea for alleged anti-state activities in recent years, only to be freed during the visit of a high-level U.S. official or statesman. Their releases draw a line under an issue that had weighed on plans for a historic summit between Kim and Trump that will focus on North Korea's nuclear weapons.

"We're granting amnesty to the three detained Americans," the North Korean emissary told Pompeo at Pyongyang's Koryo Hotel, said the senior U.S. official who requested anonymity to discuss the exchange. "We issued the order to grant immediate amnesty to the detainees."

"That's great," the secretary of state replied.

The North Korean official then advised the releases would follow a "very brief ceremony" - which he described as more like a legal process. The official closed with a gentle warning for the U.S. to prevent a repeat: "You should make care that they do not make the same mistakes again," the official said. "This was a hard decision."

The Trump administration has made clear it regarded the arrests as political motivated, and had been bitterly critical of North Korea's refusal to grant consular access to the three, other than a brief visit by a U.S. envoy last June. The envoy had repatriated college student Otto Warmbier, who was sentenced to 15 years in prison with hard labor for stealing a propaganda poster. Warmbier died in June 2017, days after he arrived back in the U.S. with severe brain damage.

Since then, pressure to win the releases of the other three men, whom the administration has referred to as "hostages," has intensified.

Relatively little is known about the men, all Korean-Americans, and the circumstances in which they ended up in North Korean custody.

Kim Dong Chul, a former Virginia resident who had reportedly run a company on North Korea's border with Russia, had been sentenced in April 2016 to 10 years in prison with hard labor after being convicted of espionage. Kim Hak Song and Tony Kim, who taught at a university in Pyongyang that was founded with donations from Christian groups, had been held for about one year and apparently had not been tried.

Tony Kim's son, Sol Kim, a graduate student in California, is the only relative of the detainees to have appealed in public for their freedom. On learning of the release of Tony, who also uses the name Kim Sang-duk, his family expressed gratitude and credited Trump for engaging directly with North Korea.

Washington and Pyongyang have remained in a state of war since the fighting in the 1950-53 Korean War ended and do not have formal diplomatic ties, complicating efforts to handle the cases of American detainees. Typically, Swedish diplomats based in North Korea handle U.S. consular affairs.

Pompeo, the most senior U.S. official to meet with a North Korean leader since 2000, was making his second visit to the isolated nation in five weeks - and less than two weeks after becoming top diplomat. Some in Washington had expressed disappointment that Pompeo's first trip, made in secret when he was still CIA director, did not win the freedom of the three captives.

Pompeo said Wednesday he was "thrilled" the men were now out.