“This bill bans nonscientific ‘therapies’ that have driven young people to depression and suicide,” Gov. Jerry Brown said in a statement on Saturday after he signed the bill into law. “These practices have no basis in science or medicine, and they will now be relegated to the dustbin of quackery.”

The law, which is to take effect on Jan. 1, states that no “mental health provider” shall provide minors with therapy intended to change their sexual orientation, including efforts to “change behaviors or gender expressions, or to eliminate or reduce sexual or romantic attractions or feelings toward individuals of the same sex.”

The law was sponsored by State Senator Ted W. Lieu and supported by a long list of medical and psychological societies, as well by state and national advocates for gay rights. Also speaking up for the ban were former patients who described emotional scars they said they were left with after being pushed into the therapy by their parents and finding that they could not change their sexual orientation or did not want to.

But some therapists and conservative religious leaders who promote methods that they say can reduce homosexual desire have condemned the new law as a violation of free choice. They say that it will harm young people who want to fight homosexual attractions on religious or other grounds and warn that it will lead more people to seek help from untrained amateurs.

The use of harsh aversion techniques, like electric shock or nausea-inducing drugs, to combat homosexual desires has largely disappeared. But during the last three decades, some psychologists have refined a theory of “reparative therapy,” which ties homosexual desires to emotional wounds in early childhood and, in some cases, to early sexual abuse.

These therapists say that with proper treatment, thousands of patients have succeeded in reducing their homosexual attraction and in enhancing heterosexual desire, though most therapists acknowledge that total “cures” are rare. But their methods have come under growing attack from gays who say the therapy has led to guilt, hopelessness and anger.