AUSTIN, Texas (AP) – A federal judge in Texas is blocking for now the Obama administration’s directive to U.S. public schools that transgender students must be allowed to use the bathrooms and locker rooms consistent with their chosen gender identity.

Hundreds of school districts Monday woke up to news of the order by U.S. District Judge Reed O’Connor on the first day of class in Texas and elsewhere.CLICK HERE FOR FULL COVERAGE OF HB2

The decision dated Sunday comes after Texas and 12 other states challenged the Obama directive as unconstitutional during a hearing in Fort Worth last week. It applies to schools nationwide, as many districts reopen this week after the summer vacation.

Texas Attorney General Ken Paxton, a Republican, immediately cheered the decision.

“This president is attempting to rewrite the laws enacted by the elected representatives of the people, and is threatening to take away federal funding from schools to force them to conform,” Paxton said. “That cannot be allowed to continue, which is why we took action to protect states and school districts.”

The federal government told U.S. public schools in May that transgender students must be allowed to use bathrooms and locker rooms consistent with their chosen gender identity. That announcement came days after the Justice Department sued North Carolina over a state law that requires people to use public bathrooms that correspond with the sex on their birth certificate, which U.S. Attorney General Loretta Lynch had likened to policies of racial segregation. Republicans have argued such laws are commonsense privacy safeguards.

Schools were not explicitly told to comply or lose federal funds. But the Obama administration also didn’t rule out that possibility in court documents filed in July, saying recipients of federal education dollars “are clearly on notice” that antidiscrimination polices must be followed. Texas alone gets roughly $10 billion in federal education funds.

The lawsuit was filed in May by Texas, Alabama, Wisconsin, West Virginia, Tennessee, Oklahoma, Louisiana, Utah and Georgia, and the Republican governors of Maine, Mississippi and Kentucky. Two small school districts in Arizona and Texas, which have fewer than 600 students combined and no transgender persons on their campuses, also joined the effort to prevent the directive from being enforced.