Judge P. Kevin Castel’s order Monday limited how immigration enforcement agents could act in and around New York City immigration court locations, aiming to keep people from being stopped when they were trying to exercise their right to attend hearings. The decision came after the court described a practice that had allowed agents to detain people in ways that forced arrivals to risk arrest if they showed up for proceedings.

Castel’s ruling did not apply nationwide. It was tailored to immigration courts at 26 Federal Plaza, 201 Varick Street and 290 Broadway in Manhattan—courthouse locations where people enter federal buildings to face immigration judges and where the judge said the stakes for defendants are heightened. Tuesday’s arrest, reported by immigration-rights advocates a day later, occurred in one of those covered buildings, raising questions for the groups challenging the policy over whether it was being followed in practice.

In his written decision, Castel said the government has “a strong governmental interest in enforcing immigration laws,” but he said the court also had to consider “a serious interest in letting people attend their own court hearings without fear of arrest.” He said the government still could act, but not in the way that would deter attendance, and he laid out what continued enforcement could look like.

Castel said federal agents could still detain people at locations away from immigration courts and could also make arrests at courthouses when there are “serious threats to public safety.” The advocates and others trying to determine what happened Tuesday said it was not immediately clear whether that arrest fell within those narrow public-safety exceptions.

The lawsuit that led to Monday’s order was brought by the New York Civil Liberties Union, the American Civil Liberties Union, Make the Road NY and others. Advocates said the practice addressed in the case dated to the Trump administration and involved detentions of people who complied with requirements to appear before immigration judges—detentions that sometimes produced dramatic scenes in courthouse hallways as family members were separated.

Benjamin Remy, a coordinating senior attorney at the New York Legal Assistance Group, said advocates were not surprised that ICE would continue operations at 26 Federal Plaza despite the ruling. “We’re not shocked that ICE kept their presence in 26 Federal Plaza despite Judge Castel’s ruling yesterday,” Remy said, describing how legal teams had been operating in the same courthouse-adjacent settings.

Kaye Dyja, a spokesperson for the New York Civil Liberties Union, said the group was looking into the Tuesday arrest and “gathering information” to assess whether it complied with the narrow rules Castel said still allowed arrests. U.S. Rep. Dan Goldman, a New York Democrat, said the arrest appeared to violate the court order, calling it “a blatant violation of a court order” and “an absolutely outrageous thumb-in-the-eye of our Constitution.”

The Department of Homeland Security did not immediately comment after the arrest. In a statement issued earlier that criticized the judge’s ruling, the agency said it was “common sense to take illegal aliens into custody following the completion of their removal proceedings,” and it added, “Nothing prohibits arresting a lawbreaker where you find them. We are confident we will ultimately be vindicated in this case.”

Amy Belsher, director of the NYCLU’s Immigrants’ Rights Litigation, praised the order Monday, calling it “an enormous win for noncitizen New Yorkers seeking to safely attend their immigration court proceedings.” The next step for advocates, according to the group that said it would file for the man’s release, is asking a court to determine whether Tuesday’s arrest was consistent with Castel’s limits on when agents may detain people who show up for hearings.