By Stephen Rex Brown

The Trump administration cannot withhold $29 million in federal money from New York and five other states that do not embrace harsh immigration policies, a judge wrote Friday, ruling that the effort violated the separation of powers.

Manhattan Federal Judge Edgardo Ramos said the money from the Edward Byrne Memorial Justice Assistance Grant Program has to be distributed to the states, as well as New York City.

Former Attorney General Jeff Sessions had spearheaded the effort to force "sanctuary" cities and states to implement policies such as allowing Immigration and Customs Enforcement easier access to jails, prisons and citizenship information in exchange for the grant money.

"The separation of powers acts as a check on tyranny and the concentration of power," Ramos wrote.

"These conditions violate the separation of powers."

The grant program is named after an NYPD cop, Edward Byrne, who was shot to death in 1988 while guarding the home of an immigrant targeted by gangs for reporting crimes in a Queens neighborhood.

"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. The Trump administration's attempt to withhold these vital funds was nothing more than a political attack at the expense of our public safety," said State Attorney General Barbara Underwood.

Ramos noted the city's basis for sanctuary policies that limit local authorities' cooperation with ICE.

"The City believes that these laws and policies are instrumental in maintaining the City's historically low crime rates by promoting trust and cooperation between the New York Police Department and the public, including immigrant communities that otherwise may retreat into the shadows if they believe that the police will share their information with federal immigration authorities," Ramos wrote.

By contrast, the feds did produce any assessment of the consequences of withholding the money.

"Conspicuously absent from all of these documents is any discussion of the negative impacts that may result from imposing the conditions, and the record is devoid of any analysis that the perceived benefits outweigh these drawbacks," Ramos wrote.

Mayor de Blasio said the ruling was a rebuke to President Trump's "fact-free claims" about immigration. The city was anticipating $4.3 million in crime-fighting funds through the program.

"The courts have spoken: President Trump's attempt to bully our city into enforcing his draconian immigration policies is unconstitutional," de Blasio said.

The Justice Department has lost similar suits filed around the country.

A Justice Department spokesman declined comment.

(c)2018 New York Daily News