Pressure has grown on Chinese government following cases of people forced into mental hospitals when they did not need treatment. Photograph: Peter Parks/AFP/Getty Images

China's legislature has passed a mental health law that aims to prevent people from being involuntarily held and treated in psychiatric facilities – abuses that have been used against government critics and have triggered public outrage.

The law standardises mental health care services, requiring general hospitals to set up special outpatient clinics or provide counselling, and calls for the training of more doctors.

The long-awaited law attempts to address the lack of mental health care services for a population that has grown more prosperous but also more aware of modern-day stresses and the need for treatment.

Pressure has grown on the Chinese government after state media and rights activists reported cases of people forced into mental hospitals when they did not require treatment. Some were placed there by employers with whom they had wage disputes, some by family members in fights over money, and others – usually people with grievances against officials – by police who wanted to silence them.

The law states for the first time that mental health examinations and treatment must be conducted on a voluntary basis, unless a person is considered a danger to himself or others. Only psychiatrists will have the authority to commit people to hospitals for treatment, and treatment may be compulsory for patients diagnosed with a severe mental illness.

Under the law, police still may send people for diagnosis – a common practice in many countries. Significantly, the law gives people who feel they have been unnecessarily admitted into mental health facilities the right to appeal.