China enforced a new law prohibiting citizens from being admitted to mental institutions without their consent in an attempt to crackdown on “forced detentions” allegedly used by those in power to silence dissidents.

The new regulation, which took effect Wednesday, “aims to stop mental hospital from admitting patients against their will,” the Global Times said.

Chinese psychiatric facilities will be required “to gain consent from mentally ill patients before taking them in for treatment” and respect their requests to be discharged. Although the law does not state how to determine the consent of a mentally ill person.

However, the law will not apply to “those with conditions severe enough to warrant guardianship or who have the potential to harm themselves or others,” reports the Global Times.

China’s first mental health law comes after a rights group accused authorities of locking up hundreds of thousands of people in psychiatric hospitals each year, often as a form of punishment for activists, dissidents and petitioners.

Prior to the legislation, the powerful and wealthy abuse the system to lock up opponents, with patients subjected to forced medical treatment and physical abuse such as electric shocks, Chinese Human Rights Defenders said in a report last August.