U.S. citizens Kenneth Bae and Matthew Todd Miller have been freed from detention by the North Korean government and are returning to the United States, the U.S. government said on Saturday.

Bae and Miller were being accompanied home by James Clapper, the director of national intelligence, his office said. Their release comes less than three weeks after another American was freed by Pyongyang.

Bae, a missionary, was arrested in North Korea in November 2012 and sentenced to 15 years of hard labor for crimes against the state. Miller, who reportedly was tried on an espionage charge, had been in custody since April this year and sentenced to six years of hard labor.

The United States frequently called for their release for humanitarian reasons, especially because Bae was said to have health problems.

“We are grateful to Director of National Intelligence Clapper, who engaged on behalf of the United States in discussions with DPRK authorities about the release of two citizens,” the U.S. State Department said in a statement after the men were freed.

“We also want to thank our international partners, especially our Protecting Power, the government of Sweden, for their tireless efforts to help secure the freedom of Mr. Bae and Mr. Miller.”

Sweden serves as a diplomatic intermediary for the United States in North Korea, as Washington has no diplomatic ties with Pyongyang.

The U.S. government gave no other details yet of how the release came about, and Clapper’s role was unexpected.

In late October, North Korea freed Jeffrey Fowle, 56, a street repair worker from Miamisburg, Ohio, who had been arrested in May for leaving a Bible in a sailor’s club in the North Korean city of Chongjin, where he was traveling as a tourist.

In September, the authoritarian North Korean government allowed Bae, Miller and Fowle to be interviewed by CNN and the Associated Press. The men said they were being treated humanely and appealed to the U.S. government to push for their release.

The interview was seen as a sign that North Korea was looking for a way to open dialog with Washington

North Korea has been on a diplomatic campaign to counter charges by a U.N. body that highlighted widespread human rights abuses and a move by some U.N. members to refer the state to an international tribunal.

Miller, of Bakersfield, California, and said to be in his mid-20s, had gone to North Korea on a tourist visa, which state media said he tore up while demanding Pyongyang grant him asylum. He was traveling without foreign guides, according to Uri Tours, the company that organized the trip.

The Associated Press reported Miller was tried on espionage charge and prosecutors at his trial said he had falsely claimed to have secret information about the U.S. military stationed in South Korea.

Despite North Korea’s poor record on human rights and stand against religion, tourism to the isolated country has increased markedly in the past few years, with some tour operators estimating a tenfold increase in Western visitors in the past decade.