WASHINGTON — A second federal judge blocked the Trump administration’s proposed ban on transgender troops Tuesday, saying President Trump’s announcement of the ban in a series of tweets this summer was “capricious, arbitrary, and unqualified.”

In a preliminary injunction, Judge Marvin J. Garbis of the Federal District Court for Maryland halted a policy that would have discharged all current transgender troops and barred prospective ones from enlisting, saying it likely violated equal protection provisions of the Constitution.

Judge Garbis’s 53-page order went further than a similar ruling last month by Judge Colleen Kollar-Kotelly of the Federal District Court for the District of Columbia, which also said the ban likely violated the Constitution. “There is absolutely no support for the claim that the ongoing service of transgender people would have any negative effective on the military at all,” the ruling said.

But while Judge Kollar-Kotelly did not specifically block a Trump administration policy prohibiting gender-reassignment surgery for service members at the government’s expense, Judge Garbis’s order does.