HONG KONG — A Chinese human rights lawyer who took up sensitive cases of journalists, democracy advocates and followers of banned spiritual movements was released from prison on Sunday after being held for nearly five years, his wife said.

The lawyer, Wang Quanzhang, was the last of hundreds of legal workers to face prosecution after a widespread crackdown by China on the field in 2015. He was not tried until December 2018, more than three years after his detention. During his trial, which was held in secret, he was sentenced to four and half years in prison for “subversion of state power,” a charge used to target people the authorities believe are attempting to organize challenges to the ruling Communist Party.

Mr. Wang’s wife, Li Wenzu, wrote on Twitter that she received a call from him on Sunday morning saying he had been released from prison but she had said in recent days that she feared they would not be able to reunite.

Mr. Wang, 44, and his family have long lived in Beijing, the capital, but he was ordered to remain in Shandong Province, where he had been imprisoned and which is the site of his household registration, Ms. Li said. Ms. Li could not be immediately contacted. But in a video posted online she said that as a native of Hubei, where the coronavirus pandemic began late last year, she would not be allowed back into Beijing if she left because of quarantine rules.