A federal judge has blocked the Obama administration's directive that schools allow transgender students to use bathrooms and locker rooms based on their gender identity.

U.S. District Judge Reed O'Connor ruled Sunday on the side of Alabama and 12 other states that filed suit arguing that the president's directive overstepped federal authority and threatened student safety and privacy. The ruling allows schools in Alabama and nationwide to keep their current gender-based restroom and locker room policies in place.

"The court decision is a victory for parents and children all across Alabama," Alabama Attorney Gen. Luther Strange said. "I joined the multi-state lawsuit against the Obama administration in May to prevent Alabama schools from being forced to surrender their restroom access policies to social experimenters in Washington. I am pleased the federal court has agreed to our request to stay the controversial order while our lawsuit challenging the legality of the transgender order continues."

However, David Dinielli, deputy legal director of the Southern Poverty Law Center, classified the ruling as an "attack on transgender people."

"This case reflects an overreaction by many states, including Alabama, to federal guidance about transgender schoolchildren," Dinielli said. "We are disappointed that this particular court has failed to understand what it means to be transgender. But we are confident that, over time, our courts will recognize that transgender children, like all children, feel safe and thrive when they are given equal opportunity to succeed. We are committed to this fight and will not stop until all of our kids enjoy safety and dignity in their schools and communities."

In May, the Obama administration issued a letter to public schools around the country advising them to allow students to use bathrooms and locker rooms that align with their gender identity as opposed to their sex at birth. The order also directed schools to require personnel to use pronouns and names consistent with a student's gender identity and prohibited discipline for student's appearance that "does not conform to stereotypical notions of masculinity or femininity."

Schools that fail to abide by the guidance could face loss of federal funding or possible civil rights lawsuits.

O'Connor's ruling did not address the issues raised by the suit but rather said the Obama administration failed to follow rule-making procedure in issuing the directive.

"This case presents the difficult issue of balancing the protection of students' rights and that of personal privacy when using school bathrooms, locker rooms, showers, and other intimate facilities, while ensuring that no student is unnecessarily marginalized while attending school," O'Connor said. "The resolution of this difficult policy issue is not, however, the subject of this order."

The suit was led by Texas with Alabama, Arizona, Georgia, Kentucky, Louisiana, Maine, Mississippi, Oklahoma, Tennessee, Utah, West Virginia and Wisconsin joining in.

Updated Aug. 22 at 11:59 a.m. to includes comments from Southern Poverty Law Center.