Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A Canadian pastor serving a life sentence in North Korea was freed on "humanitarian" grounds because of his health, the country's state-run news agency said.

Hyeon Soo Lim was convicted and sentenced to hard labor for life in December 2015 after North Korea accused him of trying to overthrow the regime. He was first arrested in February 2015, but details about the 62-year-old's condition were not provided by the Korean Central News Agency, which said he was released on "sick bail."

Canadian Prime Minister Justin Trudeau confirmed the release Thursday and said he was "pleased and relieved" the pastor "will soon be reunited with his family and friends in Canada."

"Pastor Lim’s health and well-being remain of utmost importance to the Government of Canada, and we are working to ensure that he receives any required medical attention," he added.

The family said in a statement that they were "relieved" and "grateful" he is being allowed to return to Canada. Details of when the pastor would return home were not provided.

The sudden release of Lim, also known as Rim Hyon Su, comes amid flaring tensions between North Korea and the United States. On Tuesday, President Donald Trump told the isolated nation thatany threat to America would be met with "fire and fury." Hours later, the North responded by saying it was "seriously reviewing" a plan to strike the U.S. Pacific territory of Guam.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Lim is affiliated with the Toronto-area Light Korean Presbyterian Church, one of the largest churches in Canada. Members have said he visited North Korea regularly since 1997 — when the country was gripped by extreme famine — to organize orphanages and nursing homes.

Related: Three Americans Still Held by North Korea Following Otto Warmbier’s Release

But Pyongyang charged that he used religion to undermine the government and sought to help North Korean citizens leave the country. In other cases of foreign missionaries being detained, the totalitarian government has accused them of anti-state crimes under the guise of offering humanitarian aid.

At his 2015 sentencing, Lim told the court: "I deeply, deeply apologize from my heart for my indescribable treason."

Human rights groups say it's not uncommon for prisoners to provide a coerced confession.

Lim had been held with at least three other Americans who remain detained.

A fourth American, college student Otto Warmbier, was sentenced to 15 years of hard labor in March 2016. He mysteriously fell ill during his imprisonment — the North claimed it was a combination of botulism and a sleeping pill — and was released to a U.S. hospital, where he died in June.

Related: Family of Pastor Imprisoned in North Korea Concerned After Warmbier's Death

After Warmbier's death, the Lim family called for Canada to be more aggressive in ensuring their patriarch's release and questioned the status of his health.

"The family is very concerned at this point," family spokeswoman Lisa Pak said in June, according to Reuters. "They are hoping the Canadian government will turn (efforts) up a few notches in terms of active diplomacy and really start engaging."

Canada does not have an embassy in North Korea. But a Swedish ambassador visited Lim earlier this year on behalf of the country, and said he was in decent health, according to Pak.

She said in a statement Thursday that the family is "anxious" for Lim's return and that they want him to meet his granddaughter for the first time.

"There is a long way to go in terms of Reverend Lim's healing, therefore, in the meantime we ask the media for privacy as he reconnects with his loved ones and receives medical attention," the family said.