A federal judge on Friday curbed the enforcement of a North Carolina law that restricted restroom access for transgender people. The ruling was the first judicial rebuke of a statute that has been condemned as discriminatory and, with lawsuit after lawsuit, has deepened the national debate about transgender rights.

In an 83-page decision that was restrained in its scope, Judge Thomas D. Schroeder of Federal District Court in Winston-Salem, N.C., limited the University of North Carolina’s power to enforce the section of the law that requires people in publicly owned buildings to use restrooms that correspond with the gender listed on their birth certificates.

The judge’s decision applies only to the people who brought the legal challenge, and it came after he concluded that they had shown they were “likely to succeed” in ultimately proving that the access restriction violates the federal government’s interpretation of Title IX, which forbids sex discrimination.

“In sum, the court has no reason to believe that an injunction returning to the state of affairs as it existed before March 2016 would pose a privacy or safety risk for North Carolinians, transgender or otherwise,” Judge Schroeder wrote in his opinion, which he issued nearly four weeks after he heard oral arguments in Winston-Salem. “It is in the public interest to enforce federal anti-discrimination laws in a fashion that also maintains longstanding state laws designed to promote privacy and safety.”