Officials from 11 US states are suing the Obama administration to overturn a directive telling schools to let transgender students use bathrooms matching their gender identity, decrying the policy as "a massive social experiment."
Ramping up the simmering battles over contentious cultural issues in America, the states, led by Texas and most with Republican governors, accused the federal government of rewriting laws by "administrative fiat."
"We are willing to fight this all the way to the Supreme Court if we have to," Republican Texas Attorney General Ken Paxton told reporters in Austin.
Amid a national debate on transgender rights, President Barack Obama's administration told public schools that transgender students must be allowed to use the bathroom of their choice, upsetting Republicans and paving the way for fights over federal funding and legal authority.
The states' lawsuit accused the federal government of overstepping its constitutional powers by taking actions that should be left to Congress or individual states.
It also challenged the Obama administration's interpretation of federal civil rights law with regard to sex and gender.
The lawsuit said the administration "conspired to turn workplace and educational settings across the country into laboratories for a massive social experiment, flouting the democratic process, and running roughshod over commonsense policies protecting children and basic privacy rights."
Texas was joined by Alabama, Georgia, Louisiana, Oklahoma, Tennessee, Utah, West Virginia and Wisconsin, plus Arizona's Department of Education and Maine's governor.
Mr Paxton said, "It's about parents who are upset, grandparents who are upset. They want to see that the safety of their children is taken care of."
Transgender rights advocates argued it is transgender people who need protection, particularly transgender women who are disproportionately the victims of assaults and would be forced to use men's bathrooms if states succeed in forcing people to use bathrooms matching their sex at birth.
Likewise, transgender men, many of whom grow facial hair, would be required to use women's bathrooms along with girls.
"This action puts students at risk for the sake of politics," said Alison Gill of the Trans United Fund advocacy group supporting transgender rights.
Ms Gill said the states' lawsuit did not reflect the position of most school boards and administrators.
The administration's letter to the schools said that to get federal funding under existing rules, schools must agree not to treat students or activities differently on the basis of sex.
That includes not treating transgender students differently from others of the same gender identity, officials said.