Image copyright Reuters Image caption President Trump addresses US military personnel in Italy in May

Drill sergeant Kennedy Ochoa was putting on his dress uniform when he heard the news.

President Trump had fired off a series of tweets saying the country would no longer "accept or allow" transgender Americans to serve in the military, citing "tremendous medical costs and disruption".

This was not the way it was supposed to go. For more than a year Sergeant Ochoa had served as a man, following an Obama-era policy change that paved the way for transgender troops to serve openly.

Announcing the change, then-defence secretary Ash Carter called it "the right thing to do" for "talented Americans who are serving with distinction".

Many transgender troops came out to their commanders and their colleagues and won the support of both.

On Wednesday morning, Sergeant Ochoa was proudly putting on his uniform - the male regulation dress blues he has been allowed to wear for a year - and preparing to graduate from a training course that puts him on track for a promotion in September.

Then he saw the president's tweets. "It was heartbreaking, my stomach dropped," he said in a phone interview. "I had to just try and compartmentalise it so I could enjoy today."

Sergeant Ochoa is unwavering in his desire to continue serving his country. In five days he is due to re-enlist.

"Now I don't even know if I can do that," he said. "It just seems like chaos, so many unknowns."

Image caption Sergeant Ken Ochoa is due to re-enlist in five days but now does not know if he can

It wasn't just service members that were caught by surprise, the timing of the announcement appeared to wrong-foot the military too. A spokeswoman for the Department of Defense (DOD) referred all questions to the White House, saying only that new guidance would be issued soon.

The White House did not respond to a request for comment. At a news conference, President Trump's spokeswoman Sarah Huckabee Sanders said the administration would work with the DOD to iron out the details. "I would imagine the Department of Defense will be the lead on that," she said.

For some, the fallout from the president's tweets was more certain. Riley Dosh trained for four years at the West Point military academy, graduating in May this year.

Ms Dosh came out as transgender while at the academy. She was secure in her decision following the Obama-era policy change and she had the full support of her commanders. Then, earlier this month, she was abruptly told she would not be allowed to commission as an officer alongside her peers.

Back at home in Austin, Texas, with no employment and no health insurance, she was awaiting a review of that decision. Now it seems certain that she's headed out of the army for good.

"I was already losing hope that I could commission, now I have absolutely no reason to have any," she said. "It's a final nail in the coffin for my military career."

She would find a Plan B though, she said. The situation was worse for those already in. "This is an absolute nightmare for my trans brothers and sisters who are serving. They now have absolutely no idea what their future is going to be."

Media playback is unsupported on your device Media caption Riley Dosh wanted to defend her country but now can't

Mr Trump's tweets may have come out of the blue but they followed a series of attacks on transgender service by Congressional Republicans.

Among them, Vicky Hartzler, Republican for Missouri, introduced an amendment to the near-$700bn armed forces funding bill - currently before congress - which sought to bar any military funds from being used for transgender medical care.

The amendment narrowly failed, but Mr Trump's tweets echoed Ms Hartzler in citing supposedly burdensome costs of transgender medical care - a concern which has riled Republican lawmakers.

An authoritative 2016 study by the Rand Corporation suggests the concern is unfounded. The study estimated that transgender health care costs for the estimated 2,450 active duty transgender troops would increase the health budget by between $2.4m and $8.4m annually - just 0.04% to 0.13% of the overall healthcare budget.

By comparison, the Pentagon spends about $84m annually on erectile dysfunction medication, according to a Military Times analysis - 10 times the upper estimate for transgender related costs.

Many active duty service members are already undergoing medical care related to transition. Sergeant Ochoa receives hormone therapy from his army physician, and was anticipating having a hysterectomy to lower the risk of cervical cancer created by testosterone.

It was unclear on Wednesday whether he would be able to continue with his treatment through the army, whether he would be forced to revert to female dress regulations, or if he could continue his army career at all.

"The thought of going back to serving as someone I'm not... It's just not something I could do and stay true to my character," he said.

Image copyright EPA Image caption A military pride parade in San Diego last week

LGBT advocacy groups were blindsided, and outraged, by the president's sudden announcement.

"This is a despicable assault on transgender troops who have been serving openly for more than a year," said Aaron Belkin, the director of the Palm Centre, a think tank which studies gender and sexuality in the military.

"You can't force people to go back in the closet, and you can't force them to serve on the basis of a lie if they've already been honest about their identity. It's unworkable for the troops and it's unworkable for the military, and it will compromise military readiness."

Matthew Thorn, executive director of OutServe, warned that discharging thousands of active duty troops would would cause chaos and resentment.

"The most important thing for service members is that the person sitting on their right and their left has their back, particularly in a wartime situation," he said. "When you start stripping away those people, that's what disrupts unit cohesion."

For those actively serving, who came out as transgender with an understanding from their commanders, and from President Obama, that they would no longer be discriminated against, the future is once again clouded by prejudice.

For Sergeant Ochoa, the only sensible response was to put on his dress blues, go to his graduation ceremony, and keep doing his job.

"The only thing I can do is carry on as best as I can, continue to be a professional and a drill sergeant to the best of my ability, and do that for as long as I have the opportunity," he said.