U.S. President Donald Trump on Friday directed the Pentagon to extend indefinitely a ban on transgender individuals joining the military, but he appeared to leave open the possibility of allowing some already in uniform to remain.

Trump gave Defence Secretary Jim Mattis authority to decide the matter of openly transgender individuals already serving, and he said that until the Pentagon chief makes that decision, "no action may be taken against" them.

The Obama administration changed longstanding policy in June 2016, declaring that troops could serve openly as transgender individuals. And it set a July 2017 deadline for determining whether transgender people could be allowed to enter the military. Mattis delayed that to Jan. 1, 2018, and Trump has now instructed Mattis to extend it indefinitely.

But on the question of what will happen to those transgender individuals who already are serving openly — estimated to number in the low hundreds — Trump seemed to leave wiggle room for exceptions. A White House official who briefed reporters on the presidential order would not say whether Trump would permit any exceptions.

That official, who spoke on condition of anonymity under ground rules set by the White House, said Mattis has been directed to take a number of factors into consideration in determining how to deal with transgender individuals already serving.

Trump gave Defense Secretary Jim Mattis authority to decide the issue of whether openly transgender troops may continue serving in the military. (Alex Brandon/Associated Press)

Those factors are to include broad measures such as "military effectiveness," budgetary constraints and "unit cohesion," as well as other factors Mattis deems "relevant." It was not clear whether that means it is possible for Mattis to come to the conclusion that some transgender troops should be allowed to remain.

Trump gave Mattis six months to come up with a policy on those currently serving, and he must implement it by March 23, 2018, the official said.

In a tweet last month, Trump said the federal government "will not accept or allow" transgender individuals to serve "in any capacity" in the military.

Use of federal funds for sexual reassignment surgeries halted

The White House official on Friday said Trump also directed Mattis to halt the use of federal funds to pay for sexual reassignment surgeries and medications, except in cases where it is deemed necessary to protect the health of an individual who has already begun the transition. That policy is to be written within six months and implemented by March 23.

In his directive to Mattis, Trump said he found that his predecessor's transgender policy was flawed.

"In my judgment, the previous administration failed to identify a sufficient basis to conclude" that ending the longstanding ban on service by transgender people would not "hinder military effectiveness and lethality" and be disrupting in the ranks, he wrote.

The Pentagon had little to say on the subject Friday. Dana W. White, the main spokeswoman for Mattis, issued a two-sentence statement saying Mattis had received White House guidance on transgender policy, adding, "More information will be forthcoming."

Nick Rondoletto, left, and Doug Thorogood, a couple from San Francisco, protest Trumps's proposed ban of transgendered people in the military at a demonstration July 26, in San Francisco. (Olga R. Rodriguez/Associated Press)

Only one year ago, in June 2016, then-Defence Secretary Ash Carter announced that transgender individuals could serve openly for the first time. Prior to that, most transgender people in the military had been forced to keep their status secret to avoid being discharged; Trump's order appears to have returned the military to that same situation.

Since Carter's policy change, some troops — possibly around 200 — have openly declared their status as transgender individuals.

Carter also had given the military services until July 1 of this year to present plans for allowing transgender individuals to join the military. Shortly before that date, Mattis extended the study period to the end of this year. And shortly after that, Trump went to Twitter to announce a total ban, without having used the customary interagency policy process.

A flurry of meetings

At the time of Trump's tweet, the Pentagon was not prepared to change its policy. A flurry of White House meetings ensued, with participation by representatives of the Defence Department, to translate Trump's announcement into guidance that could be implemented and would stand up to expected legal challenges.

Just last week, Mattis suggested he was open to the possibility of allowing some transgender troops to remain in uniform.

"The policy is going to address whether or not transgenders can serve under what conditions, what medical support they require, how much time would they be perhaps non-deployable, leaving others to pick up their share of everything," he said Aug. 14.

Estimates of the number of transgender troops in the service vary widely. A Rand Corp. study said roughly 2,500 transgender personnel may be serving in active duty, and 1,500 in the reserves. It estimated only 30 to 130 active-duty troops out of a force of 1.3 million would seek transition-related health care each year. Costs could be $2.4 million to $8.4 million, it estimated.

Sen. Tammy Duckworth said Thursday, 'If you are willing to risk your life for our country and you can do the job, you should be able to serve, no matter your gender identity or sexual orientation.' (Charles Rex Arbogast/The Associated Press)

Among those who have cheered Trump's tweet, Elaine Donnelly said the president is halting "a massive social experiment."

"Expensive, lifelong hormone treatments and irreversible surgeries associated with gender dysphoria would negatively affect personal deployability and mission readiness, without resolving underlying psychological problems, including high risks of suicide," said Donnelly, president of the Center for Military Readiness.

Democratic Senator Tammy Duckworth, an Army combat veteran, said the Pentagon should not exclude people based on gender status.

"If you are willing to risk your life for our country and you can do the job, you should be able to serve — no matter your gender identity or sexual orientation," she said Thursday. "Anything else is not just discriminatory, it is disruptive to our military and it is counterproductive to our national security."