*Editor's note: This story has been updated throughout

As millions of Texas children head back to school, a federal judge in Fort Worth has temporarily blocked Obama administration guidelines directing the nation’s public schools to allow transgender students to use bathrooms and other facilities that align with their gender identity.

In a 38-page order released Sunday, U.S. District Court Judge Reed O’Connor sided with Texas and 12 other states challenging the federal directive, saying the “status quo” should remain in place nationwide until the court rules on the case, or a federal appeals court provides further guidance. That is because the administration didn’t follow proper rule-making procedure in crafting the guidelines, O’Connor explained, noting, “The resolution of this difficult policy decision is not ... the subject of this order.”

O'Connor, who former President George W. Bush nominated in 2007, did not issue a ruling from the bench this month after a hearing during which state attorneys argued the guidelines unconstitutionally “hold a gun to the head” of states and school districts and place students in danger.

“This case presents the difficult issue of balancing the protection of students’ rights and that of personal privacy while using school bathrooms, locker rooms, showers, and other intimate facilities, while ensuring that no student is unnecessarily marginalized while attending school,” O’Connor wrote in his order. He added: “The sensitivity to this matter is heightened because Defendant’s actions apply to the youngest child attending school and continues every year throughout each child’s educational career."

Attorney General Ken Paxton cheered the decision, saying, “We are pleased that the court ruled against the Obama Administration’s latest illegal federal overreach.”

“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,” he said. “That cannot be allowed to continue."

O’Connor granted another temporary injunction to Texas last year that blocked a federal rule giving medical benefits to same-sex couples that the state had sued over.

Texas’ latest legal challenge stems from guidelines issued in early May by the Obama administration, which state that discrimination against transgender individuals violates federal nondiscrimination statutes, including the Title IX prohibition on discrimination based on sex at educational institutions that receive federal funding. Those protections, the administration said, extend to gender identity and give transgender students the right to use their preferred bathrooms in public school, requiring schools to treat a student’s gender identity as the student’s sex for purposes of Title IX compliance.

“ The sensitivity to this matter is heightened because Defendant’s actions apply to the youngest child attending school and continues every year throughout each child’s educational career. ” — U.S. District Court Judge Reed O’Connor of Fort Worth

At a hearing Aug. 12, the first in the case against the federal government, a member of the Texas attorney general’s team told O’Connor that the federal government "usurped" the authority of states and schools by requiring that “sexes must be mixed” in "intimate areas" like bathrooms.

The federal government had argued that the transgender guidelines were meant to provide clarification on its interpretation of discrimination protections in light of "emerging issues" and that protections based on sex extended to gender identity because "gender is a sex-based characteristic."

Additionally, the Obama administration insisted that Texas and the other states had jumped the gun in filing the lawsuit because the federal government had not moved forward with any enforcement action.

In his order, O’Connor said the injunction should apply nationwide rather than just to schools in the court’s jurisdiction, as requested by lawyers for the federal government, noting that “states who do not want to be covered by this injunction can easily avoid doing so by state law.”

The injunction “therefore only applies to those states whose laws direct separation,” he said. “However, an injunction should not unnecessarily interfere with litigation currently pending before other federal courts on this subject regardless of the state law.”

His decision comes after the U.S. Supreme Court earlier this month temporarily blocked another order that would have allowed a transgender student to use the boys’ bathroom at a Virginia high school.

Advocates for the transgender student protections said Monday's ruling puts transgender students "at even greater risk of discrimination, harassment and discrimination."

“All students, regardless of their gender identity, deserve to be able to learn in an environment free from discrimination," said Sarah Warbelow, legal director for the Human Rights Campaign. Schools are still required to protect students' civil rights and can still choose to follow the federal guidance despite the ruling blocking enforcement by the feds, she added.

Transgender people’s use of bathrooms and other public facilities has emerged as the latest sticking point in a series of battles between social conservatives and the Obama administration that have included gay marriage.

The U.S. Supreme Court ruled in June 2015 that the Constitution guarantees a right to same-sex marriage.

Alexa Ura contributed to this report.

Read more about Texas' transgender students: