Republican Massachusetts Gov. Charlie Baker has signed a new law banning licensed health care professionals from trying to help patients under age 18 who struggle with same-sex attraction.

The move blocks health care providers from trying to "change behaviors or gender expressions, or to eliminate or reduce sexual or romantic attractions or feelings toward individuals of the same sex."

Health care professionals are also not allowed to advertise sexual orientation change efforts.

Anyone who violates the law will be subject to punishment, including suspension or revocation of their medical license.

Massachusetts is the 13th state to pass such a law.

Democratic state Rep. Kay Khan authored the legislation and said it will protect that well-being of LGBTQ minors.

"This bill will ensure that children receive therapy in a healthy, evidence-based and medically sound manner, not one which fosters an atmosphere of self-hate, prejudice and intolerance," Khan said. "Massachusetts has always been a trailblazer in advancing civil rights and eliminating discrimination in health care settings for the LGBTQ community. This bill is a necessary extension of these historic commitments."

Meanwhile, Republican state Rep. Shawn Dooley argued the bill violates the free speech rights of medical professionals.

"The reality is we are legislating what can be said between a doctor and his patient in the sanctity of that relationship," Dooley said. "Let's say an 8-year-old boy comes in and says, 'I'm an 8-year-old girl.' Maybe that therapist — and many therapists I've spoken to have brought this up — wants to push back a little bit. Maybe that child isn't transgender, maybe that child's gay, maybe that child's bi. Why not give every opportunity for that therapist to explore that? Why can't the therapist say, 'No, you're not?'"

The conservative Massachusetts Family Institute's President and General Counsel Andrew Beckwith said, "MFI will pursue legal action against the Counseling Ban to defend the constitutional rights of parents and counselors in our Commonwealth."

"This law is an extraordinarily invasive assault on the rights of parents to raise their children and a violation of the First Amendment right to free speech for the counselors whose help they seek," the group said in a previous statement.