Updated

A federal judge reportedly ruled against the Trump administration on Friday, determining that it wasn't permitted to hold back millions of dollars in grant money from multiple states and New York City operating as "sanctuary" jurisdictions.

The decision from U.S. District Judge Edgardo Ramos was in favor of a petition by New York City and the state of New York, as well as others, according to The Associated Press.

The situation reportedly came to light after President Trump, through an executive order, said sanctuary cities would not be eligible to receive federal grants in many circumstances. After this order, the Justice Department instituted new requirements to the Edward Byrne Memorial Justice Assistance Grant Program, which supports state and local governments, The Associated Press reported.

Among the additions was a stipulation that when an illegal immigrant was released from custody, the local officials would notify federal agents, and let them question inmates regarding their status in the country, the outlet said.

Also, the local governments reportedly had to agree not to set limits on giving immigration officials citizenship information about anyone.

In rolling out the restrictions, then-U.S. Attorney General Jeff Sessions said the aim was to "encourage these 'sanctuary' jurisdictions to change their policies and partner with federal law enforcement to remove criminals.”

The newly imposed requirements went against the constitutional limits on the administration’s ability to control spending decisions and on federal power over states, the states and city argued.

Ramos wrote that the information-sharing requirement “impinges on (the states' and city's) sovereign authority and their citizens' liberty to be regulated under their preferred state and local policies.”

In a statement posted on Twitter, New York Attorney General Barbara Underwood hailed the ruling as “a major win for New Yorkers’ 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,” her statement 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.”

New York City Mayor Bill de Blasio tweeted  that the decision was “a huge victory, and a reminder that the safest big city in America knows better than anyone how to keep its people safe.”

In a statement to Fox News, DOJ Spokesman Steven Stafford said, "The federal government is not asking the states or anyone else to enforce our immigration laws."

"The United States is simply asking sanctuary jurisdictions to stop actively obstructing federal law enforcement," Stafford continued. "That is not only allowed by the Constitution, it is demanded by the Constitution. Sanctuary jurisdictions make the absurd claim that they should continue to receive federal law enforcement funding despite their deliberate efforts to frustrate the enforcement of federal law.”

Fox News' Jake Gibson and The Associated Press contributed to this report.