A federal judge on Monday granted an injunction blocking California from enforcing a law banning therapies which promise to “cure” gay minors.

In his ruling handed down just hours after holding a hearing on the issue, U.S. District Court Judge William Shubb said the law violates the First Amendment rights of mental professionals who practice “reparative” or “conversion” therapy, the AP reported.

“Even if SB 1172 is characterized as primarily aimed at regulating conduct, it also extends to forms of [conversion therapy] that utilize speech and, at a minimum, regulates conduct that has an incidental effect on speech,” Shubb wrote.

The measure, sponsored by state Senator Ted Lieu and signed into law by Governor Jerry Brown in October, is set to take effect on January 1.

Shubb, however, limited his ruling to plaintiffs in the case: psychiatrist Anthony Duk, marriage and family therapist Donald Welch, and counselor in training Aaron Bitzer. All three are represented by the social conservative organization the Pacific Justice Institute.

In granting the injunction, Shubb noted that he believes the group will prevail in striking down the law as unconstitutional.

Shannon Minter, legal director at National Center for Lesbian Rights (NCLR), said his group was disappointed by the setback.

“We are disappointed by the ruling but very pleased that the temporary delay in implementing this important law applies only to the three plaintiffs who brought this lawsuit,” Minter said in a statement. “The judge stressed that he was willing to issue the ruling in part because it is temporary and applies only to three individuals. We are confident that as the case progresses, it will be clear to the court that this law is fundamentally no different than many other laws that regulate health care professionals to protect patients. That is especially important in this case because the harms to minors are so serious, including suicide and severe depression.”

“Every leading medical and mental health organization in the country has rejected these practices and warned that they are not only completely ineffective, but dangerous. California did the right thing by enacting this law, and we are confident the courts will find that it is not only constitutional, but vitally necessary. It is heartbreaking to think of the terrible damage that has been done to so many LGBT youth and their families, and of the lives that have been lost or destroyed because of these discredited practices.”

(Related: Chaim Levin on undergoing “ex-gay” therapy: It wasn't kosher.)