A controversial law that prohibits South Carolina teachers from mentioning LGBTQ identities during sex education lessons unless it's presented within the context of sexually transmitted diseases has been overturned.

The U.S. District Court in Charleston invalidated the provisions of the 1988 law on Wednesday, declaring they violated the Equal Protection Clause of the U.S. Constitution and barring state officials from continuing to enforce it.

Jeff Ayers, executive director of South Carolina Equality Coalition, said the decision was the first of its kind.

The South Carolina case "made history" by being the first successful challenge to such state laws, Ayers said.

Similar sex ed laws were addressed in Arizona and Utah, but were overruled by state legislators before the challenges made their way through the legal system, Ayers said.

"LGBTQ students can now feel as if they are equal in schools all across South Carolina and not be treated as inferior any longer. It's a great day in South Carolina and shows the rest of the country that we are not afraid to stand up against discrimination and challenge issues in the courts when necessary," Ayers said.

The lawsuit alleged the provision of the S.C. Comprehensive Health Education Act discriminates against LGBTQ students by singling them out in the classroom and stopping them from receiving relevant sexual-health education.

The consent decree issued by District Judge David Norton was a mutual agreement between state Superintendent Molly Spearman and the Charleston County School of the Arts Gender and Sexuality Alliance, the Campaign for Southern Equality and the South Carolina Equality Coalition.

Spearman was named as the defendant in a federal lawsuit challenging the statute filed two weeks ago by The National Center for Lesbian Rights and Lambda Legal.

Spearman said the court's decision "moves South Carolina forward by striking down discriminatory language that put our classroom instruction at odds with the Constitution."

"Importantly, the decision also maintains every parent’s right to choose whether or not their child participates in health education curriculum," Spearman said. "The balance of protecting freedoms and preventing discrimination will be upheld in any guidance we send to schools on this issue.”

Teachers who refused to comply with the law and talked about LGBTQ relationships during sex ed without mentioning STDs could be fired.

"This just opens the door now for teachers to have open discussions with students if it comes up in the classroom," Ayers said.

Eli Bundy, a 10th-grade student at the Charleston County School of the Arts and president of the school's Gender and Sexuality Alliance, said they saw the effects of the law first-hand.

"I know how frustrating it can feel to be told by a teacher that they can’t talk about who you are. I’m so grateful that no other South Carolina student will have to go through school feeling like they have been erased," Bundy said.

Last month, Spearman asked S.C. Attorney General Alan Wilson to weigh in on the law. His office issued an opinion on Feb. 18 that said a court would likely find the existing provision to be a violation of the 14th Amendment’s Equal Protection Clause.

According to the judgment, Spearman has 60 days to issue a memorandum to members of the state Board of Education and the superintendents of every public school district in South Carolina alerting them of the change.

Last month's lawsuit was filed with assistance from private counsel Womble Bond Dickinson, Brazil & Burke and University of Utah law professor Clifford Rosky.