COLORADO SPRINGS — Joining the Navy was one of the best decisions Alec Kerry said she had ever made. The other was coming out as transgender.

“The Navy taught me how people can come together and work hard to achieve something bigger than themselves,” said Petty Officer Kerry, 24, who is training to operate nuclear reactors and soon plans to adopt the name Eva. “Strangely enough, I think what the Navy taught us about integrity was what gave me the courage to come out. I had to be honest about who I was with myself and the people I served with.”

Like thousands of other transgender veterans and members of the military, she grappled with a mix of anger, sadness and fear on Wednesday after President Trump tweeted that the United States military would no longer “accept or allow” transgender people to serve — a surprise move that came a year after the Obama administration permitted transgender troops to serve openly.

Some transgender troops were left to wonder if they would face a quick discharge from the military or if scheduled medical appointments would be canceled. And nearly all expressed dismay at what they saw as a misguided action that could purge the military of untold numbers of highly skilled and dedicated service members, bringing back an era when many troops lived in secrecy and shame.