In this March 27, 2008 file photo, the Pentagon is seen in this aerial view in Washington. President Donald Trump says he will bar transgender individuals from serving “in any capacity” in the armed forces. (AP Photo/Charles Dharapak, File)

WASHINGTON (AP) — President Donald Trump said Wednesday he wants transgender people barred from serving in the U.S. military “in any capacity,” citing “tremendous medical costs and disruption.”

Trump’s announcement on Twitter would reverse the effort under President Barack Obama to open the armed services to transgender people. He did not say what would happen to transgender troops already in the military.

The president tweeted that he was making his announcement after consulting with “generals and military experts,” but he did not name any. He said the 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.”

The White House did not immediately respond to questions.

At the Pentagon, members of the staff of Defense Secretary Jim Mattis appeared to have been caught unaware by Trump’s tweets. A Pentagon spokesman, Navy Capt. Jeff Davis, referred questions to the White House.

In a brief written statement, Davis said the Pentagon is working with the White House to “address” what he called “the new guidance” from the president. He said the Pentagon will provide revised guidance to Defense Department officials “in the near future.”

Transgender service members have been able to serve openly in the military since last year, when former Defense Secretary Ash Carter ended the ban. Since last Oct. 1, they have been able to receive medical care and start formally changing their gender identifications in the Pentagon’s personnel system.

Carter also gave the services until July 1 to develop policies to allow people already identifying as transgender to newly join the military. Mattis announced earlier this month that he was giving military chiefs another six months to conduct a review to determine if allowing transgender individuals to enlist in the armed services would affect the “readiness or lethality” of the force.

Already, there are as many as 250 service members in the process of transitioning to their preferred genders or who have been approved to formally change gender within the Pentagon’s personnel system, according to several defense officials.

The Pentagon has refused to release any data on the number of transgender troops currently serving. A Rand Corp. study estimated that there are between 2,500 and 7,000 service members on active duty who self-identify as transgender and an additional 1,500 to 4,000 in the reserves. There are about 1.3 million troops in the military.

Trump’s decision drew swift outrage from LGBT groups and supporters.

Sen. Tammy Duckworth of Illinois, a double amputee veteran of the Iraq War, said that when her Black Hawk helicopter was shot down, she didn’t care “if the American troops risking their lives to help save me were gay, straight, transgender or anything else. All that mattered was they didn’t leave me behind.”

Matt Thorn, executive director of OutServe-SLDN, which represents the LGBT population in the military, said thousands have been serving in the U.S. armed forces without causing any issues.

“It’s an absolute absurdity and another overstep,” Thorn said. He threatened legal action if Wednesday’s decision is not reversed.

Some lawmakers said this was not the right process for such a policy change.

Sen. John McCain, the Arizona Republican who chairs the Senate Armed Services Committee, said the tweet was “another example of why major policy announcements should not be made via Twitter.”

McCain said “any American who meets current medical and readiness standards should be allowed to continue serving. There is no reason to force service members who are able to fight, train and deploy to leave the military_regardless of their gender identity.” He said there should be no policy changes until the current review is completed and assessed by the secretary of defense, military leaders and Congress.

Some conservative organizations and lawmakers hailed the decision.

Family Research Council President Tony Perkins applauded Trump for “keeping his promise to return to military priorities — and not continue the social experimentation of the Obama era that has crippled our nation’s military.”

Rep. Steve King, R-Iowa, said “we don’t need to be experimenting with the military. Plus there’s no reason to take on that kind of financial burden.”

During his election campaign, Trump occasionally presented himself as a potential ally of gays and lesbians, promising to be a “real friend” of their community.

However, LGBT activists have been angered by many of his administration’s actions, including the rollback of federal guidance advising school districts to let transgender students use the bathrooms and locker rooms of their choice. Many top members of the administration are long-time foes of LGBT-rights policy changes, including Vice President Mike Pence, Attorney General Jeff Sessions and Health and Human Services Secretary Tom Price.