A U.S. district judge in South Carolina overturned a decades-old state law Wednesday that prohibited discussion of LGBTQ issues in public school sex education classes. According to the ruling, the law violates the Equal Protection Clause of the 14th Amendment.

The decision was prompted by a lawsuit filed just two weeks earlier by student members of the Gender and Sexuality Alliance at the School of the Arts in Charleston County, as well as several legal and LGBTQ advocacy groups.

The law, passed in 1988, made it illegal for public school teachers to discuss “alternate sexual lifestyles from heterosexual relationships” except in the context of sexually transmitted diseases. Teachers who disobeyed the law — whether by including LGBTQ issues in their curriculum, answering a student’s question or allowing classroom discussion — could be fired.

Julie Wilensky, a senior attorney for the National Center for Lesbian Rights, which helped file the suit, said the law was clearly discriminatory and unconstitutional.

“There's no comparable restriction in the law on health education about different sex relationships,” Wilensky told NBC News. “After 32 years, students in South Carolina will no longer be harmed by this outdated law.”

South Carolina Superintendent of Education Molly Spearman was named as the defendant in the lawsuit, but the case was settled in a consent decree, meaning the resolution was mutually agreed upon. In a statement, Spearman said the court’s decision “moves South Carolina forward.”

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

“The balance of protecting freedoms and preventing discrimination will be upheld in any guidance we send to schools on this issue,” she added.

South Carolina was one of a handful of states left with a so-called no promo homo law on the books, after similar laws were repealed in Arizona last year and in Utah in 2017. Advocates say that their success in the Palmetto State can be repeated in the remaining states with anti-LGBTQ curriculum laws: Texas, Oklahoma, Mississippi, Louisiana and Alabama.

“Today makes me hopeful that states that have similar laws will realize that singling out LGBTQ students for unequal treatment in the classroom can't pass muster under the Constitution,” Wilensky said.

At the weekly Wednesday meeting of the Gender and Sexuality Alliance, the mood was celebratory. Tenth grader Eli Bundy, the club’s president, said they were shocked by how quickly the court had decided in their favor, and excited that the state Department of Education had not opposed it.

“It makes me really proud and happy to live in South Carolina,” Bundy, who is nonbinary and uses they/them pronouns, said.

For Bundy and their LGBTQ peers, the decision doesn’t just mean more inclusive sex education, but hope for a more inclusive school culture, as well. The lawsuit recounted the experience of one middle school student in Greenville, who had a Clorox wipe thrown at him and was kicked in the chest before being called “diseased” and told that the stairway to hell was “rainbow-colored.” These kinds of incidents, Bundy hopes, will be less likely in a school environment where LGBTQ identities and issues are more normalized.

“When teachers have to say that they can't talk about queer relationships, it really just sends a message that it's not acceptable,” they said. “Now that that doesn't exist anymore, my hope is that for school communities across the state, including our school specifically, the environment and the climate for LGBTQ students will be more accepting.”

In this regard, South Carolina’s public schools have room for improvement, according to a 2017 National School Climate Survey from LGBTQ advocacy group GLSEN. The survey found that 88 percent of LGBTQ students in South Carolina regularly heard homophobic slurs or remarks, and 76 percent said they’d been verbally harassed because of their sexual orientation. LGBTQ youth in general, many surveys have shown, are already significantly more likely to be bullied or have suicidal thoughts than their heterosexual peers.

Jasmine Beach-Ferrera speaks outside the courthouse after a court overturned a decades-old South Carolina law that prohibited discussion of LGBTQ issues in public school sex education classes. Campaign for Southern Equality

Jasmine Beach-Ferrara, executive director of the Campaign for Southern Equality, which also helped file the lawsuit, told NBC News that the decision bodes well for LGBTQ rights in the South as a whole.

“I think the decision is very reflective of where people in the South are,” Beach-Ferrara said. “The politics of the state or the laws of the state are catching up to where people already are in their beliefs and attitudes.”

Still, she said, there’s a long way to go in ensuring legal equality for LGBTQ Southerners. At the same time as its “no promo homo” law is being overturned, South Carolina’s state Legislature is considering two bills that would curtail the rights of transgender people in the state.

“The political reality is we are still contending with some political forces in the state that target LGBTQ folks,” she said. “But we see today's legal victory as a clear indication of what South Carolina is ready for.”

Beach-Ferrara said the decision itself is a beacon for LGBTQ youth across the South, hopeful for similar victories over their states’ anti-LGBTQ laws.

“There's a kid in Mississippi who will hear this news today and know that even if the courts or the Legislature of Mississippi haven't come to the same conclusion yet, a federal court in the South has,” she said. “And that's powerful.”

Follow NBC Out on Twitter, Facebook & Instagram