A federal judge in Maryland has temporarily blocked all of President Trump's would-be ban on transgender Americans serving in the U.S. armed forces or receiving transition-related health care through the military.

The decision comes just weeks after another federal judge, based in Washington, D.C., blocked most of the policy change.

Last year, after extended study of the issue, the military announced that trans service members could sign up for the military, serve openly and receive medical care related to their transition. This summer, Trump announced on Twitter that the policy would be reversed, which was followed by an official memo.

Like the D.C. judge, Judge Marvin Garbis in Maryland was struck by the haste and apparent lack of forethought that went into the change in policy. That bolstered the case of trans service members who sued and claimed that the policy violated their constitutional rights to equal protection and due process.

"A capricious, arbitrary, and unqualified tweet of new policy does not trump the methodical and systematic review by military stakeholders qualified to understand the ramifications of policy changes," Garbis wrote.

The service members also said the policy violated federal law, but the judge dismissed that portion of the lawsuit and only upheld the constitutional claims.

The case, like the case in D.C., is still pending. The order released Tuesday is a preliminary injunction, based on the judge's believe that the service members are likely to win their case, but it is not the end of the legal battle.

There's a key distinction between the two judge's orders.

The D.C. decision did not address the question of military funding for gender transition costs; the judge ruled that none of the plaintiffs could prove they would be affected by the new policy. Therefore, that portion of the policy change seemed poised to move forward.

But the Maryland case included two individuals who have treatment plans that call for surgeries in the future — a 34-year-old computer analyst in the Navy who served in Afghanistan and is waiting for two of his transition-related surgeries, and a 27-year-old Army staff sergeant who began her transition in September, before being promptly told her treatment would be denied.

The judge decided they would be affected by the change in policy, and accordingly, the "Sex Reassignment Surgery Directive" is now blocked as well.

The ACLU, which represented the service members in the Maryland case, celebrated the decision in a statement. Joshua Block, senior staff attorney with the ACLU's LGBT & HIV Project, called the injunction "a victory for transgender service members across the country."

If you need a refresher on the military's evolving policy on trans service members, here's how we summed it up in October:

"Before 2016, service members who came out as trans were "caught in limbo," as NPR has previously reported. They weren't eligible for promotion and were treated according to their gender assigned at birth. Troops who came out as trans could be discharged purely on the basis of their gender identity. Aspiring soldiers who were openly trans were considered unfit for duty."In June 2016, after lengthy deliberation, the Pentagon announced a policy change. 'Effective immediately, transgender Americans may serve openly,' then-Secretary of Defense Ash Carter said. And within a year, he said, the military would no longer turn away recruits on the basis of trans identity. (The deadline was later extended by six months.)"Then, this July, Trump tweeted that "the United States Government will not accept or allow transgender individuals to serve in any capacity in the U.S. Military," an announcement that caught many people (including leaders at the Defense Department) by surprise."The tweet was followed by an official presidential memo in August. The memo called for trans members of the military to once again be eligible for discharge based on their gender identity and for would-be service members who are openly trans to be prohibited from joining the military, effective on Jan. 1, 2018."The memo did not go as far as Trump's tweets. For instance, whether individuals currently serving would be discharged, among other elements of implementing the ban, would be up to Secretary of Defense Jim Mattis, according to the memo. Any steps taken should be 'appropriate and consistent with military effectiveness and lethality, budgetary constraints and applicable law,' the instructions stated."

Copyright 2017 NPR. To see more, visit http://www.npr.org/.