US President Donald Trump says the US military will not allow transgender people to serve in "any capacity", citing "tremendous medical costs and disruption".
He tweeted that he had consulted with generals and military experts.
The Obama administration decided last year to allow transgender people to serve openly in the military.
But in June, Defence Secretary James Mattis agreed to a six-month delay in the recruitment of transgender people.
The Pentagon said this was to allow the different branches of the military to "review their accession plans and provide input on the impact to the readiness and lethality of our forces".
Some Republicans have voiced opposition to allowing transgender people to serve at all.
In a series of tweets, Mr Trump said: "After consultation with my generals and military experts, please be advised that the United States Government will not accept or allow transgender individuals to serve in any capacity in the U.S. Military.
"Our military must be focused on decisive and overwhelming victory and cannot be burdened with the tremendous medical costs and disruption that transgender in the military would entail."
The independent Rand Corporation estimated in 2016 that 2450 of the 1.2 million active-duty service members were transgender, though some campaigners put the figure higher.
Announcement inappropriate - McCain
The announcement was not the first from Mr Trump targeting transgender people. Since he took office in January, he has rescinded protections for transgender students put in place by Barack Obama that had let them use bathrooms corresponding with their gender identity.
The Senate's most prominent veteran, Armed Forces Committee Chairman John McCain, called Mr Trump's announcement "unclear" and inappropriate given an ongoing Pentagon study on the issue.
"I do not believe that any new policy decision is appropriate until that study is complete and thoroughly reviewed by the Secretary of Defense, our military leadership, and the Congress," said Mr McCain, a Navy pilot and prisoner of war during the Vietnam War.
Tony Perkins, president of the Family Research Council advocacy group, was among those praising the announcement. "Our troops shouldn't be forced to endure hours of transgender 'sensitivity' classes and politically correct distractions," he said.
The US military's ban on openly gay and lesbian servicemen and women - known as "Don't ask don't tell" - was lifted in 2011.
Aaron Belkin, director of the Palm Centre, a leading think-tank which studies gender and sexuality in the military, told the BBC that Mr Trump's decision would force transgender troops to in effect live as gays and lesbians did under "Don't ask, don't tell".
"Don't ask, don't tell was a disastrous policy that harmed the military for almost two decades," Mr Belkin said.
"It's not clear why the president would want to bring it back now for transgender troops, when all the evidence suggests that inclusive policy benefits the military and discrimination hurts the military."
LGBTQ campaign group GLAAD called Mr Trump's move "a direct attack on transgender Americans".
George Takei, equality campaigner and the actor who played Mr Sulu in Star Trek, accused the president of cruelty and pettiness.
Trump's claim that the cost of trans servicemembers would be "tremendous" is bunk. 2016 Rand Study estimated the add'l care cost at $6mil.— George Takei (@GeorgeTakei) July 26, 2017
Republican opponents of transgender people serving in the military include Vicky Hartzler, a congresswoman from Missouri, who wants transgender service members honourably discharged.
Others are opposed to the military bearing medical costs associated with transgender recruits, such as gender reassignment.
Trump supporter and political commentator Scott Presler is among those who disagree with the military carrying the cost of such interventions.
While disagreeing with the ban, he added that "generals know more about war than I do.
"I am cognizant that they understand what it takes to go to war... I don't think this is an attack on the LGBT community.
I'm gay w/ 111K followers. I've felt more prejudice from democrats than Republicans. Trump's transgender policy is from Generals' advice.— #ThePersistence (@ScottPresler) July 26, 2017
"I'm mixed, but I have confidence in the guidance that President Trump is receiving," he said. "I don't think for a second he's prejudiced."
- BBC / Reuters