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 $2.4m to $8.4m annually – just 0.04% to 0.13%.

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.

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.