Donald Trump’s plan to deprive noncitizen immigrants of legal protections has suffered another setback.

The Trump administration broke the law when it denied hundreds of visa applications for immigrants who had been abused, neglected, or abandoned by a parent as minors under the Special Immigrant Juvenile program, a federal judge ruled on Friday.

The ruling is the latest in a string of federal court decisions rebuking the Trump administration’s attempts to drastically restrict immigration to the United States. Federal judges have blocked Trump’s attempt to end the Deferred Action for Childhood Arrivals program, better known as DACA, at least four times. In December, federal judges issued a preliminary injunction against the White House’s proposed asylum ban, and denied requests by the federal government to stay a temporary restraining order against it. The Justice Department appealed to the Supreme Court, which upheld the initial order blocking the ban.

The SIJ visa program, which was created in 1990, affords protected status to minors who were abused, neglected, or abandoned by one or both parents. It allows them to seek a green card, which grants lawful permanent residence in the United States. In February 2018, however, U.S. Citizenship and Immigration Services quietly issued internal guidance that led to a denial of applications for people who applied for SIJ status after they’d turned 18.

The agency never publicized the change, but it came to light after immigration attorneys began receiving notices that their clients would have their SIJ status denied or revoked. USCIS argued that family courts could not exercise custody over adults, and that they therefore don’t have the power to reunify applicants with a parent. (Family courts were involved in the process to determine whether an applicant was eligible for the program, which included determining whether reunification was viable.)

The Trump administration has characterized the SIJ program as being susceptible to abuse by criminals trying to enter the United States, without substantiating those claims. In a February press release that was unrelated to the SIJ policy change, DHS called to “end abuse” of the SIJ visa and claimed that unaccompanied immigrant children and their families are “Flooding the Border Because of Catch and Release Loopholes.” The agency argued that many unaccompanied minors “are able to obtain a Green Card through SIJ status even though they were smuggled here to reunify with one parent present in the United States,” and that the “influx of unaccompanied alien minors also creates recruiting opportunities for brutal gangs such as MS-13.” Last March, during Immigration and Customs Enforcement’s “Operation Matador,” the agency said it arrested 64 MS-13 members who had crossed the border as unaccompanied minors and received SIJ status.

By the time the February 2018 guidance was issued, it had been apparent for several months that the agency’s approach to the SIJ program was changing. As early as October 2017, USCIS began sending notices to young immigrants and their attorneys that it would deny requests for Special Immigrant Juvenile status made after applicants turned 18. Among them, a 21-year-old from El Salvador who’d fled threats from local gangs, including MS-13, that had been trying to recruit him since he was a teenager. Another, a 22-year-old from Haiti whose aunts physically beat her as a young child and whose father later abandoned her. Most of the denials happened in New York. Some had already had their applications approved, and others were still awaiting final decisions.

That was a major departure from the way USCIS used to handle SIJ applications. Before 2018, the agency regularly granted the special visas to minors who applied between the ages of 18 and 20. The program remains open to anyone under age 21. USCIS says the change was part of a 2016 policy update that streamlined the visa application review process, and that the February guidance clarified that officers should deny any requests submitted after the applicant had already turned 18.

Advocates, however, saw the move as part of a larger project by Trump to restrict immigration to the U.S., and to target the most vulnerable groups of people in the process. The February 2018 guidance prompted USCIS to internally review 5,500 cases that were put on hold. At least 260 applicants received denials, and at least 130 were told that they should expect their applications to be rejected.

“The administration has painted Special Immigrant Juvenile status as a ‘loophole,’” Beth Krause, a lawyer at the Legal Aid Society, told The Intercept. In July, together with Latham and Watkins LLP, Legal Aid brought a class-action suit against USCIS for the over-18 SIJ denials. They asked the court to issue a preliminary injunction to halt the implementation of the change, arguing that USCIS claims that New York Family Courts lacked jurisdiction as juvenile courts for people between the ages of 18 and 21 were part of an “arbitrary and capricious” policy, and imposed requirements that were outside the law.

“It has not been a secret that they have been trying to narrow the availability of Special Immigrant Juvenile status,” Krause said. The number of SIJ applications has skyrocketed over the past decade, from 1,600 in fiscal year 2010 to 21,800 in fiscal year 2018.

“They have expressed that this is — whether a loophole, or a way that MS-13 is getting status in the U.S., they were going after this status,” Krause explained.

A federal judge ruled on Friday that in changing its processes, USCIS broke the law. Judge John Koeltl of the U.S. Court for the Southern District of New York issued an injunction halting the change, and granted class status to the plaintiffs, allowing them to proceed anonymously. Plaintiffs have until Friday to submit proposals for how to proceed with the hundreds of cases impacted by the policy change. In a separate case, another federal judge last week allowed a class action suit in the Northern District of California against the over-18 SIJ denials to proceed. In that case, the judge had already issued a preliminary injunction against the USCIS policy.  

USCIS has argued that there was no policy change, but has acknowledged that it only started denying over-18 SIJ applications in early 2018. The agency argues that in those cases, it found that New York Family Courts didn’t have jurisdiction to make the custody determinations necessary to establish eligibility for SIJ status. Koeltl said that claim “is based on a misunderstanding of New York State law.”

“The agency’s lack of a reasoned explanation for a policy that requires a departure from years of agency practice ‘results in a rule that cannot carry the force of law,’” Koeltl wrote, quoting the Supreme Court decision in Encino Motorcars v. Navarro.

Krause said the order is applicable to cases outside of New York too. “This decision will certainly impact the cases that are already ongoing in California and Washington. It will certainly help other advocates that are considering filing actions against the government on their over-18 SIJ denials,” she told The Intercept.

“It also just reaffirms our perception of how this administration has been intentionally targeting some of the most vulnerable populations,” Krause continued. “We saw right through it. The judge saw through it. And they can’t act in this manner. The administration can’t, through policymaking, change statute. They can’t change the law that way. That has to be done through the legislative process.”

Federal courts have blocked attempts by the Trump administration to impose similar immigration regulations in other areas. In October, a federal court issued an injunction stopping a White House attempt to end Temporary Protected Status for immigrants from Haiti, Nicaragua, Sudan, and El Salvador. In August, another federal judge upheld a lower-court ruling blocking Trump’s executive order threatening to cut federal funding from so-called sanctuary cities that refused to cooperate with federal immigration authorities.

The Departments of Homeland Security and Health and Human Services in September proposed a rule change that would allow immigrant families and children to be held for indefinite periods in unlicensed facilities. Attorneys in that case argue that the change violates the Flores settlement, which sets guidelines for the length of time and the conditions in which migrant children can be detained. A judge temporarily suspended a motion by plaintiffs to block the change until the agencies issue final regulations. The parties are in confidential mediation on other aspects of the case.