Colorado on Friday became the 18th state to ban “conversion therapy” for minors, a discredited practice that aims to change a person’s sexual orientation or gender expression.

Gov. Jared Polis of Colorado, who is gay, signed the bill into law a day before the start of Pride Month for the L.G.B.T. community. He also signed a bill making it easier for transgender people to change the gender listed on state-issued documents.

On Wednesday, Maine outlawed conversion therapy, and New York and Massachusetts have also enacted laws banning the practice this year.

Conversion therapy has been around for more than a century. Its most common technique is talk therapy, although it is not uncommon for practitioners to use aversion treatment such as inducing nausea, vomiting or paralysis when a person is aroused by same-sex images, according to a 2018 study by the Williams Institute of the School of Law at the University of California, Los Angeles. In some cases, electric shock has been used, the study said.