Washington (CNN) US President Donald Trump announced Wednesday that three Americans held in North Korea have been released and are on their way back home.

"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. They seem to be in good health," Trump tweeted.

The Americans -- Kim Dong Chul, Kim Hak-song and Kim Sang Duk, also known as Tony Kim -- were freed while Pompeo was on a visit to the North Korean capital of Pyongyang to discuss President Trump's upcoming summit with North Korean leader Kim Jong Un.

Trump said Pompeo and his "guests" will be arriving at Joint Base Andrews in Maryland at 2 a.m. ET, presumably Thursday, where he will greet them.

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. They seem to be in good health. Also, good meeting with Kim Jong Un. Date & Place set.

The three men issued a joint statement thanking Trump.

"We would like to express our deep appreciation to the United States government, President Trump, Secretary Pompeo, and the people of the United States for bringing us home," the trio said in the statement which the State Department supplied to journalists traveling with Pompeo.

'Thrilled'

Kim Dong Chul has been in North Korean custody since late 2015, but the other two detainees were arrested last spring, after Trump's inauguration as tensions between Washington and Pyongyang were beginning to ramp up.

The White House has often brought up their cases when discussing North Korea issues. As both sides began laying the groundwork for the Trump and Kim's meeting -- which would be the first-ever between a sitting US President and North Korean leader -- the Trump administration made it clear that releasing the three Americans would be viewed as a gesture of good will.

In this Wednesday, photo provided on Thursday by the North Korean government, US Secretary of State Mike Pompeo shakes hands with North Korean leader Kim Jong Un.

Aboard the plane leaving North Korea, Pompeo said he was "thrilled to have them back."

Pompeo told the small contingent of reporters traveling with him that the detainees appear to be in good health, or at least as healthy as can be considering the circumstances surrounding their detention.

"I had productive meetings in Pyongyang with Chairman (Kim Jong Un) and made progress. I'm delighted to bring home three Americans," he said on Twitter.

I had productive meetings in Pyongyang with Chairman Kim Jong-un and made progress. I'm delighted to bring home three Americans. — Secretary Pompeo (@SecPompeo) May 9, 2018

Both Trump and Pompeo said the meetings with Kim went well -- the President called it a "good meeting" in a tweet -- and confirmed that a date and location for the summit has been set, echoing a similar comments made Tuesday at the White House.

The state-run Korea Central News Agency said that Kim decided to release the Americans at Trump's suggestion. It added that Pompeo and Kim "reached a satisfactory consensus on the issues discussed" and described the talks as "very beneficial."

Kim and Pompeo meet in Pyongyang.

"We're honored by the fact that the three gentlemen are coming home and I look forward to seeing you," Trump said during a Cabinet meeting on Wednesday.

Secretary Pompeo and his "guests" will be landing at Andrews Air Force Base at 2:00 A.M. in the morning. I will be there to greet them. Very exciting! — Donald J. Trump (@realDonaldTrump) May 9, 2018

Goodwill gesture

A statement released by the White House said Trump "appreciates Kim Jong Un's action to release these American citizens and views this as a gesture of goodwill."

"The three Americans appear to be in good condition and were all able to walk on the plane without assistance. All Americans look forward to welcoming them home and to seeing them reunited with their loved ones," the statement said.

The family of Tony Kim specifically thanked Trump for working to secure the Americans' release.

"We are very grateful for the release of our husband and father, Tony Kim, and the other two American detainees. We want to thank all of those who have worked toward and contributed to his return home. We also want to thank the President for engaging directly with North Korea. Mostly, we thank God for Tony's safe return," the family wrote in a statement Wednesday.

"We appreciate all of the support and prayers of friends and even strangers during this challenging year. You are dear to our hearts. We ask that you continue to pray for the people of North Korea and for the release of all who are still being held. Thank you," it added.

Tony Kim and Kim Hak-song, who were arrested in April and May of 2017, respectively, were both accused of carrying out "hostile acts" against the Kim Jong Un regime. Both worked at the Pyongyang University of Science and Technology , which bills itself as the only privately run university in the North Korean capital.

Joseph Yun, who until March was the administration's top diplomat working on North Korea issues, told CNN the release of the three Americans is "terrific news" and he hopes they "are in good health."

"I'm delighted for their families, as you know I've met all three of them last year when I was there, so I couldn't be more delighted," he said, adding now the US must close this chapter and move on with summit preps.

"What happens to denuclearization, what happens to peace treaty ... those are the key issues we need to concentrate (on)," said Yun, who is now a CNN global affairs analyst.

An official with knowledge of the negotiations previously told CNN that the North Koreans decided to free the Americans two months ago, and that North Korea's foreign minister, Ri Yong Ho, had proposed their release during his visit to Sweden in March

At the time, US officials insisted that their release "must not be related or used to loosen the main issue of denuclearization," the source said, but that message seems to have changed in recent days, according to a source at the National Security Council, who said the development would be viewed as a goodwill gesture ahead of the planned summit with Kim Jong Un.

Trump and his allies outside the government had sought to fan the heightened expectations ahead of Wednesday's announcement, casting the potential development as evidence of his negotiating prowess ahead of the summit.

Trump had hinted at a potential development in their case last week in a tweet: "As everybody is aware, the past Administration has long been asking for three detainees to be released from a North Korean Labor camp, but to no avail. Stay tuned!"

He did not mention that two of the Americans had been detained after he became President.

And Rudy Giuliani, a member of Trump's legal team but not himself an employee of the government, teased the release last week as well.

CLARIFICATION: This story has been updated near the end of the story to reflect that the announcement was made on Wednesday.