North Korea has released three US citizens, in a move that continues the apparent thawing of its relations with the United States ahead of a planned meeting between Kim Jong-un and Donald Trump.

The release of the three men, all US citizens of Korean heritage, marks a major diplomatic victory for the Trump administration and was secured during a visit to North Korea by Mike Pompeo, the US secretary of state.

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. — Donald J. Trump (@realDonaldTrump) May 9, 2018

Trump announced on Twitter that the former detainees were headed back to the US on the same flight as Pompeo. The president was scheduled to meet them at Joint Base Andrews, an air force base near Washington DC, on Wednesday night.

“They seem to be in good health,” Trump tweeted, adding that a date and location for his summit with the North Korean leader had been set, without revealing further details.

Speaking to reporters later on Wednesday morning, Trump said he would announce a site for the summit within three days but confirmed it would not be held at the demilitarised zone along the border between the two Koreas.

“President Trump appreciates leader Kim Jong-un’s action to release these American citizens, and views this as a positive gesture of goodwill,” the White House said in a statement on the prisoner release. The three men were able to walk “without assistance” to the plane.

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

Pompeo’s trip came amid a frenzy of diplomacy. Kim made a surprise trip to China on Monday for a two-day summit with the Chinese president, Xi Jinping. The visit came less than two weeks after a historic meeting between the North Korean leader and the South Korean president, Moon Jae-in.

“North Korea recognises that not releasing the detainees will call its sincerity about progress into question,” said Mintaro Oba, a former US diplomat who worked on North Korea policy. “By releasing them, it gets to look like it is the driver of progress, putting pressure on the United States to reciprocate, or at least do nothing to disrupt the good atmosphere.”

But the release will do little to bridge the chasm that remains between Washington and Pyongyang over the North’s nuclear programme, Oba said.

After Kim returned to Pyongyang from China, Trump and Xi spoke by phone and the two “agreed on the importance of continued implementation of sanctions on North Korea until it permanently dismantles its nuclear and missile programmes”, according to a summary of the call released by the White House.

Negotiations for the release of the three Americans reportedly began two months ago when North Korea’s foreign minister floated the idea during a visit to Sweden.

Tony Kim and Kim Hak-song were arrested last year just months after Trump took office and were accused of committing “hostile acts” against North Korea. Both men worked for the Pyongyang University of Science and Technology, a school founded by evangelical Christians in 2010 that mostly teaches children of the political elite.

The other detained American, Kim Dong-chul, was arrested in 2015 and later sentenced to 10 years hard labour for spying. The businessman who once ran a hotel in the North said he had tried to steal military secrets for South Korea during a staged press conference in 2016.

All three men are unrelated. The US has previously accused North Korea of arresting its citizens for use as “pawns for a political agenda”.

Otto Warmbier, an American student, was released last year after 17 months in detention, only to die several days after returning to the US. There are also six South Korean citizens, including three pastors, being held by the North, and Seoul has pledged to push for their release.

“Our government has worked to resolve the detainee issue through inter-Korean talks and cooperation with the international community,” Baik Tae-hyun, spokesman for the South’s unification ministry, said according to Yonhap news agency. “It will continue to make active efforts to bring back those detainees as soon as possible.”

The move comes as China, Japan and South Korea have agreed to work together to encourage North Korea to give up its nuclear weapons and on three-way and regional free trade agreements.

The agreements came on Wednesday at a meeting in Tokyo with the Japanese prime minister, Shinzō Abe, the Chinese premier, Li Keqiang, and South Korea’s President Moon. It was the first such trilateral summit since November 2015.

Moon called on China and Japan to play an active role in ridding the Korean peninsula of nuclear weapons.

Abe reiterated Japan’s position that it would normalise ties with North Korea only if the latter took concrete steps toward abandoning its nuclear and missile programmes and resolved the issue of Japanese citizens abducted by North Korean agents.