California’s unprecedented ban on gay conversion therapy for minors is back on the books.

In a decision that could spark a U.S. Supreme Court review, a federal appeals court on Thursday upheld the state’s new law barring the practice of counseling minors to convert from homosexuality, rejecting the free speech and religious rights arguments of therapists and families who support the practice.

The 9th U.S. Circuit Court of Appeals unanimously concluded that the ban, the first of its kind in the nation, did not violate the free speech rights of therapists and was within the state’s authority to outlaw medical or mental health practices it considers harmful to minors. The court also rejected the argument the law interferes with parents’ rights to seek such counseling for their children.

“Fundamental rights of parents do not include the right to choose a specific type of provider for a specific medical or mental health treatment that the state has reasonably deemed harmful,” 9th Circuit Judge Susan Graber wrote for the three-judge panel.

In two separate cases, a group of therapists and families sued over the ban, arguing that it violates the free speech rights of therapists to discuss gay conversion with young patients and tramples on parents’ religious freedom to seek therapy to convert their children from homosexuality. The law barred licensed mental health professionals from using the therapy on youths under the age of 18.

One federal judge had blocked enforcement of the law while the case is on appeal, while another refused to issue an injunction. The 9th Circuit has now lifted the injunction against the ban, although the therapists and families can ask the court to reconsider the case with an 11-judge panel.

The Pacific Justice Institute, one of the organizations challenging the ban, vowed to appeal.

“This decision is a dark day for those who believe in the First Amendment and the right of parents over the proper upbringing of their children,” said Brad Dacus, the institute’s president.

Opponents of the ban have expressed concern that other states would follow California if courts uphold the law. In fact, while the 9th Circuit was considering the case, New Jersey recently adopted a similar ban on gay conversion therapy, and that law has been challenged in federal court.

California legislators and gay rights advocates sought to abolish the therapy for minors, arguing that it stigmatizes youths and can lead to depression and even suicide. Gay rights groups praised the decision, as did some of the individuals who were forced to undergo the therapy and testified about its harmful effects.

“My first response at hearing (about the ruling) was chills and tears,” said James Guay, a pastor’s son who lived in San Francisco for 20 years until recently moving to West Hollywood. “This barbaric treatment has been deemed ineffective and likely harmful by all the legitimate medical and mental health associations.”

Howard Mintz covers legal affairs. Contact him at 408-286-0236 or follow him at Twitter.com/hmintz.