Tennessee State Capitol, Nashville, Tennessee.
Washington CNN  — 

A federal judge on Tuesday struck down a Tennessee law that required some businesses to post signs outside their bathroom doors if they allow transgender or nonbinary people to use those that match their gender identity – a policy LGBTQ advocates charged was “offensive and humiliating” for members of the community and could lead to harassment.

US District Judge Aleta Trauger of the Middle District of Tennessee had temporarily halted the state from enforcing HB 1182 last July after it went into effect earlier that month. But Trauger, in a new ruling issued exactly a year after Republican Gov. Bill Lee signed the bill into law, said the measure was in clear violation of the US Constitution’s First Amendment protections.

“It would do a disservice to the First Amendment to judge the act for anything other than what it is: a brazen attempt to single out trans-inclusive establishments and force them to parrot a message that they reasonably believe would sow fear and misunderstanding about the very transgender Tennesseans whom those establishments are trying to provide with some semblance of a safe and welcoming environment,” Trauger wrote in her ruling.

“The act fails the constitutional standard that actually applies to it, and the inquiry should end there,” the judge added, referring to the fact that the law was examined using the “strict scrutiny” standard of judicial review, which requires acts by the government to be “narrowly tailored” and serve a “compelling government interest.”

The American Civil Liberties Union filed the lawsuit last June on behalf of business owners in Nashville and Chattanooga who allow customers to use their preferred restroom.

The law required businesses to post a notice, stating: “THIS FACILITY MAINTAINS A POLICY OF ALLOWING THE USE OF RESTROOMS BY EITHER BIOLOGICAL SEX, REGARDLESS OF THE DESIGNATION ON THE RESTROOM.” LGBTQ activists in the state said that the requirement would unduly harm trans people, who may feel targeted for using the restroom that matches their gender.

In her decision, Trauger took aim at the state’s argument that the plaintiffs had “imagined” undertones that would be seen in such signs, saying: “The only thing that is imaginary in this case, though, is the imagined consensus on issues of sex and gender on which the defendants seek to rely.”

“Transgender Tennesseans are real. The businesses and establishments that wish to welcome them are real. And the viewpoints that those individuals and businesses hold are real, even if they differ from the views of some legislators or government officials,” she wrote. “While those government officials have considerable power, they have no authority to wish those opposing viewpoints away.”

CNN has reached out to Lee’s office for comment on the ruling.

The bill’s sponsor, Republican state Rep. Tim Rudd, said last year that HB 1182 was designated for the “protection of women and children against sexual predators” who enter the restroom of the opposite sex, a transphobic argument that has been used by anti-trans activists in recent history to smear and marginalize members of the community. He said the bill was not specifically aimed at keeping trans Tennesseans out of restrooms that align with their gender.

CNN has also reached out to Rudd’s office for comment.

Hedy Weinberg, the ACLU of Tennessee’s executive director, applauded the judge’s ruling on Tuesday, saying in a statement that “transgender individuals should be able to live their lives free of harassment and discrimination.”

“Today’s decision ensures that the businesses who welcome them are not forced to become instruments for politicians’ discrimination,” she added.

Safe access to a restroom is critical for everyone’s daily functioning but can be an unsafe experience for trans and nonbinary people. In a 2013 study from the Williams Institute, UCLA Law’s LGBTQ policy research center, 70% of trans and nonbinary respondents reported being denied access, verbally harassed or physically assaulted in public restrooms. Trans people are also four times more likely than cisgender people to be violently victimized in everyday life, the Williams Institute reported last year.

Trans activists have scored a number of recent legal wins in their fight against anti-trans state laws, including last week, when a federal judge partially blocked an Alabama law that restricts gender-affirming treatments for transgender minors.

CNN’s Scottie Andrew contributed to this report.