US President Donald Trump is barring transgender people from serving in the military "in any capacity".
Mr Trump's announcement on Twitter did not say what would happen to transgender people already in the military.
The president tweeted that after consulting with "Generals and military experts", the government "will not accept or allow Transgender individuals to serve in any capacity in the US 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," he added.
At the Pentagon, members of the staff of defence secretary Jim Mattis appeared to have been caught unaware by Mr Trump's tweets.
A Pentagon spokesman, Navy Captain Jeff Davis, declined to answer questions about what Mr Trump's tweets mean for the current policy, including whether transgender people already serving in the military will be kicked out.
"Call the White House," he said.
Mr Davis later released a statement, saying: "We refer all questions about the president's statements to the White House. We will continue to work closely with the White House to address the new guidance provided by the commander in chief on transgender individuals serving the military. We will provide revised guidance to the department in the near future."
There are already as many as 250 service members in the process of transitioning to their preferred genders or who have been approved to formally change gender within the Pentagon's personnel system, according to several defence officials.
The Pentagon has refused to release any data on the number of transgender troops currently serving. A Rand Corporation study estimated that there are between 2,500 and 7,000 transgender service members on active duty and an additional 1,500 to 4,000 in the reserves.
Mr Trump's decision drew swift reaction from critics.
House minority leader Nancy Pelosi, a California Democrat, called the move "a cruel and arbitrary decision designed to humiliate transgender Americans who stepped forward to serve our country".
Matt Thorn, executive director of OutServe-SLDN, which represents the LGBT population in the military, said thousands have been serving in the US armed forces without causing any issues.
"It's an absolute absurdity and another overstep," Mr Thorn said. He threatened legal action if Wednesday's decision is not reversed.
Victoria Rodriguez-Roldan, director of the Trans/Gender Non-Conforming Justice Project, National LGBTQ Task Force, said Mr Trump "has stood against the trans community with this decision and is harming lives for the sake of political gains".
"The military is often the last resort for people who can't find jobs because of discrimination," Ms Rodriguez-Roldan said. She said the transgender community "will not stop fighting" for justice.
Some conservative organisations and politicians hailed the decision.
Family Research Council president Tony Perkins applauded Mr Trump for "keeping his promise to return to military priorities - and not continue the social experimentation of the Obama era that has crippled our nation's military".
Iowa representative Steve King said Mr Trump's supporters "will be happy to hear it. We don't' need to be experimenting with the military. Plus there's no reason to take on that kind of financial burden".
Transgender service members have been able to serve openly in the military since last year, when former defence secretary Ash Carter ended the ban. Since October 1, transgender troops have been able to receive medical care and start formally changing their gender identifications in the Pentagon's personnel system.
Mr Carter also gave the services until July 1 to develop policies to allow people already identifying as transgender to newly join the military. Mr Mattis announced earlier this month that he was giving military chiefs another six months to conduct a review to determine if allowing transgender individuals to enlist in the armed services would affect the "readiness or lethality" of the force.
Key concerns include whether currently enlisted troops have had medical or other issues that cause delays or problems with their ability to deploy or meet physical or other standards for their jobs.
Military leaders also wanted to review how transgender troops are treated, if they are discriminated against or if they have had disciplinary problems, defence officials have said.