British armed forces heads tweeted their support for transgender soldiers on Wednesday after Donald Trump said he would ban them from serving in the US military.

In a series of tweets, Mr Trump said he had taken the decision because US forces “cannot be burdened with the tremendous medical costs and disruption that transgender in the military would entail”.

The move reverses former President Barack Obama's policy that loosened restrictions on transgender people serving in the US armed forces.

The President’s comments were opposed by Rear Admiral Alex Burton, Commander UK Maritime Forces, who tweeted: “As a Royal Navy LGBT champion and senior warfighter I am so glad we are not going this way.”

He added: “We have a justifiably rigorous selection process but it doesn't include discrimination and we're a better fighting force for it.”

Second Sea Lord Vice Admiral Jonathan Woodcock said on Twitter he was “proud” of the Royal Navy's transgender personnel.

“They bring diversity to our Royal Navy and I will always support their desire to serve their country,” he wrote.

“I suspect many who doubt the abilities of our diverse service personnel might be more reluctant to serve than they are to comment.”

Mr Trump's move also drew swift condemnation from rights groups as “raw prejudice” with purely political motives, but it was praised by conservative activists and some Republicans.

The White House said it did not know what will happen to transgender service members currently serving in the US military following the announcement.

A Ministry of Defence spokesman said it did not comment on “US military recruitment policy”.

LGBT+ rights around the globe Show all 9 1 /9 LGBT+ rights around the globe LGBT+ rights around the globe Russia Russia’s antipathy towards homosexuality has been well established following the efforts of human rights campaigners. However, while it is legal to be homosexual, LGBT couples are offered no protections from discrimination. They are also actively discriminated against by a 2013 law criminalising LGBT “propaganda” allowing the arrest of numerous Russian LGBT activists. AFP/Getty LGBT+ rights around the globe Brunei Brunei recently introduced a law to make sodomy punishable by stoning to death. It was already illegal and punishable by up to 10 years in prison AFP/Getty LGBT+ rights around the globe Mauritania Men who are found having sex with other men face stoning, while lesbians can be imprisoned, under Sharia law. However, the state has reportedly not executed anyone for this ‘crime’ since 1987 Alamy LGBT+ rights around the globe Sudan Both male and female same-sex sexual activity is illegal under Sudanese law. Men can be executed on their third offence, women on their fourth Getty LGBT+ rights around the globe Saudi Arabia Homosexuality and gender realignment is illegal and punishable by death, imprisonment, whipping and chemical castration Getty LGBT+ rights around the globe Yemen The official position within the country is that there are no gays. LGBT inviduals, if discovered by the government, are likely to face intense pressure. Punishments range from flogging to the death penalty Getty LGBT+ rights around the globe Nigeria Both male and female same-sex sexual activity is illegal and in some northern states punishable with death by stoning. This is not a policy enacted across the entire country, although there is a prevalent anti-LGBT agenda pushed by the government. In 2007 a Pew survey established that 97% of the population felt that homosexuality should not be accepted. It is punishable by 14 years in prison Reuters LGBT+ rights around the globe Somalia Homosexuality was established as a crime in 1888 and under new Somali Penal Code established in 1973 homosexual sex can be punishable by three years in prison. A person can be put to death for being a homosexual Reuters LGBT+ rights around the globe Iraq Although same-sex relationships have been decriminalised, much of the population still suffer from intense discrimination. Additionally, in some of the country over-run by the extremist organisation Isis, LGBT individuals can face death by stoning Getty

But the spokesman added: “We are clear that all LGBT+ members of our armed forces play a vital role in keeping our nation safe.

”We will continue to welcome people from a diverse range of backgrounds, including transgender personnel.“

The MoD said it was unable to confirm how many transgender people served in the UK military.