AUSTIN, Texas — A federal judge in Texas has blocked the Obama administration from enforcing a rule requiring public schools to allow transgender students to use bathrooms for the gender with which they identify, granting a nationwide injunction sought by officials from 13 states just in time for the new school year.

While a setback for transgender advocates, the ruling is only the latest salvo in a larger legal and cultural battle over transgender rights that could be headed toward the U.S. Supreme Court.

Following milestone achievements in gay rights, including same-sex marriage becoming legal nationwide in 2015, transgender rights have become an increasingly contentious issue in America, with advocates saying the law should afford them the same rights extended to racial and religious minorities.

U.S. District Court Judge Reed O’Connor of the Northern District of Texas, an appointee of Republican President George W. Bush, issued a nationwide injunction siding with the 13 states and blocking the Obama administration’s bathroom guidelines Sunday, the evening before students in much of Texas and some of the other affected states were due back in school.

O’Connor found the federal government failed to provide states sufficient notice and opportunity for comment before issuing the guidelines. He also said the guidelines had the effect of law and contradicted existing legislative and regulatory texts.

The U.S. Justice Department has said the guidelines issued in May were non-binding with no legal consequences.

But they also were backed up by a threat to withhold federal education money from states that refused to comply, drawing objections from officials in 13 states led by Texas that sued, saying Washington was overreaching its authority.

Some conservatives have fought an expansion of transgender right on privacy grounds or to protect states from federal government overreach.

In test cases around the country, various lower courts have differed in their interpretation on whether anti-discrimination laws apply to transgender people, potentially sending the matter to the U.S. Supreme Court for a definitive resolution.

In May, the Justice and Education departments issued guidance that public schools must allow transgender students to use bathrooms, locker rooms and other intimate facilities of their choice rather than those matching their gender assigned at birth.

‘Won’t be the last word’

O’Connor’s ruling is “just one small part of an unfolding process,” Aaron Bruhl, a law professor at William & Mary in Virginia, said.

“This won’t be the last word on this subject, obviously,” he said. “There’s a decent chance the U.S. Supreme Court could address this issue in the near future.”

Katherine Franke, a law professor at Columbia University, said it was “shocking” that O’Connor had applied his injunction to the entire nation, especially because “there’s an opposite decision from the 4th Circuit [Court of Appeals] and eight other lawsuits pending.”

The Justice Department said in a statement it was disappointed by the decision and was reviewing its options. Legal experts expected it to appeal to a higher court, likely asking for a stay that would put O’Connor’s ruling on hold until the case could be litigated.

The office of Texas Attorney General Ken Paxton, a Republican who frequently sues the Democratic Obama administration, said he was pleased with a decision against “illegal federal overreach.”

But a group of five civil rights organizations supporting the Obama administration said legal precedent clearly protects transgender students from discrimination, which a single district judge cannot overturn.

“The court’s misguided decision targets a small, vulnerable group of young people — transgender elementary and high school students — for potential continued harassment, stigma and abuse,” said the five groups, including the American Civil Liberties Union and Lambda Legal.

Joining Texas in the suit are Alabama, Wisconsin, West Virginia, Tennessee, Oklahoma, Louisiana, Utah, Georgia, Mississippi and Kentucky. Maine Gov. Paul LePage and the Arizona Department of Education also have signed on.

In May, a LePage spokesman justified the intervention by saying the Obama administration has been “reckless with its overreach of federal mandates on states.” But Maine isn’t a plaintiff in the suit because Attorney General Janet Mills, a Democrat, controls the state’s representation in litigation.

It’s the second high-profile transgender bathroom case that LePage has jumped into in the last year.

In November, he signed a brief with other Republicans looking to block a transgender Virginia boy’s challenge of his school district’s bathroom-use policy that argued he is “biologically of the female sex.” Later, he said he was “ appalled at the lack of parenting” that the child received.

But in Maine, the issue is legally moot: The Maine Human Rights Act bans sexual orientation discrimination, and the Maine Supreme Judicial Court ruled in 2013 that the protection extends to using the school bathroom consistent with a student’s gender identity.

The decision came about eight hours before Jennifer Campisi took her 9-year-old son E.J., a transgender student, to the first day of school in the Dallas-Fort Worth area. E.J. is not allowed to use the boys’ bathroom and instead must use either the nurse’s bathroom or the faculty bathroom

“These policies just keep kids separate and they put unnecessary stress on parents,” she said, adding that allowing transgender students to use the bathroom of their choice is the best solutions for all.

Another mother, Alison Kelley, who has two children in the Fort Worth Independent School District, said she opposed the Obama guidelines and that local school authorities should decide what is best case by case.

“I am not anti-transgender,” Kelley said. “I am anti big government getting into my backyard.”

BDN writer Michael Shepherd contributed to this report.