WASHINGTON — A federal court on Monday blocked President Trump’s ban on transgender service members, preventing the Pentagon from overturning policies initiated by the Obama administration to allow transgender troops from serving openly.

The order in Washington by U.S. District Judge Colleen Kollar-Kotelly temporarily prevents to the Pentagon from enacting the ban that Trump announced by tweet in July.

The court found that the ban likely means the plaintiffs -- transgender troops some with decades or meritorious service – had their rights to due process violated.

In August, Defense Secretary Jim Mattis announced that transgender troops would be allowed to stay in the ranks while experts studied issues surrounding their service.

In 2016, the Pentagon rescinded its longstanding ban on service by transgender troops. The policy outlined how troops could receive medical treatment, including gender reassignment surgery. But on July 26, Trump surprised the Pentagon and tweeted that there was no room in the military for transgender troops and that the government would no longer pay for their treatment.

At the time, Mattis had already delayed plans to accept new transgender troops into military service. After Trump's tweets, Pentagon officials sought time to sort out the implications of his order.

Under then-Defense secretary Ash Carter, the Pentagon commissioned a study by the RAND Corp. to study the effects of allowing transgender troop to serve openly and the cost of treating them. RAND estimated that there are a few to several thousand transgender troops on the active duty force of about 1.3 million. Treatment costs and effects on military readiness — a top priority for Mattis — were deemed negligible.