(RNS) — North Korea has released a Canadian pastor who was convicted of attempting to undermine the regime of Kim Jong Un.

The pastor was freed on humanitarian grounds, state media reported Wednesday (Aug. 9).

The Rev. Rim Hyon Su, also known as Hyeon Soo Lim, was accused by the state of using religion as a ruse to overthrow the government. He was sentenced to life imprisonment in December 2015.

Lim, who is in his 60s, had written to his family members about stomach pains and high blood pressure, according to CNN. In an interview with the network in 2016, he said he prayed daily and was the sole prisoner in his camp, where he was forced to dig holes eight hours a day, six days a week. He asked for a Bible but did not receive one.

The South Korean-born pastor of Toronto's Light Korean Presbyterian Church had pleaded guilty to trying to undermine the worship of Kim, which is required of all North Koreans.

The state is officially atheist, with a constitution that guarantees freedom of religious belief. In practice, it has one of the bleakest human rights records in the world and harshly persecutes the religious, according to Human Rights Watch.

Lim's family said he had traveled to North Korea more than 100 times since 1997, where his church ran missions to support an orphanage and to distribute food.

The pastor's release came a day after Canadian officials confirmed that a delegation had traveled to North Korea to discuss his imprisonment. Concern over his fate increased after North Korea released an American student in a coma in June.

Otto Warmbier, 22, who had suffered brain damage, died six days later.

In response, the U.S. State Department announced a ban on Americans' travel to North Korea. That ban, which goes into effect on Sept. 1, allows those who want to participate in humanitarian missions to North Korea to apply for a special passport to do so.

President Trump and North Korean officials this week are exchanging bellicose words over the regime's nuclear missile program. Last month North Korea announced the successful test of an intercontinental ballistic missile that could reach California.

At least three Americans remain in North Korean custody: businessman Kim Dong-chul, academic Kim Sang-duk and self-described Christian missionary Kim Hak-song.

READ: Detention of American Christian in North Korea ‘concerning’ — White House

Hak-song, who was taken into custody in May, taught at Pyongyang University of Science and Technology. The university, founded in 2010 with donations from South Korean and American Christians, including the Illinois-based Church of the Brethren, remains the only private university in the country.

The American nonprofit Open Doors, which advocates for persecuted Christians worldwide, lists North Korea as the most oppressive nation for Christians in the world. It estimates that there are 300,000 Christians in the nation of 25 million.