(CN) – A federal judge issued an injunction Monday against President Donald Trump’s ban against transgender people serving in the military.

Trump announced the ban in August, saying he would end a 2016 policy that allowed transgender troops to serve openly.

The White House memo said the administration planned to return to the policy that had been in place prior to June 2016. Under that policy service members could be discharged for being transgender.

It also targeted transgender-related gender-reassignment surgery for those currently enlisted.

But U.S. District Judge Colleen Kollar-Kotelly concluded Monday that Trump is likely to lose in couert to the transgender members of the military who have sued over the change.

Kollar-Kotelly’s order blocks the ban as it pertains to current service members and the recruitment of a transgender individuals, but it keeps in place the president’s prohibition on coverage for sexual-reassignment surgery.

She pointed to “the sheer breadth of the exclusion ordered by the directives” and “the unusual circumstances surrounding the President’s announcement of them” as reasons for striking part of the order.

President Barack Obama rolled back a ban on transgender service members in 2016, allowing them to serve openly for the first time.

Trump initially used his Twitter account to announced the ban, but was sharply rebuked by the Pentagon, which took the rare step of criticizing the commander-in-chief for not following longstanding procedures.

Kollar-Kotelly found that Trump’s use of Twitter to announce an upcoming ban violated the U.S. Supreme Court’s ruling in Arlington Heights v. Metro Hous. Dev. Corp. In that case, the high court held which holds “the specific sequence of events leading up the challenged decision … may shed some light on the decision maker’s purposes.”

Kollar-Kotelly said Trump’s tweets threw transgender service members’ lives into chaos even before the formal order was issued, and this bolstered the plaintiffs’ contention that the president had violated their Fifth Amendment equal-protection rights.

However, the judge found plaintiffs arguments regarding reassignment surgery and related medical treatments unpersuasive. No “plaintiff has demonstrated that they are substantially likely to be impacted by this directive,” she found.

Peter Renn, senior attorney at Lambda Legal, said he was unsurprised to see Trump’s tweets lead to the dissolution of his order. The individuals his group is representing experienced that chaos firsthand, he said.

“Some of our clients basically woke up and, on the internet, saw the president was declaring them unfit to do their jobs,” Renn said. “It’s to be expected the courts focus on that. It’s a highly unusual way to unveil a major shift in government policy.”

Despite Monday’s ruling, the military could still effect a ban of its own. Defense Secretary James Matthis has said the Pentagon will begin the study of the effects of such a ban.

“Our focus must always be on what is best for the military’s combat effectiveness leading to victory on the battlefield,” Matthis wrote. “To that end, I will establish a panel of experts serving within the Departments of Defense and Homeland Security to provide advice and recommendations on the implementation of the president’s direction.”

This is the second time the U.S. military has invested resources in a study of the impact transgender soldiers have on military performance.

A RAND study, commissioned by the Defense Department and released in 2016, showed the small number of transgender service members — estimated to be in the thousands compared to 1.3 million total employees — would have little financial impact from medical treatments. It also showed no evidence of transgender people having “an effect on operational effectiveness, operational readiness or cohesion.”

“Only a small portion of service members would likely seek gender transition-related medical treatments that would affect their deployability or health care costs,” Agnes Gereben Schaefer, the study’s lead author, found.

Kollar-Kotelly said the RAND study played a role in her reasoning for issuing the injunction.

“Not only did [RAND] conclude that allowing transgender people to serve would not significantly affect military readiness or costs, it found that prohibiting transgender people from serving undermines military effectiveness and readiness because it excludes qualified individuals on a basis that has no relevance to one’s fitness to serve, and creates unexpected vacancies requiring expensive and time-consuming recruitment and training of replacements,” the judge wrote.

Though pleased with the ruling, Renn said he knows this is just one development in what is sure to be a long fight.

“This is of course not the final judgment on the merits,” he said. “But it’s an incredibly important step towards dismantling this harmful and discriminatory policy.”