A federal judge ruled Friday that the University of North Carolina system cannot enforce the part of the state’s so-called “bathroom bill” that restricts which restrooms transgender people can use, a controversial provision that prompted boycotts, outrage and a Justice Department lawsuit.

Until a final decision is reached in the case, the schools — which have said they are caught between conflicting state and federal mandates — cannot enforce the law’s language ordering people to only use bathrooms that match the gender on their birth certificates, District Judge Thomas D. Schroeder wrote in an 83-page order issued Friday afternoon.

Schroeder wrote that his order only touched on part of the measure and that he was barring the school system from enforcing the bathroom provisions against three individual transgender people that are part of the case.

The partial ruling, filed in the U.S. District Court for the Middle District of North Carolina, was hailed as a victory by rights groups on Friday, while lawmakers who backed the bill said they were pleased the order was limited to the three people on the suit.

North Carolina Gov. Pat McCrory explains his executive action on Apr. 12, after public outcry over the state's "bathroom bill." (Office of Governor Pat McCrory)

Schroeder’s order came five months after Gov. Pat McCrory (R) signed the measure, also known as House Bill 2 (or “H.B. 2”), which propelled North Carolina into the epicenter of a broader national debate over transgender rights.

In his order, Schroeder said the plaintiffs, a group that includes the American Civil Liberties Union of North Carolina along with two transgender students and an employee of UNC, “are likely to succeed on their claim” that the bathroom provisions violates Title IX of the Education Amendments of 1972, which prohibits sex discrimination in education programs that get federal funding.

“Today is a great day for me and hopefully this is the start to chipping away at the injustice of H.B. 2 that is harming thousands of other transgender people who call North Carolina home,” Joaquín Carcaño, lead plaintiff in the case, said in a statement released by the ACLU. “Today, the tightness that I have felt in my chest every day since H.B. 2 passed has eased. But the fight is not over: we won’t rest until this discriminatory law is defeated.”

The University of North Carolina said that its attorneys were still reviewing the order and would fully comply with it.

“We have long said that the university has not and will not be taking steps to enforce HB2,” Joni Worthington, a spokeswoman for the university system, said in a statement late Friday.

“We welcome resolution of these issues by the court so that we can focus all of our efforts on our primary mission—educating students,” Worthington said.

Schroeder wrote that the plaintiffs in the suit did not make “a clear showing” that they would succeed on their claim that the law violates constitutional guarantees of equal protection and due process. As a result, Schroeder said he would hold off on ruling on those claims until after a scheduled hearing on the law in November.

Ultimately, Schroeder said that he had “no reason to believe that an injunction returning to the state of affairs as it existed before” the law was passed “would pose a privacy or safety risk for North Carolinians, transgender or otherwise.”

The lawsuit was filed against McCrory and the top Republicans in the North Carolina legislature: Sen. Phil Berger, the president pro tempore of the state Senate, and Rep. Tim Moore, speaker of the House. Berger and Moore, in a joint statement, said they were pleased that the court granted only “a limited injunction for three individuals” in the case.

A panel of the U.S. Court of Appeals for the 4th Circuit said a district judge who agreed with the school board should have given more weight to the Department of Education’s guidance that “a school generally must treat transgender students consistent with their gender identity.”

The school district requested and received a stay from the Supreme Court from implementing the order while the justices decide whether to review the 4th Circuit’s decision. But Schroeder noted that while a district judge in Texas has ruled differently on whether the Department of Education has the authority to interpret Title IX the way it has, the Gloucester County decision “remains the law in this circuit.”

The 4th Circuit covers the Carolinas, Virginia, West Virginia and Maryland.

Earlier this year, McCrory filed a lawsuit against the Justice Department earlier this year, accusing it of overreach, and the Justice Department filed a lawsuit that same day arguing that the law violates civil rights.

McCrory, a Republican up for reelection, has previously defended the bill as necessary and said it provided “common sense gender-specific restroom and locker facilities in government buildings and in our schools.”

Earlier this week, a Monmouth University poll showed McCrory trailing his Democratic opponent, Attorney General Roy Cooper, also found that majorities of North Carolina voters disapprove of the bathroom bill and feel it has hurt the state’s reputation.

Robert Barnes contributed to this report, which was first published at 5:45 p.m. and has been updated.