In a court decision on Wednesday, a federal judge issued a resounding rebuke of a Trump administration policy that’s expanded the deportation of immigrants to “so-called ‘third countries’” where they have no ties.

The policy, which was detailed in Department of Homeland Security memos last year, allowed the administration to deport people to places other than their country of origin, with little notice. District Court Judge Brian E. Murphy ruled Wednesday that the policy was unlawful and failed to provide sufficient due process protections.

Murphy, a Biden appointee, determined the administration needed to try deporting people to other designated countries before pursuing removal to a “third country.” Additionally, if officials tried to deport someone to a third country, they would have to provide that person “meaningful notice” and an “opportunity to raise a country-specific claim against removal.”

“The Department of Homeland Security has adopted a policy whereby it may take people and drop them off in parts unknown—in so-called ‘third countries’—and, ‘as long as the Department doesn’t already know that there’s someone standing there waiting to shoot ... that’s fine,’” Murphy wrote in his decision. “It is not fine, nor is it legal.”