President Trump touched off a firestorm Wednesday after tweeting that he wants to ban transgender people from serving in the U.S. military in any capacity -- citing advice from his "generals" and medical costs.

In a series of tweets, he wrote:

"After consultation with my Generals and military experts, please be advised that the United States Government will not accept or allow...Transgender individuals to serve in any capacity in the U.S. Military. Our 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. Thank you."

The president’s tweets came only a few weeks after Defense Secretary James Mattis said he would give military chiefs another six months to conduct a review to determine if allowing transgender individuals to enlist in the armed services will affect the “readiness or lethality” of the force. The deadline for that review was Dec. 1, 2017.

“This is worse than don’t ask don’t tell, this is don’t serve, don’t serve,” The National Center for Transgender Equality said in a written statement. “This is an appalling attack on our service members; it is about bigotry rather than military readiness, reason or science. It is indefensible and cannot stand.”

The Family Research Council praised Trump’s action.

“I applaud President 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,” FRC President Tony Perkins said in a statement. “The military can now focus its efforts on preparing to fight and win wars rather than being used to advance the Obama social agenda.”

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."

But Trump himself tweeted during the campaign season that he would "fight" for the LGBTQ community while his opponent "Hillary (Clinton) brings in more people that will threaten your freedoms and beliefs."

During his confirmation hearing in January, Mattis was asked whether he believed that allowing LGBT Americans to serve in the military or women in combat would undermine the military’s lethality.

“Frankly, senator, I’ve never cared much about two consenting adults and who they go to bed with,” Mattis testified.

Abbie Goldberg, professor of psychology at Clark University who has researched and written about the LGBTQ community, told Fox News “no one wins under Trump’s plan.”

“Some people will not serve, which is a loss to the military and the country,” Goldberg said. “Others will serve, but not openly, and thus they will be at risk for discharge or verbal, physical and sexual abuse.”

The Pentagon has refused to release any data on the number of transgender troops currently serving. A RAND study found that there are between 2,500 and 7,000 transgender service members in the active-duty military, and another 1,500 to 4,000 in the reserves.

The study also found that allowing transgender people to serve in the military would have a "minimal impact" on the health care costs.

The Pentagon announced it would “continue to work closely with the White House to address the new guidance provided by the commander in chief on transgender individuals serving in the military.”

“We will provide revised guidance to the Department in the near future,” Pentagon spokesman Capt. Jeff Davis said in statement.

Trump’s announcement comes as lawmakers on Capitol Hill debate the current practice of requiring the Pentagon to pay for medical treatment for gender transition.

Missouri Republican Rep. Vicky Hartzler offered an amendment that would prohibit the Pentagon from spending money on transition surgeries or hormone therapy. Her amendment was narrowly defeated earlier this month.

House Minority Leader Nancy Pelosi, D-Calif., called Trump’s decision a “cruel and arbitrary decision designed to humiliate transgender Americans.”

“On this very day in 1948, President Harry Truman signed the executive order desegregating the U.S. military. Sixty-nine years later, President Trump has chosen this day to unleash a vile and hateful agenda that will blindside thousands of patriotic Americans already serving with honor and bravery,” she said.

Sen. John McCain, R-Ariz.,slammed the sudden announcement and said anyone who is fit to serve in the military should be allowed to do so.

“The president’s tweet this morning regarding transgender Americans in the military is yet another example of why major policy announcements should not be made via Twitter,” McCain, the chairman of the Senate Armed Services Committee, said.

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 Oct. 1, transgender troops have been able to receive medical care and start formally changing their gender identifications in the Pentagon's personnel system.

But Carter also gave the services until July 1 to develop policies to allow people already identifying as transgender to newly join the military, if they meet physical, medical and other standards, and have been stable in their identified genders for 18 months.

"I continue to maintain that what matters in choosing those who serve is that they are best qualified," Carter said in a statement. "To choose service members on other grounds than military qualifications is social policy and has no place in our military. There are already transgender individuals who are serving capably and honorably. This action would also send the wrong signal to a younger generation thinking about military service.”

Key concerns include whether currently enlisted troops have had medical or other issues that cause delays or problems with their ability to deploy or meet physical or other standards for their jobs. Military leaders also wanted to review how transgender troops are treated, if they're discriminated against or if they have had disciplinary problems, the officials said. They were not authorized to discuss internal deliberations publicly, so spoke on condition of anonymity.

Fox News' Lucas Tomlinson, Christopher Carbone and The Associated Press contributed to this report.