A law that said states and cities couldn't keep officials from reporting people's immigration status to U.S. authorities was struck down by a judge in California on Friday. The ruling was at least the third decision by a U.S. district court judge declaring the immigration law unconstitutional in recent months.

Subsequently, Judge William Orrick ruled, the Department of Justice needs to give California $28 million that was held back due to the state’s immigration policies.

The law was cited by the Trump administration earlier this year in litigation in an attempt to block multiple state laws, one of which prevented police from providing release dates and personal information of jail inmates. That information, officials claimed, was required in order to remove dangerous illegal immigrants.

Orrick's ruling Friday in lawsuits by California and San Francisco may be the most significant yet because it applies to a major target of the administration's opposition to sanctuary jurisdictions. Orrick forbade Attorney General Jeff Sessions from enforcing the immigration law against California or any of its cities or counties.

The law, the judge said, "undermines existing state and local policies and strips local policymakers of the power to decide for themselves whether to communicate with" immigration officials.

It also moves a portion of immigration enforcement costs onto states, he said.

"California expresses the legitimate concern that entanglement with federal immigration enforcement erodes the trust that Latino and undocumented immigrant communities have in local law enforcement," the judge said.

DOJ spokesman Devin O'Malley declined comment toThe Associated Press.

The Associated Press contributed to this report.