The Supreme Court on Tuesday narrowly allowed the Trump administration to enforce a ban on transgender people serving in the military.

The 5-4 ruling temporarily reinstates the ban, but several lawsuits in lower courts are still pending.

The court’s four liberal justices, Ruth Bader Ginsburg, Stephen Breyer, Sonia Sotomayor and Elena Kagan, dissented.

Tuesday’s decision came after the Justice Department late last year asked the court to fast-track the case, claiming it was “an issue of imperative public importance.”

President Donald Trump hastily announced the ban in July 2017 in a series of three tweets, a decision made with minimal consultation from key government agencies and officials, including then-Defense Secretary James Mattis. Several lower courts have blocked the ban since it was introduced, while several more lawsuits are still being decided.

Seen as a play to Trump’s conservative base and widely condemned by LGBTQ rights advocates, the ban was a reversal of a 2016 Obama administration policy that allowed openly transgender individuals to serve in the military.

The Trump administration has argued that allowing openly transgender people to serve would be “too great a risk to military effectiveness and lethality,” despite a 2016 Rand Corp. study that concluded it would “have benefits for all service members by creating a more inclusive and diverse force” and have “little or no impact on unit cohesion, operational effectiveness, or readiness.”

This story has been updated with more background about the policy.