Media playback is unsupported on your device Media caption Riley Dosh explains why she wants to defend her country

The White House has not yet decided how it will implement the president's ban on transgender people serving in the US military.

Mr Trump's surprise Twitter announcement on Wednesday has been met with criticism from rights groups.

Spokeswoman Sarah Huckabee Sanders said the administration would work alongside the Pentagon to decide how to proceed.

It is not yet clear how the announcement will affect current transgender service personnel.

Transgender service members have expressed concern that they will be discharged, or unable to re-enlist.

The timing also appears to have caught defence officials by surprise.

Why was the ban introduced?

"The United States government will not accept or allow transgender individuals to serve in any capacity in the US military," Donald Trump tweeted.

"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 that the decision came "after consultation with my Generals and military experts".

Some US media outlets have questioned the spending justification. The Washington Post drew attention to an analysis that the US military spends almost $42m (£32m) a year on the erectile dysfunction medication Viagra - several times the total estimated cost of transgender medical support.

How would it be implemented?

Asked at a press briefing if troops on battlefields would be immediately sent back, Ms Huckabee Sanders said the policy had yet to be worked out.

"The decision is based on a military decision. It's not meant to be anything more than that," she said.

On Wednesday, the defence department referred all queries to the White House.

Defence Secretary James Mattis was only told of the decision after Mr Trump made his announcement.

However, Ms Huckabee Sanders said: "This was something that was the product of consultation."

Transgender troops react to ban

Why does the US military buy so much Viagra?

Why has the president decided on this now?

Anthony Zurcher, BBC North America Reporter

Image copyright Getty Images Image caption Different stance - on the campaign trail last year

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.

While Mr Trump campaigned as sympathetic to LGBT rights, he needs the traditional religious conservatives to stay loyal to him now, more than ever.

What is the status of transgender service personnel?

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.

The Obama administration announced last year that transgender people would be allowed to serve openly in the military.

Many active duty members came out following the decision.

Then-defence secretary Ash Carter also set a deadline of one year for the various branches of the military to begin accepting transgender recruits.

The secret life of a transgender airman

Media playback is unsupported on your device Media caption Being transgender in the US military - Jamie Ewing spoke to the BBC in 2016

However in June, Mr Mattis agreed to a further six-month delay.

The Obama-era policy had included a provision for the military to provide medical help for service members wanting to change gender.

Rand predicted that the inclusion of transgender people in the military would lead to a 0.13% increase in healthcare spending - approximately $8.4m.

UK chiefs praise transgender troops

Trump revokes transgender toilet rules

How have people reacted to Mr Trump's announcement?

Transgender troops expressed dismay over the ban.

Army reservist Rudy Akbarian told a news conference: "The discrimination I'm facing now is from those outside the military - not the people who work with me." He said that "not everyone responded well after learning I was transitioning. But after spending time on missions and realising we all share the same love for the country, we worked together and got the job done."

told a news conference: "The discrimination I'm facing now is from those outside the military - not the people who work with me." He said that "not everyone responded well after learning I was transitioning. But after spending time on missions and realising we all share the same love for the country, we worked together and got the job done." Meanwhile, Kristin Beck, a retired elite Navy SEAL, told Business Insider that "being transgender doesn't affect anyone else" and that during her decorated military career, she had been "defending individual liberty". "If you can't defend that for everyone that's an American citizen, that's not right."

Several defence professionals also questioned the decision.

Former Defence Secretary Ash Carter said: "To choose service members on other grounds than military qualifications is social policy and has no place in our military."

said: "To choose service members on other grounds than military qualifications is social policy and has no place in our military." Chairman of the Senate Armed Services Committee, Republican John McCain, said: "Any American who meets current medical and readiness standards should be allowed to continue serving."

said: "Any American who meets current medical and readiness standards should be allowed to continue serving." Several British military generals condemned Mr Trump's decision, including the commander of the UK Maritime Forces, Rear Admiral Alex Burton, who said: "We have a justifiably rigorous selection process but it doesn't include discrimination and we're a better fighting force for it".

However, supporters said the cost of transgender surgeries should not be funded by the military.