Prime Minister Justin Trudeau's decision to dispatch an envoy was key to securing the release of a Canadian pastor imprisoned in North Korea, says a Canadian with knowledge of the case.

As was first reported in state-run media in North Korea, Daniel Jean, the national security and intelligence adviser to Trudeau, led a delegation to the capital city of Pyongyang to discuss the case of Toronto Presbyterian minister Rev. Hyeon Soo Lim.

The Canadian, who spoke to CBC News and asked not to be identified, said the six-member delegation arrived earlier this week. The outcome — Lim's release — was a certainty from North Korea's perspective, but Canadian officials were still not sure it was a done deal.

"Right up until the very end, I guess our government did not trust the process," said the source, who had knowledge of the events leading up to Lim's release.

State-run North Korean media reported Lim was freed on "sick bail … from the humanitarian viewpoint."

Hyeon Soo Lim, also known as Rim Hyon Su, was sentenced to hard labour for life in December 2015 for what North Korea says was an attempt to overthrow the regime. (KNCA/Reuters)

Lim was arrested in February 2015, when the Conservative government of Stephen Harper was in office, and was sentenced in December of that year to a life of hard labour for allegedly trying to overthrow the regime.

In a statement released early Thursday morning, Trudeau confirmed Lim's release and the details of Jean's mission to North Korea. The prime minister said that the pastor "will soon be reunited with his family and friends in Canada."

"The Government of Canada was actively engaged on Mr. Lim's case at all levels," he added.

"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 continued. "Operational security considerations prevent us from discussing the matter further."

The prime minister also thanked Sweden for acting as a protecting power during the negotiations.

Canadian Pastor Lim released from jail in North Korea. Glad Sweden, as Canada's protecting power in NK, could assist <a href="https://t.co/I6O10looX3">https://t.co/I6O10looX3</a> —@margotwallstrom

The Canadian source, however, said the scenario could have played out more simply and swiftly if the federal government had agreed earlier to provide high-level communication. After a foreign national receives a life sentence, only the North Korean Chairman Kim Jong-un can grant clemency according to the Constitution, the source said.

Exact ETA still unknown

Officials in the Prime Minister's Office did not confirm any further details about Lim's release or when exactly he is expected to be back on Canadian soil.

Lim's release comes after Otto Warmbier, a 22-year-old U.S. student, died one week after his release from North Korea after 17 months in prison. He returned in a coma, and his family believes he was tortured and left in a vegetative state.

North Korea released another foreign prisoner, U.S. tourist Otto Warmbier, in June, though he died just days later. (Kim Kwang Hyon/Associated Press)

Jack Kim, special adviser for HanVoice, a group that advocates for human rights in North Korea, said the timing of Lim's release could be related to the Warmbier case as well as the pastor's reported ailing health. North Korea holds all the cards, as no Western countries have any leverage with the regime, he said.

North Korea also uses high-profile cases as a domestic propaganda tool, with the visits of leaders of senior officials lending legitimacy to the regime.

"The fact that the North Koreans were the first ones to announce this goes to show they see the propaganda value out of it," he said.

Lim served at one of the largest churches in Canada, Light Korean Presbyterian Church in Mississauga, Ont.

The 62-year-old, who was born in South Korea, is reportedly in poor health and needs medication to treat high blood pressure.

'Great relief'

Conservative Sen. Yonah Martin, who was instrumental in keeping the case before the federal government, welcomed news of the release as a "great relief."

She agreed recent developments served as a "wake-up call" for Lim's supporters as well as the authorities holding him.

"I think the death of Otto Warmbier and the failing health of Rev. Lim — and this is my opinion — would give North Korean officials cause to worry," said Martin. "I'm told by people who do humanitarian work in North Korea that they hold a very positive view of Canada and I always knew in my heart that the release of Rev. Lim was possible."

While she does not have direct knowledge of the negotiations, Tina Park, executive director of the Toronto-based Canadian Centre for the Responsibility to Protect, does understand Kim Jong-un's regime and its desire to be taken seriously on the world stage.

And that is a significant dilemma Canadian officials faced.

Treating Jong-un as equal?

Park said they had to ask themselves, in the current high-tension climate: "Are we giving more legitimacy to the North Korean dictator by speaking to his people and treating him as an equal? Her answer to that question is a heavily qualified: "Yes ... perhaps."

But Park argues the life of an important humanitarian hung in the balance.

"I think the prime minister and his advisers did the right thing by stepping up and actually saving someone's life," she said.

The release comes as tensions mount between Pyongyang and Washington over North Korea's missile and nuclear weapons tests. The isolated state said it is considering an attack against the U.S. territory of Guam after U.S. President Donald Trump threatened it with "fire and fury like the world has never seen."

Lim's church has said he had visited North Korea more than 100 times since 1997 and helped set up an orphanage and nursing home. Canada does not have an embassy in North Korea, and has advised against all travel there.

Daniel Lee, president of the Korean Canadian Cultural Association, called Lim's release good news for the community and entire country.

"One of us is coming back home after years of unjust accusations," he said.