(CNN) A Canadian pastor imprisoned in North Korea has been freed after two and a half years in detention.

Hyeon Soo Lim, North Korea's longest-held western prisoner in decades, was "released on sick bail" Wednesday by the country's top court for "humanitarian" reasons, state-run news agency KCNA said.

Lim's son, James Lim, received word over the weekend that a plane carrying senior Canadian officials, a medical doctor, and a letter to North Korean Supreme Leader Kim Jong Un was dispatched to Pyongyang "at the last minute," according to family spokeswoman Lisa Pak. The plane landed in the North Korean capital Monday.

Lim was serving a life sentence of hard labor after being convicted of crimes against the state in December 2015. The 62-year-old's health has deteriorated while in North Korean custody and the pastor has experienced "dramatic" weight loss, Pak said.

Previous medical release

Lim's family had stepped up calls for his release since the death of University of Virginia student Otto Warmbier in June.

JUST WATCHED Kenneth Bae: Warmbier may have been tortured Replay More Videos ... MUST WATCH Kenneth Bae: Warmbier may have been tortured 02:32

Warmbier was on a sightseeing tour of North Korea when he was detained in early 2016 and later charged with attempting to steal a propaganda poster from his hotel.

He died just six days after his release from North Korea due to a brain injury sustained while in custody. He was in a vegetative state when he returned home to his family near Cincinnati, Ohio.

The US State Department has since announced a travel ban that will take effect next month, preventing nearly all US citizens from visiting North Korea, with the exception of journalists and humanitarian workers.

Illness in captivity

In letters to family, friends, and members of his church in Mississauga, Ontario, Lim has complained of stomach pain and high blood pressure.

JUST WATCHED Former N.Korea bodyguard details abuse Replay More Videos ... MUST WATCH Former N.Korea bodyguard details abuse 02:11

His family has not been allowed to see him during his imprisonment, but have been able to send him letters and blood pressure medication via the Swedish embassy in Pyongyang, which often serves as an intermediary for prisoners from nations with no formal diplomatic ties to North Korea.

"We are relieved to hear that Reverend Lim is on his way home to finally reunite with his family and meet his grand daughter for the first time," Pak said in statement to CNN.

"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 expressed gratitude to the Canadian, North Korean and Swedish governments.

"We want to thank the global community for the continued prayers and support and we also ask that the world does not forget the people of North Korea," the statement read.

Hard labor

JUST WATCHED Trump: N. Korea is a 'brutal regime' Replay More Videos ... MUST WATCH Trump: N. Korea is a 'brutal regime' 00:34

, North Korea, a family spokesperson said at the time. He was acting on behalf of the Light Korean Presbyterian Church, which he had led since 1986. Lim detained in February 2015 while on a humanitarian mission in Rajin , North Korea, a family spokesperson said at the time. He was acting on behalf of the Light Korean Presbyterian Church, which he had led since 1986.

According to his family, Lim has made more than 100 trips to North Korea since 1997, and his humanitarian efforts have included the founding by his church of a nursery, orphanage, and nursing home in the northeastern city of Rajin.

In a January 2016 interview with CNN in Pyongyang -- his first conversation with foreign media -- the Canadian said he was the sole prisoner in a labor camp, digging holes for eight hours a day, six days a week. At the time, he said he received regular medical care and three meals per day.

Left behind

At least three US citizens remain in North Korean custody.

Businessman Kim Dong-chul was detained in October 2015 and is serving a 10-year sentence for espionage.