China adopted a law on Friday to protect for the first time the rights of the mentally ill after years of accusations that psychiatric hospitals are used to lock up people against their will and silence dissidents.

Human rights advocates called the hard-fought for law, which has been debated for more than two decades, significant, even though they say it still falls short of international standards as it allows for involuntary commitment without judicial review.

The law will "curb abuses regarding compulsory mental health treatment and protect citizens from undergoing unnecessary treatment or illegal hospitalization", the Xinhua state news agency said.

"We welcome it because having a law is better than not having one," Nicholas Bequelin, a researcher at Human Rights Watch, a New York-based advocacy group, told Reuters.

"The most important thing that this law does is it will allow civil society to step in to monitor and press for improvement in the management of mental health in China, including ... pushing for greater transparency and progressive curtailment of police rights."

Activists have long argued that authorities force people they consider troublemakers into psychiatric hospitals without providing any evidence of their supposed crimes.

The tactic has been used to silence dissidents, whistle-blowers and petitioners. More recently, it has been used by people against relatives during family disputes.

State media has reported on people being locked up in psychiatric hospitals against their will.

Chen Guoming, a former gold store owner, was forced into an asylum in 2011 by his wife and locked up for 56 days after refusing to lend money to his wife's family, Xinhua said.

The new law bans mental health examinations of a citizen against his or her own will, Xinhua said.

But Bequelin said he was still concerned about China's police-run psychiatric hospitals, which confine people the authorities consider troublemakers.

China had long been criticized for its lack of a mental health law, which did not give people the right to an independent review of their mental health status.

The lack of a law contravened the Convention on the Rights of Persons with Disabilities, a U.N. treaty ratified by China in 2008, rights group Chinese Human Rights Defenders said in an August report.

China has about 16 million people suffering from severe mental disorders, Xinhua said, citing the Health Ministry.