Five transgender people in the US military have launched a legal bid to block a ban announced by President Trump on Twitter last month.
The anonymous plaintiffs from the army, air force and coast guard are suing Mr Trump and several officials.
They say thousands of transgender troops have declared themselves since the military said they could serve openly and now face uncertain futures.
Mr Trump said transgender people would “disrupt” the military.
However it is not yet clear whether formal steps to enforce the ban have yet been taken or how it will affect serving personnel.
One of the plaintiffs said she had been relieved to be able to come out to her commanding officers following last year’s decision to allow transgender personnel to serve openly in the military.
“My experience has been positive and I am prouder than ever to continue to serve. I am married and have three children, and the military has been my life. But now, I’m worried about my family’s future,” she said.
The lawsuit has been filed at a federal court Washington and also names Defense Secretary James Mattis as a defendant. It was organised by advocacy groups the National Center for Lesbian Rights (NCLR) and GLBTQ Legal Advocates & Defenders (GLAD).
Transgender personnel face the potential loss of their professions, livelihoods and post-military and retirement benefits, Shannon Minter from the NCLR said.
Some transgender personnel had been in the military for as long as 20 years and had fought in Iraq and Afghanistan, Mr Minter said.
“The president’s mistreatment of these dedicated troops will serve only to weaken and demoralise our armed forces,” he added.
Other rights groups say they are waiting for the Trump administration to put the ban into effect before launching lawsuits, the New York Times reported.
In his tweets, Mr Trump said the military had to be “focused on decisive and overwhelming victory” and could not be “burdened with the tremendous medical costs and disruption that transgender in the military would entail”.
He added that the decision came “after consultation with my Generals and military experts”.
The independent Rand Corporation estimates that about 4,000 US active-duty and reserve service members are transgender, although some campaigners put the figure higher than 10,000.
Rand predicted that the inclusion of transgender people in the military would lead to a 0.13% increase in healthcare spending – approximately $8.4m.
Last June the Obama administration gave the military a year to begin accepting transgender recruits. However in June, Mr Mattis agreed to a further six-month delay.