A federal judge on Tuesday blocked all aspects of President Donald Trump's ban on transgender people serving in the U.S. military.

This is the second ruling against the policy.

U.S. District Judge Marvin Garbis issued a preliminary injunction against the ban, saying that it violates equal protection under the law.

“There is no doubt that the directives in the president’s memorandum set apart transgender service members to be treated differently from all other military service members,” Garbis writo. “Defendants argue that deference is owed to military personnel decisions and to the military’s policymaking process. The court does not disagree. However, the court takes note of the amici of retired military officers and former national security officials, who state ‘this is not a case where deference is warranted, in light of the absence of any considered military policymaking process, and the sharp departure from decades of precedent on the approach of the U.S. military to major personnel policy changes.'”

Last month, U.S. District Judge Colleen Kollar-Kotelly largely blocked the ban from taking effect. But she left in place portions of the ban that call on the military to stop paying for sex reassignment surgeries and prohibit transgender people from enlisting in the military. The Department of Justice on Tuesday appealed the ruling.

Garbis' ruling goes further, requiring the U.S. military to pay for reassignment surgery and admit qualified transgender individuals.

Trump tweeted the policy change in July. Garbis made note of that, saying that “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.”

The American Civil Liberties Union (ACLU), ACLU of Maryland and Covington & Burling LLP are representing six transgender service members in the lawsuit. Three additional challenges to the ban have been filed.

Joshua Block, senior staff attorney with the ACLU's LGBT & HIV Project, applauded the ruling.

“Today is a victory for transgender service members across the country,” Block said in a statement. “We’re pleased that the courts have stepped in to ensure that trans service members are treated with the dignity and respect they deserve.”