The three Americans freed from North Korean labor camps waved and smiled as they were greeted by President Donald Trump at a military base near Washington early Thursday.

Kim Hak-song, Kim Dong-chul and Kim Sang-duk, who is also known as Tony Kim, were granted amnesty by North Korean leader Kim Jong Un after spending up to two years in detention accused of crimes against the regime.

"It is like a dream. We are very, very happy," Kim Dong-chul told reporters through a translator after arriving back in the U.S.

Trump expressed gratitude to the North Korean dictator and said he was optimistic about their planned talks.

"We want to thank Kim Jong Un," the president said. "I really think he wants to do something ... and bring his country into the real world. I really think we have a very good chance of doing something very meaningful."

The plane carrying the three American citizens of Korean descent touched down at Joint Base Andrews in Maryland at 2:42 a.m. ET, more than 20 hours after they were handed over to U.S. officials at a hotel in Pyongyang.

The trio was accompanied by Secretary of State Mike Pompeo, who had been visiting North Korea to finalize a place and time for historic face-to-face talks between Trump and Kim Jong Un.

Alongside first lady Melania Trump, the president walked up the steps of the plane to shake hands with the former detainees before they were taken to the Walter Reed Medical Center to be examined.

Trump told reporters it was "a special night for these three really great people," adding, "They've been through a lot."

The president also paid tribute to Otto Warmbier — the 22-year-old University of Virginia student who died after being released from a North Korean labor camp last year — and said his proudest moment would come only "when we denuclearize that entire [Korean] Peninsula."

Tony Kim, 59, was detained at Pyongyang airport in April 2017 as he was preparing to leave the country. The accounting professor had been working at the Pyongyang University of Science and Technology, an institution privately funded by Christian groups in the West. His return means he will be home for the birth of his first grandchild over the summer.

Kim Hak-song, who was also working at the science and technology university, was held in May 2017 for "hostile acts against the republic." Kim was doing agricultural development work unrelated to the university, the institution said.

The longest held was Kim Dong-chul, who was sentenced to 10 years in prison with hard labor in April 2016 for espionage and subversion. Paraded before cameras ahead of his trial, he said he had spied for South Korean intelligence authorities in a plot to bring down the North’s leadership and had tried to spread religion among North Koreans. However, South Korea's National Intelligence Service said the case wasn’t related to the agency in any way.

Kim Dong-chul addresses a news conference in Pyongyang, North Korea, in 2016. KCNA via KNS / AFP - Getty Images

In a statement Wednesday, Tony Kim's family said, "We are very grateful."

A North Korean official came to Pyongyang's Koryo Hotel at 7 p.m. local time Wednesday (6 a.m. ET) to say Kim Jong Un had granted the three detainees amnesty. Pompeo was told that he should make sure they "do not make the same mistakes again," according to a U.S. official who was present.

The proposed meeting between Kim Jong Un and Trump come after punishing sanctions leveled against North Korea in response to its missile and nuclear tests.

Last month, Kim Jong Un said that his country would suspend nuclear and missile tests, stating further ones were unnecessary.

He also met South Korean President Moon Jae-in met at a historic summit in late April.

The White House has credited its campaign of "maximum pressure" for creating an atmosphere for dialogue with North Korea.

North Korean state media KCNA said Thursday, "Such nonsense is a sophistry that can be made only by those with the Cold War way of thinking."