A U.S. federal judge on Sunday granted an injunction sought by 13 states that were pushing to block Obama administration guidance mandating that transgender students be allowed to use the bathroom of their choice.

Reed O'Connor, a judge for the Northern District of Texas, said in a decision late on Sunday and announced on Monday that the Obama administration did not follow proper procedures when announcing the guidance.

Texas led the lawsuit against the White House, which was filed in late May, charging the Obama administration was working "to turn workplace and educational settings across the country into laboratories for a massive social experiment."

Status of Transgender "Bathroom Bill" Legislation InsideGov

Texas Attorney General Ken Paxton cheered the decision Monday.

"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," said Paxton, a Republican. "That cannot be allowed to continue, which is why we took action to protect states and school districts."

The Obama administration's Department of Justice said it was "disappointed" with the result, and said it's not yet clear how it will react.

"The department is disappointed in the court's decision, and we are reviewing our options," said spokeswoman Dena Iverson.

The Obama administration issued guidance earlier in May that U.S. public schools must allow transgender students to use the bathrooms and locker rooms based on their chosen gender identity.

The federal government's guidance came in response to a Justice Department lawsuit against a North Carolina state law requiring people to use the public restroom facility that corresponds with their birth gender.

This month, the U.S. Supreme Court said the Gloucester County School board in Virginia can bar Gavin Grimm, a transgender male, from using the boy's bathroom at his school. That decision is temporary until the Supreme Court decides whether to review an appeals court ruling in his case.