President Donald Trump announced Wednesday morning that the U.S. military will not accept openly transgender individuals, reversing an Obama administration policy directive.

Earlier this month, Defense Secretary James Mattis had said he would delay new admissions of openly transgender Americans into the military until Jan. 1, on the advice of military brass.

But Trump’s announcement appeared to seal the matter, at least for the time being.

Trump made the announcement in three tweets Wednesday, saying he had consulted with Pentagon leaders.

Trump’s announcement could affect 2,500 service members and 1,500 reserves who are transgender, based on numbers from a RAND Corp. study in 2015. Sex transition surgeries and hormone treatments would cost taxpayers about $3.7 billion over the next decade, according to the Family Research Council.

Ash Carter, President Barack Obama’s last defense secretary, announced a policy change in 2015 allowing transgender people to openly serve in the military. Since that time, the Pentagon has delayed implementation as leaders of the branches evaluated details of how the change would affect military operations from a legal, medical, and administrative standpoint.

“Unless Congress passes a law that says the military must accept transgender people, the military can set its own rules,” Thomas Spoehr, director of the Center for National Defense at The Heritage Foundation, told The Daily Signal in a phone interview Wednesday.

Spoehr said Trump appears to have assessed related issues with military commanders and determined the Obama-Carter policy would not help military readiness.

“He could not see the military utility of allowing transgender people to serve in the military,” Spoehr said, summarizing the apparent bottom line of the president’s decision.

>>> Commentary:  I Was Once Transgender. Why I Think Trump Made the Right Decision

Trump appears to have public opinion behind him. A Rasmussen Reports poll last month found that 23 percent of likely voters say they support allowing openly transgender individuals to serve in the military. Another 31 percent said it would be bad for the military, while 38 percent said it would have no impact.

However, the president’s abrupt announcement via Twitter—which Pentagon public relations officials weren’t prepared for—could prompt legal action.

In a formal statement, the LGBT military advocacy group OutServe-Servicemembers Legal Defense Network said:

In his latest example of pseudo-policy-by-twitter, Donald Trump has shown blatant disregard for transgender service members who have been serving openly since October 2016. The disruptive burden to the military comes from indecision in a White House which itself is not focused on victory if it’s targeting service members. The readiness, effectiveness, and lethality of the armed services comes from the commitment of our troops—not the vagaries and bigotry of exclusionary policies.

We are committed to transgender service members. We are going to fight for them as hard as they are fighting for the country. And we’re going to start by taking the fight to Donald Trump in the federal court.

Over the past two weeks, House Republicans split on whether to include language in military funding legislation to prevent tax dollars from being spent on sex changes and hormone therapies for transgender individuals.

In proposing an amendment to the Keep America Safe Act, Rep. Scott Perry, R-Pa., said on the House floor July 14:

We are $20 trillion in debt and the taxpayers, by my figures, are projected to spend $3.7 billion in the next 10 years for sex-reassignment surgeries and hormone therapies for those in the military that wish to transition from one sex to another. The total cost includes the manpower while the individual transitions, which can take up to a year or longer.

Spoehr said Trump’s announcement likely makes the House debate moot.

Asked if the president’s decision would affect transgender individuals already serving in the military, White House press secretary Sarah Huckabee Sanders said the White House and Defense Department will be working out details.

>>> Commentary: 5 Good Reasons Transgender Accommodations Aren’t Compatible With Military Realities

Rep. Vicky Hartzler, R-Mo., who proposed the original amendment prohibiting funding costly surgeries and treatments as part of the National Defense Authorization Act, welcomed Trump’s decision.

“Our military is the most effective, efficient, and well-funded fighting force in the world, and as the president notes, we cannot burden our armed forces with the tremendous costs and disruptions that transgenders in the military would entail,” Hartzler, a member of the House Armed Services Committee, said in a formal statement, adding:

With the challenges we are facing across the globe, we are asking the American people to invest their hard-earned money in national defense. Each dollar needs to be spent to address threats facing our nation. The costs incurred by funding transgender surgeries and the required additional care it demands should not be the focus of our military resources.

Trump deserves credit for following through on a broader promise to protect the military, said Tony Perkins, president of the Family Research Council, which researches and promotes conservative social policies.

“It’s rare that a political leader will do what he says he’ll do and push back against sacred cows,” Perkins told reporters during a conference call.  The former Marine added: “The Republican platform to oppose social engineering foisted on the military by the previous administration.”

James Dobson, founder of Focus on the Family, also issued a statement supporting Trump’s decision, saying:

For eight years, the Department of Defense under President Obama went about the systematic and intentional transformation of the U.S. military, unnecessarily disrupting the world’s most elite fighting force from their most pressing and urgent requirement—keeping our country and its allies safe. It is heartening to have a commander in chief who puts the expert opinions of his generals and military officials ahead of the destructive forces of political correctness and identity politics.

This report was updated to include comments from Sanders, Hartzler, Perkins, and Dobson.