A federal judge struck down Mississippi's anti-LGBTQ bill hours before it was scheduled to go into effect on Friday, saying that it fails to "respect the equal dignity of all of Mississippi's citizens."

"This is a huge victory for the state of Mississippi and the nation," said ACLU of Mississippi executive director Jennifer Riley-Collins.

Under the so-called "religious freedom" bill, House Bill 1523, an "LGBTQ couple could be refused a wedding cake from a local baker; a couple living together but not married could be legally barred from fostering a child or renting a car; a volunteer at a suicide hotline could refuse to speak to a transgender person. The measure even explicitly allows employers to set gender-specific dress codes," as Common Dreams reported.

Plaintiffs said in their case that the law "specifically endorsed certain narrow religious beliefs that condemn same-sex couples who get married, condemn unmarried people who have sexual relations, and condemn transgender people."

When Mississippi Gov. Phil Bryant signed the bill in April, the ACLU said it gave Mississippi "the dubious distinction of being the first state to codify discrimination based on a religious belief or moral conviction that members of the LGBTQ community do not matter. "

U.S. District Court Judge Carlton Reeves wrote in his ruling (pdf) that that the law violates the First and Fourteenth Amendments of the Constitution, and was "the state's attempt to put LGBT citizens back in their place" with a "second-class status" after the U.S. Supreme Court's ruling last June legalizing same-sex marriage nationwide.

"Religious freedom was one of the building blocks of this great nation, and after the nation was torn apart, the guarantee of equal protection under law was used to stitch it back together," Reeves wrote. "But HB 1523 does not honor that tradition of religion freedom, nor does it respect the equal dignity of all of Mississippi’s citizens."

"A robust record shows that HB 1523 was intended to benefit some citizens at the expense of LGBT and unmarried citizens," he writes, adding, "There are almost endless explanations for how HB 1523 condones discrimination against the LGBT community, but in its simplest terms it denies LGBT citizens equal protection under the law."

Mississippi Today described it as "a blistering opinion that reached into Mississippi's segregationist past."

Gov. Bryant said in a statement Friday that he was disappointed in the ruling and that he looks "forward to an aggressive appeal." But Doug Clark writes at North Carolina's Greensboro.com that filing an appeal "would be a waste of time, money and any credibility the state has on human rights matters, which has never been much," and expects his own state's anti-LGBT bill, HB-2, to suffer the same fate.

Still, "the battle continues to secure full equal rights for LGBT people," Riley-Collins said. "We remain vigilant in the fight for equality and justice for all."

The judge's decision was based on the cases Barber v. Bryant and Campaign for Southern Equality v. Bryant. The ACLU had challenged the law in a separate lawsuit.