U.S. District Judge James Boasberg delivered a controversial ruling on Wednesday, ordering the Trump administration to allow non-citizens deported to a maximum-security prison in El Salvador the opportunity to contest their deportations in court, Fox News reports. The decision centers on President Donald Trump’s use of the 1789 Alien Enemies Act to remove certain migrants, a move that has sparked ongoing legal battles.

Judge Boasberg’s order requires the government to ensure that deported individuals have access to habeas corpus relief, enabling them to challenge the basis of their removal, including allegations of gang affiliation. The specifics of how the government must facilitate this legal access will be determined in upcoming court proceedings. While Judge Boasberg acknowledged the potential diplomatic and national security implications, he emphasized what he says is the court’s constitutional responsibility to provide remedies for any injustices.

“In short, the Government must facilitate the Class’s ability to seek habeas relief to contest their removal under the Act,” Judge Boasberg said in the order. “Exactly what such facilitation must entail will be determined in future proceedings. Although the Court is mindful that such a remedy may implicate sensitive diplomatic or national-security concerns within the exclusive province of the Executive Branch, it also has a constitutional duty to provide a remedy that will ‘make good the wrong done.’”

One high-profile case affected by this ruling involves Kilmar Armando Abrego Garcia, a Salvadoran migrant and alleged MS-13 member who was deported from Maryland to El Salvador in March.

Earlier this year, Judge Boasberg made headlines by issuing an emergency order halting the Trump administration’s use of a 1798 law to swiftly deport Venezuelan nationals, including suspected members of the violent Tren de Aragua gang that has been terrorizing communities across the nation. He also ordered that a plane carrying migrants removed under this law be returned to the U.S.—an order that was not carried out.

The Trump administration continues to face multiple challenges over its use of the Alien Enemies Act for deportation flights conducted in March, with Judge Boasberg’s latest ruling representing another obstacle for the policy.