SEOUL, South Korea — A Canadian pastor who had been sentenced to hard labor for life in North Korea was released on humanitarian grounds on Wednesday, the North’s official media said.

The Rev. Lim Hyeon-soo, a South Korea-born pastor of the Light Korean Presbyterian Church in Toronto, received his penalty in December 2015, when North Korea’s Supreme Court convicted him of carrying out “subversive plots” and committing “activities against” the country, like harming the dignity of the supreme leadership of Kim Jong-un.

Mr. Lim was released on Wednesday, when the same court decided to free him on sick bail, the North’s official Korean Central News Agency said. The agency’s one-sentence dispatch gave no further detail.

The release of Mr. Lim came two months after an American college student, Otto F. Warmbier, died shortly after he was freed from North Korea while in a coma. Mr. Warmbier, 22, was serving a sentence of 15 years of hard labor for trying to steal a political poster from a Pyongyang hotel.