/ Updated  / Source: Associated Press

Utah lawmakers took the first step Tuesday to get rid of a state law that bans the "advocacy of homosexuality" in schools, a move driven by a court challenge from gay rights groups.

The Senate Education Committee voted unanimously in favor of a Republican bill cutting the phrase from sex education law. The National Center for Lesbian Rights and Equality Utah sued last fall, saying the law creates a "chilling culture of silence that stigmatizes LGBTQ students" and exists only to express disapproval of being gay.

A number of states have similar laws, but few others are moving to overturn them, Equality Utah said. However, the group said it is not ready to drop the lawsuit.

The bill replaces the law's ban on the "advocacy of homosexuality" with a ban on the "advocacy of premarital or extramarital sexual activity," which already is generally outlawed in Utah schools.

Republican state Sen. Stuart Adams, who is sponsoring the proposal, said the replacement makes it clear that the state does not want teachers to promote sex outside marriage when they present opt-in, abstinence-based sex education.

Sen. Stuart Adams, R-Layton, speaks about Health Education Amendments Senate Bill 196 during the legislature in Salt Lake City on Tuesday, Feb. 21, 2017.Jeffrey D. Allred / AP

Adams told lawmakers that the change is important because it allows all children, including LGBTQ students, to be treated equally and know they are welcome.

Doubling down on the sex-outside-marriage ban appeared key to securing support from several conservative groups. They testified in favor of the bill, saying they want all students to know they should not have sex outside marriage.

"This could have been a very divisive bill with hours and hours of debate," Republican Sen. Howard Stephenson said. "But what you've done here is create win-win."

The proposal now goes to the full Senate for debate, though its passage won't necessarily end the lawsuit, Cliff Rosky, Equality Utah's legal adviser, told reporters after he testified in favor of the bill.

The group wants to make clear that schools can't use other loopholes in Utah law or even refer to the state's now-overturned ban against same-sex marriage to discriminate against LGBTQ students, he said.

Another part of the sex education law, for example, bans instruction that could "facilitate or encourage the violation of any state or federal criminal law," Rosky said. Utah still has laws on the books banning same-sex marriage and criminalizing sodomy, though both have been overturned by the U.S. Supreme Court.

RELATED: Alleged Draft Letter Would Rescind Justice Department’s Transgender Student Policy

"We have to make sure that every public school in the state understands that they can't be enforced even with respect to the sex-ed law," Rosky said.

The gay rights group and the state filed a joint motion Friday asking a federal court to pause the lawsuit while lawmakers consider the bill.

Equality Utah Executive Director Troy Williams said that if the bill passes, it would alleviate much of the group's concerns. But the group would still work to address the others through the courts or a settlement, Williams said.

Adams, the bill sponsor, said later Tuesday that the attorney general's office suggested lawmakers change the law, but he didn't know if they expected it to end the lawsuit.

Dan Burton, a spokesman for Attorney General Sean Reyes, said Adams' bill addresses issues that at the core of the lawsuit. But he added: "We cannot predict what the court will do."

Follow NBC Out on Twitter, Facebook and Instagram.