A federal judge in Illinois on Friday ruled against two parts of the Department of Justice’s (DOJ) policy of denying federal funds to sanctuary cities, but sustained a key third part, in a mixed decision that both sides will now appeal.

President Donald Trump signed Executive Order 13768 (EO) on January 25. Section 2(c) of that EO declared it the policy of the federal government to “ensure that jurisdictions that fail to comply with applicable Federal law do not receive Federal funds, except as mandated by law.” This provision combats the growing trend of sanctuary cities: municipalities that refuse to cooperate with the federal government regarding illegal aliens.

In July, Attorney General Jeff Sessions implemented the president’s EO by announcing a policy that includes three requirements for cities and counties that receive federal law enforcement funding through the Byrne JAG Program. First, local police must give the Department of Homeland Security (DHS) advance notice before releasing a foreigner from jail or prison. Second, local authorities must give federal agents access to jail and prison facilities to investigate foreigners in custody. And third, local governments must sign an agreement to comply with federal law in order to receive Byrne JAG funding.

Chicago Mayor Rahm Emanuel sued DOJ in the U.S. District Court for the Northern District of Illinois, represented by a powerhouse Washington, D.C., law firm.

Chicago’s lawyers argue that DOJ’s new policy exceeds the authority Congress has conferred on the department by statute, and that this policy also violates state sovereignty as protected by the Constitution’s Tenth Amendment. The city also asked for a preliminary injunction to block DOJ’s policy while this litigation is ongoing.

On Friday, Judge Harry Leinenweber in a 41-page order granted a preliminary injunction against two parts of the policy, but denied it on a third part, ruling on that item in favor of DOJ.

Leinenweber blocked the notice and access provisions, holding that Congress did not authorize DOJ to impose conditions on this federal grant program.

“Congress may well have Spending Clause power to impose the conditions or delegate to the Executive Branch the power to impose them, including the notice and access condition, but it must exert that power through statute,” the court declared. “The Executive Branch cannot impose the conditions without Congressional authority, and that authority has not been conferred through [the law under consideration].”

The court denied Chicago’s request to enjoin the third part of the policy, which requires cities to certify that they will comply with applicable federal law as a condition for eligibility to get the federal funds.

“Congress could expect an entity receiving federal funds to certify its compliance with federal law, as the entity is—independent of receiving federal funds—obligated to comply,” the judge explained.

“It is undisputed that Congress has plenary power to legislate on the subject of aliens,” Leinenweber continued, affirming federal supremacy on setting immigration policy. That supremacy enables DOJ to impose this condition.

“Congress acts constitutionally when it determines that localities may not prevent local officers from voluntarily cooperating with a federal program or discipline them for doing so,” the court concluded.

The Windy City and DOJ are sure to both appeal the parts of the ruling they disagree with. These cross-appeals will go to the U.S. Court of Appeals for the Seventh Circuit, which sits in Chicago.

The case is City of Chicago v. Sessions, No. 1:17-cv-5720 in the Northern District of Illinois.