STORKOW, Germany — On July 26, when President Trump unexpectedly tweeted his plans to ban transgender servicemen and women from the U.S. military, Anastasia Biefang was more than 4,000 miles away from Washington. Still, she could not hide her shock.

“It felt like a smack in the face,” said the 43-year-old German army officer, who is the first transgender person to command a military unit in her country’s history.

Biefang joined the German army as a man more than 23 years ago. Two years ago, despite fearing negative repercussions for her career, she came out to her superiors and eventually to her entire unit. Her decision to transition from male to female coincided with an unprecedented openness among top military officials in Germany, the United States and other countries to having transgender troops serve openly.

Since then, the United States and Germany have taken dramatically different turns. Biefang, now a lieutenant colonel, commands a logistics unit of more than 700 soldiers, and the Bundeswehr, Germany’s military, heralds her as a national role model. She is the first transgender commander in a force headed by a defense minister, Ursula von der Leyen, who has made support for transsexual and homosexual personnel a top priority.

“People who hold fears aren’t able to give their very best. We can’t afford that,” von der Leyen said in January. She largely echoed similar remarks by then-U.S. Defense Secretary Ashton B. Carter, who explained the decision to drop the American ban on transgender military service in 2016 by saying that “our mission – which is defending the country – has to come first.”

Trump came to a different conclusion.

In his July tweets, the president argued that “tremendous medical costs and disruption” were behind his decision to reinstitute the ban on transgender servicemembers – though a federal judge in Washington blocked Trump’s policy last month, writing that there is “absolutely no support for the claim that the ongoing service of transgender people would have any negative effect on the military at all.”

Trump’s battle to ban transgender servicemen and women is also feeding into a growing perception in Germany that Europe can no longer trust the United States as a reliable partner that shares its values. And while estrangement between Washington and its European allies partially dates back to the Iraq War, it has gained new momentum in the era of Trump.

In May this year, German Chancellor Angela Merkel offered a particularly blunt rebuke of Trump, saying that the days when her continent could rely on others were “over to a certain extent.” Merkel demanded in the same speech that Europe “really must take our fate into our own hands.”

At least 18 countries allow transgender service members to serve openly, including eight NATO members: Belgium, the Czech Republic, Denmark, Estonia, Britain, Spain, France and Germany. Their overall assessment is that allowing transgender service members to serve openly can be an advantage to their armed forces, according to a RAND Corp. report released last year. “None of the militaries that we examined reported a negative impact on the operational effectiveness, operation readiness, or cohesion of the force,” said political scientist Agnes Gereben Schaefer, who co-wrote the study.

“Many U.S. allies lifted their bans on allowing transgender service members to serve openly many decades ago,” she pointed out.

In Germany, Biefang has become an outspoken critic of Trump’s stance on transgender military service. She rejects Trump’s argument that transgender service members are too expensive as an “awful debate,” and suggests that the opposite is the case.

“What do I win as an employer if I have someone who’s forced to hide his or her private life?”