US President Donald Trump says transgender people cannot serve in “any capacity” in the military.
He tweeted that he had consulted with military experts and cited “tremendous medical costs and disruption”.
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.
How has Mr Trump justified his decision?
As is often the case, the announcement came 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.”
But the measure will not go into effect immediately.
The Pentagon says: “We will provide revised guidance to the department in the near future.”
Why has the president decided on this now?
Anthony Zurcher, BBC North America Reporter
The timing of this transgender ban is almost as interesting as the move itself.
Why now? With the Trump administration being buffeted by the Jeff Sessions political death watch, the ongoing multi-prong investigation into the Trump campaign, the healthcare drama in the Senate and the impending Russian sanctions bill, perhaps the administration decided this was a good time to change the subject and rally conservative forces to his side.
Republicans have long used cultural issues as a wedge to divide Democrats and energise evangelicals. As one White House insider acknowledged, this is straight out of that playbook. While Mr Trump campaigned as sympathetic to LGBT rights, he needs the traditional religious conservatives to stay loyal to him now, more than ever.
His populist supporters won’t consider this a top issue, but the president needs more than just his die-hard loyalists in his corner, particularly if he’s going to stoke intraparty discord by continuing to feud with Mr Sessions.
The president’s action will create a furore among liberals and the media commentators whose disdain for the current administration is not a new development. This is a fight the White House will welcome.
What is the status of transgender service personnel?
The independent Rand Corporation estimated in 2016 that about 4,000 US active-duty and reserve service members are transgender, although some campaigners put the figure higher than 10,000.
The Obama administration’s move to allow transgender people in the military to serve openly was announced in June 2016 by then Defence Secretary Ash Carter.
The policy included a provision for the military to provide medical help for service members wanting to change gender.
Transgender people would be permitted to join the services, so long as they could demonstrate they had been stable in their new gender for at least 18 months.
This was meant to come into effect on 1 July 2017 but the Trump administration delayed it by a further six months. The Pentagon said the five branches of the military needed more time to “review their accession plans and provide input on the impact to the readiness and lethality of our forces”.
While Mr Trump’s decision concerns transgender military personnel, 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.
What do critics of this say?
LGBTQ campaign group, GLAAD, called Mr Trump’s move “a direct attack on transgender Americans”.
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”.
Former Defence Secretary Carter released a critical statement: “To choose service members on other grounds than military qualifications is social policy and has no place in our military. There are already transgender individuals who are serving capably and honorably.”
Chairman of the Senate Armed Services Committee, Republican John McCain, said major policy announcements should not be made via Twitter and continued:
“The statement was unclear. The Department of Defense has already decided to allow currently-serving transgender individuals to stay in the military, and many are serving honorably today.
Any American who meets current medical and readiness standards should be allowed to continue serving.”
Several British military generals have condemned Mr Trump’s decision, including the commander of the UK Maritime Forces, Rear Admiral Alex Burton.
“As an @RoyalNavy_LGBT champion and senior warfighter I am so glad we are not going this way”, he wrote on Twitter, later adding: “We have a justifiably rigorous selection process but it doesn’t include discrimination and we’re a better fighting force for it.”
What about those in favour?
Republican opponents of transgender people serving in the military include Vicky Hartzler, a congresswoman from Missouri, who wants transgender service members honourably discharged.
Some oppose the military having to bear medical costs associated with transgender recruits, such as gender reassignment.
Tony Perkins of the socially conservative Family Research council said: “Our troops shouldn’t be forced to endure hours of transgender ‘sensitivity’ classes and politically correct distractions.”
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 cognisant that they understand what it takes to go to war… I don’t think this is an attack on the LGBT community.
“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.”
~ Thomas Jefferson