The governor of Puerto Rico signed an executive order on Wednesday banning so-called conversion therapy for gay or transgender minors on the island.

The decision came after Puerto Rico’s House of Representatives refused to vote on a bill that would have prohibited conversion therapy, a discredited practice that proponents claim can change a person’s sexual orientation or gender identity. The measure passed the Senate this month.

“I firmly believe that the idea that there are people in our society who need treatment because of their gender identity or whom they love is not only absurd, it is harmful to so many children and young adults who deserve to be treated with dignity and respect,” Gov. Ricardo A. Rosselló said in a statement last week announcing his plans.

The original bill, introduced by Senators Eduardo Bhatia and Zoé Laboy Alvarado last spring, sought to ban conversion therapy among licensed medical professionals and in religious institutions that receive state funding.