CNN  — 

The Trump administration can withhold federal money from seven states, as well as New York City, over their cooperation on immigration enforcement, a federal appeals court ruled Wednesday.

The decision by the 2nd US Circuit Court of Appeals reversed a lower court ruling that blocked the Justice Department from withholding a key law enforcement grant the department said was available only to cities that complied with specific immigration enforcement measures.

The federal appeals court ruling comes amid an ongoing feud between the Trump administration and so-called “sanctuary cities,” which limit cooperation between local law enforcement and federal immigration authorities. Over recent weeks, the administration has stepped up its fight against sanctuary jurisdictions and taken measures like barring New York residents from enrolling in certain Trusted Traveler programs, such as Global Entry.

Judge Reena Raggi, writing on behalf of the unanimous 3-judge panel, acknowledged the divisive nature of the issue at hand, writing: “The case implicates several of the most divisive issues confronting our country and, consequently, filling daily news headlines: national immigration policy, the enforcement of immigration laws, the status of illegal aliens in this country, and the ability of States and localities to adopt policies on such matters contrary to, or at odds with, those of the federal government.”

The city of New York is a plaintiff in the lawsuit, along with New York, Connecticut, New Jersey, Washington, Massachusetts, Virginia and Rhode Island.

In July 2017, then-Attorney General Jeff Sessions announced that applicants for Edward Byrne Memorial Justice Assistance Grants would have to comply with federal immigration enforcement. States pushed back and sued over the move.

Lower courts have blocked the Justice Department from adding new requirements for the policing grants. In April 2018, the 7th US Circuit Court of Appeals upheld a ruling in favor of the city of Chicago.

But Raggi noted in Wednesday’s ruling that the conditions on federal grants put forth by the administration in part help the government enforce national immigration laws and rejected the notion that the conditions “intrude on powers reserved to the States.”

The requirements announced in 2017 include allowing federal immigration authorities access to jails and providing the Department of Homeland Security advance notice before local officials release an undocumented immigrant wanted by federal authorities.

In a statement, a Justice Department spokesman heralded the ruling, saying: “Today’s decision rightfully recognizes the lawful authority of the Attorney General to ensure that Department of Justice grant recipients are not at the same time thwarting federal law enforcement priorities.”

“While today’s ruling is a major victory for Americans, its full scope will not be realized until the practices of granting nationwide injunctions and associational injunctions are stopped, as certain cities that are parties to this judgment may nonetheless use rulings from other courts to evade these lawful conditions,” the spokesman added.