A judge has barred the Trump administration from withholding public safety grants from the state and the city of Portland over Oregon’s sanctuary law that directs police not to help federal agents enforce immigration policies.

U.S. District Judge Michael J. McShane also said the federal government can’t impose immigration-related conditions on the grant awards.

McShane, who is seated in Eugene, issued his 44-page decision late Wednesday in a case brought in November by Gov. Kate Brown, Oregon Attorney General Ellen Rosenblum and the city against President Donald Trump and U.S. Attorney General William Barr.

He found that two federal statutes unconstitutionally ban local and state governments and agencies from enacting laws or policies that limit communication with federal officials about immigration or someone’s citizenship status.

McShane ruled the statutes, identified as Sections 1373 and 1644 of the federal code, violate the 10th Amendment, which says any power not expressly given to the federal government falls to the states or their people.

Since 2017, the federal government has placed restrictions on Edward Byrne Memorial Justice Assistance grants, known as JAG. The grants provide money to states, cities, counties and tribes for criminal justice personnel, training and equipment.

The conditions say the grant recipients must allow immigration agents access to prisons or jails , must give advance notice to federal officials when prisoners wanted on immigration detainers are to be released, and must certify that they’re complying with the federal statutes.

But McShane said Oregon and Portland “would, under any of these circumstances, risk public safety by eroding trust with immigrant communities or abandoning critical law enforcement initiatives funded by the Byrne JAG Program.”

He granted a permanent injunction and ordered the federal government to give the grants to Oregon for fiscal 2017 and 2018 that it withheld, with no conditions or penalties – a total of almost $5 million.

“The President of the United States and his Attorney General seek to advance their policy priorities by pressuring states and localities to comply with two immigration-related laws and by withholding federal funds from jurisdictions which refuse to assist immigration authorities,’”the judge noted.

McShane agreed with lawyers for the state and city, who argued the federal statutes are “unconstitutional intrusions upon their legislative independence” and that the funding conditions are contrary to the intent of Congress.

“Instances when the Attorney General may ‘withhold or re-allocate’ Byrne JAG funds were carefully delineated by Congress. When Congress wanted grantees to engage in or refrain from certain types of conduct — even information sharing — it provided for specific and measured penalties,” the judge wrote. “If Congress had shared the same concerns about grantees disclosing immigration-related information, it could have enacted analogous penalties. But it did not.’’

The state had expected to receive $2,034,945 from the grants for 2017 and $2,092,704 for 2018, while Portland expected to receive $385,515 for 2017 and $391,694 for 2018.

But the state didn’t receive notice of the grant awards for either year until last month because the U.S. Justice Department expressed concerns about the state’s sanctuary law. The state law bars local law enforcement from helping federal officials identify or detain anyone solely for violating immigration law.

Although the Justice Department made the money available to the state in July, the state can’t accept or draw from the money without risking penalties due to the sanctuary law, according to court records.

The city of Portland received its 2017 award last October but has yet to receive its 2018 award. It also would risk penalties if it accepted and used the money.

The Trump administration argued that the Justice Department’s pressure on states and municipalities to repeal their allegedly incompatible laws and policies “are essential to a properly functioning system of federal immigration laws,’’ according to court records.

Until 2017, the state had received the federal grants annually since the program’s creation in 2005, using more than $26 million to support programs for mental health treatment, technology improvement and drug treatment and enforcement. The state would like to use the 2017 and 2018 money to support specialty courts for drugs crimes or mental health cases or nonviolent felony offenders as well as to provide assistance to local crime victims.

Portland also had received the money every year until 2017, using it to buy bulletproof vests and special-threat plates for officers, acquire tactical medical kits, install GPS systems in its cars and add two victim advocates to the Police Bureau’s sex crimes unit. The city also has distributed some of the money to Multnomah County and Gresham to support a neighborhood prosecutor or an additional probation/parole officer.

McShane’s ruling mirrors similar ones by federal judges elsewhere in the country.

In December, for example, a federal judge in New York issued a permanent injunction barring immigration conditions on the grants for New York state, New Jersey, Connecticut, Virginia, Washington, Rhode Island, Massachusetts and New York City. Last October, a federal judge in California also ruled that the grant conditions were unconstitutional.

The 9th U.S. Circuit Court of Appeals in San Francisco ruled a year ago that Trump’s order to withhold federal grant money based on state sanctuary laws violates separation of power principles that gave spending power to Congress. But the same appeals court ruled last month in favor of the Trump administration’s immigration conditions for other federal police grants.

-- Maxine Bernstein

Email at mbernstein@oregonian.com

Follow on Twitter @maxoregonian

Visit subscription.oregonlive.com/newsletters to get Oregonian/OregonLive journalism delivered to your email inbox.