SALT LAKE CITY -- Utah lawmakers have passed a bill repealing a controversial law forbidding discussion in classrooms of anything that could be construed as "promotion" of homosexuality.

Senate Bill 196's passage might also get the state out of a lawsuit filed by three students and a pair of gay rights groups.

The bill, sponsored by Senate Majority Whip Stuart Adams, R-Layton, passed after a technical amendment on a 27-1 vote. It now goes to Governor Gary Herbert for his signature or veto.

Equality Utah and the National Center for Lesbian Rights sued Utah and the Cache, Weber and Jordan school districts in federal court over the law nicknamed "No Promo Homo," alleging it discriminates against LGBTQ students. They claimed the law forbids discussion of things like same-sex marriage in schools and subjected students to a hostile environment in classrooms.

The lawsuit was put on hold to buy the legislature time to pass the bill. Now that it's headed to Governor Herbert's desk, it appears that the lawsuit could be resolved.

"This is a historic day for LGBTQ students in Utah," Equality Utah executive director Troy Williams said. "We commend Senator Adams and the Utah Legislature for recognizing that LGBTQ students should be treated with the same respect and dignity as straight students. The removal of discriminatory language from school curriculum will send a positive message that all students are valued in Utah."

When it comes to sex ed, the bill states that teachers must not advocate any sexual activity outside of marriage (despite sexual orientation). The bill had support from social conservatives like the Utah Eagle Forum, the Family Policy Center and LGBT rights groups.

Williams told FOX 13 that Equality Utah will next meet with the Utah Attorney General's Office to discuss unresolved issues in the lawsuit. It is possible that both sides could reach a settlement on what is taught in schools about LGBTQ issues.