President Donald Trump holds a law enforcement roundtable on sanctuary cities March 20 in the Roosevelt Room at the White House. Photo by Kevin Dietsch/UPI | License Photo

Nov. 30 (UPI) -- A federal judge in New York ruled Friday the Trump administration's threat to withhold public safety funds to jurisdictions with so-called "sanctuary" policies is unconstitutional.

U.S. District Judge Edgardo Ramos of the Southern District of New York ruled in favor of seven states that sued the Justice Department after it required in June that states comply with new rules enforcing federal immigration law. The action put the country's local and state governments on notice that they would lose federal funding if they refused to cooperate.


Ramos said the Justice Department "did not have lawful authority" to force local and state governments to notify the federal government when an undocumented immigrant was in custody.

The states of Connecticut, Massachusetts, New Jersey, New York, Rhode Island, Virginia and Washington joined together for the suit.

New York Attorney General Barbara Underwood called the ruling a "major win" for the state's public safety.

"As we argued, local law enforcement has the right to decide how to meet their local public safety needs -- and the Trump administration simply does not have the right to require state and local police to act as federal immigration agents," she said. "The Trump administration's attempt to withhold these vital funds was nothing more than a political attack at the expense of our public safety."

In a separate case in August, a federal appeals court found an executive order by President Donald Trump threatening to withhold funds to be unconstitutional. That suit was brought by the city of San Francisco and Santa Clara County, both in California.

"We conclude that, under the principle of separation of powers and in consideration of the spending clause, which vests exclusive power to Congress to impose conditions on federal grants, the executive branch may not refuse to disperse the federal rants in question without congressional authorization," Judge Sidney Thomas wrote in that ruling.

Trump said some of the people protected by sanctuary policies include "bad actors," "predators," "rapists" and "killers" during a sanctuary cities roundtable event in March.

Read More Subdued migrants at Tijuana border camp consider options