A federal judge on Sunday ruled that a North Carolina law does not bar transgender people from using public restrooms that match their gender identity.

North Carolina lawmakers in 2016 approved House Bill 2 during a one-day special session. The law blocked cities from enacting LGBT protections and prohibited transgender people from using the bathroom of their choice. Despite an economic boycott of the state, Pat McCrory, the former Republican governor of North Carolina who signed HB 2 into law, defended the law. Voters ousted McCrory later that year. Last year, Democratic Governor Roy Cooper signed House Bill 142 into law. The new law, billed as a compromise, prohibits municipalities from regulating public accommodations until December 1, 2020 and bans state agencies and colleges from “regulation of access” to restrooms and locker rooms.

U.S. District Judge Thomas Schroeder ruled that House Bill 142's vague wording does not bar transgender people from using the bathroom of their choice.

“HB142 does not regulate restroom access in any fashion,” Schroeder wrote. “Nothing in the language of Section 2 [of HB 142] can be construed to prevent transgender individuals from using the restrooms that align with their gender identity.”

The American Civil Liberties Union (ACLU) and Lambda Legal are representing six LGBT people challenging the law. Joaquin Carcano, lead plaintiff in the lawsuit, welcomed the ruling.

“I am relieved to finally have the court unequivocally say that there is no law in North Carolina that can be used to bar transgender people from using the restrooms that match who we are,” Carcano said in a statement issued by the ACLU. “For the past two and a half years, I have been unable to use restrooms in my home state without worrying that I will be subject to discrimination, harassment, or even arrest. Our community has faced so much discrimination because of HB 2 and HB 142, and this decision will give us more support to defend the rights and basic humanity of our community members across the state.”

Schroeder also ruled that plaintiffs and their attorneys can keep challenging the part of the law that prohibits municipalities from regulating public accommodations.

The Human Rights Campaign (HRC), the nation's largest LGBT rights advocate, responded to the ruling by repeating its call for lawmakers to repeal HB 142.

“Today’s ruling made clear that the discriminatory and poorly written HB 142 does not prevent transgender North Carolinians from using restrooms consistent with their gender identity. Despite this, the law – and the state – remain deeply problematic for LGBTQ equality,” HRC Legal Director Sarah Warbelow said in a statement. “It remains impossible for city and town governments to protect LGBTQ people from discrimination, including in public accommodations. What is needed and necessary for LGBTQ people is the full repeal of HB 142 and the enactment of statewide protections.”

(Related: Pat McCrory insists Caitlyn Jenner must use men's bathrooms; Blames HB2 on Charlotte mayor.)