WINSTON-SALEM, N.C. — North Carolina’s university system must allow two transgender students and a transgender employee to use bathrooms matching their gender identity, a U.S. judge ruled on Friday, in a partial victory for those fighting the state’s restrictive restroom law.

Most transgender people in North Carolina, however, will still be bound by the law adopted in March that requires them to use bathrooms in government buildings and public schools that correspond with the sex on their birth certificate.

Bathroom access has become a flashpoint in the battle over transgender rights in the United States. The North Carolina law has sparked boycotts of the state by corporations, entertainers and the NBA, which pulled its 2017 All-Star Game from Charlotte.

U.S. District Court Judge Thomas Schroeder said three plaintiffs challenging the measure were likely to succeed at trial on their claim that it violates the 1972 Title IX Act, which prohibits sex-based discrimination by schools receiving federal funding.

“The individual transgender plaintiffs have clearly shown that they will suffer irreparable harm in the absence of preliminary relief,” he wrote, noting their assertions that single-occupant bathrooms were generally unavailable at the University of North Carolina.

The judge said his order effectively returned all involved to the status quo before the law passed, “wherein public agencies accommodated the individual transgender plaintiffs on a case-by-case basis, rather than applying a blanket rule to all people in all facilities under all circumstances.”

An estimated 0.6 percent of U.S. adults identify as transgender, according to the Williams Institute at the UCLA School of Law. Debates about which public restroom facilities they and transgender children should use have divided courts, state legislatures and schools.

For now, the latest ruling means the students and university employee who sued North Carolina no longer will face the humiliation of being banned from using bathrooms aligned with their gender identity, said Chris Brook, legal director of the American Civil Liberties Union of North Carolina.

But Brook said the judge’s legal analysis signaled Schroeder was likely to block the law in its entirety once the full case is heard in a trial set for November. The measure, known as House Bill 2 or HB 2, also barred local measures protecting lesbian, gay, bisexual and transgender people from discrimination.

“We think that we have strong arguments to invalidate all of the provisions of HB 2 that target the LGBT community in the state,” Brook said in an interview.

Schroeder, an appointee of Republican former President George W. Bush, heard oral arguments for the injunction on Aug. 1 in Winston-Salem.

Lawyers for Republican Gov. Pat McCrory and other Republican lawmakers who support the law said it offered common-sense protection of state residents’ privacy and safety, even though it included no specific language for enforcement.

The governor’s office had no immediate comment on Friday.

A Monmouth University Poll released on Wednesday showed the law could hurt McCrory’s re-election chances in November. The survey showed the incumbent governor trailing his Democratic opponent and found that 70 percent of North Carolina voters felt the bathroom measure had hurt the state’s reputation nationally.

In April, the 4th U.S. Circuit Court of Appeals became the first appeals court to find that transgender students are protected under federal laws that bar sex-based discrimination. The court’s jurisdiction includes North Carolina.

But the U.S. Supreme Court voted in August to stay the order, which would have allowed a transgender boy to use the boys’ restroom at his Virginia high school, until the high court considers the subject more fully.