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 in June 2016 had changed longstanding policy, 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. Mr Mattis delayed that to Jan. 1, 2018, and Mr Trump has now instructed Mr 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 - Mr Trump seemed to leave wiggle room for exceptions. A White House official who briefed reporters on the presidential order would not say whether Mr Trump would permit any exceptions.

That official, who spoke on condition of anonymity under ground rules set by the White House, said Mr Mattis has been directed to take a number of factors into consideration in determining how to deal with transgender individuals already serving. Those factors are to include broad measures such as "military effectiveness," budgetary constraints and "unit cohesion," as well as other factors Mr Mattis deems "relevant." It was not clear whether that means it is possible for Mr Mattis to come to the conclusion that some transgender troops should be allowed to remain.