— A federal judge ruled Friday that two students and an employee must be allowed to use restrooms matching their gender identity at University of North Carolina campuses, and he said they have a strong chance of proving the state's bathroom-access measure violates federal law.

U.S. District Judge Thomas Schroeder temporarily blocked the University of North Carolina from making the three plaintiffs follow the restroom provision of the so-called HB2 law as the larger case makes its way to trial in November. His final decision on the law won't come until after trial.

Passed in March, HB2 requires transgender people to use restrooms in schools and many public buildings that correspond to the sex on their birth certificates, rather than their gender identity. It also excludes gender identity and sexual orientation from statewide antidiscrimination protections.

The state's Republican leaders argue the law is needed to protect privacy and safety by keeping men out of women's restrooms. Transgender residents challenging the law say that restroom safety is protected by existing laws, while the North Carolina measure is harmful and discriminatory.

In Friday's ruling, Schroeder wrote that the challengers "are likely to succeed" in their arguments that HB2 violates Title IX, a federal law prohibiting gender discrimination in educational institutions.

However, he said plaintiffs haven't shown they are likely to succeed on a claim that the law violates their constitutional equal protection rights, and he reserved judgment on another constitutional claim related to due process.

Rebuffing arguments by the law's defenders, Schroeder also noted that existing laws already protect people's privacy in restrooms.

"North Carolina's peeping and indecent exposure statutes continue to protect the privacy of citizens regardless of" the bathroom provision, Schroeder wrote, "and there is no indication that a sexual predator could successfully claim transgender status as a defense against prosecution under these statutes."

He said that while his injunction shouldn't pose any hardship to the state leaders seeking to defend the law, failing to block the restroom provision "would cause substantial hardship to the individual transgender Plaintiffs, disrupting their lives."

The plaintiffs challenging the law include a student at UNC's Greensboro campus, an employee at its Chapel Hill campus and a high school student at the state School of the Arts, which is also run by the university system.

The UNC employee, Joaquin Carcano, issued a statement that the judge's decision represents an important step toward defeating the law that has forced him to go far from his office to use a restroom.

"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," he said.

The American Civil Liberties Union, which represents the transgender plaintiffs, and the U.S. Justice Department both argued for the injunction to block the restroom access measure. Defending the law are Republican Gov. Pat McCrory, Republican legislative leaders and a citizens group.

Chris Brook, legal director of the ACLU of North Carolina, said in an interview that the ruling shows "HB2 can't be squared with Title IX and can't be enforced at institutions that receive federal education funds."

Several cases seeking to challenge or defend the law were assigned to Schroeder, while another case is pending in a separate federal court.

North Carolina Senate leader Phil Berger and House Speaker Tim Moore issued a statement maintaining that the law represents "commonsense protections to keep grown men out of bathrooms and showers with women and young girls" and saying they were pleased that the ruling only extended to the three plaintiffs.

Friday's decision hinged largely on a ruling by a federal appeals court in favor of a transgender teen seeking to use the boys' restrooms at his Virginia high school. Schroeder noted that appeals' court decision remains the law throughout the 4th Circuit, even though the U.S. Supreme Court temporarily put its enforcement on hold while it considers whether to hear the Virginia case.

UNC law professor Maxine Eichner said she was struck by the fact that the judge — who was appointed by Republican President George W. Bush — carefully weighed the plaintiffs' hardships in the more than 80-page ruling.

"The judge took real care in looking at the facts," she said.

She said that while the ruling only applies to the three plaintiffs, it could embolden North Carolina's public school systems to tailor their restroom access policies to the needs of transgender students.

"A school system could say: 'The writing is on the wall, and we can't lawfully enforce HB2,'" she said. "They also could say, 'We are going to stick this out and wait until a court actually grants an order that applies to us.'"