The bill, known as AB 32, was passed in 2019 and would have prohibited the state from entering or renewing contracts with private, for-profit prisons to incarcerate state inmates. After 2028, it would have prevented state inmates from “being incarcerated in a private, for-profit prison facility,” according to the bill’s text.

The 2-1 ruling from the 9th U.S. Circuit Court of Appeals ruled that the law impeded the federal government’s immigration policy because the United States Immigration and Customs Enforcement (ICE) relies on private detention centers in California to house undocumented immigrants. The decision was written by Judge Kenneth Lee, who was joined by Judge Bridget S. Bade.

“California’s law would thus compel the United States to shutter all ICE detention centers within the state,” the ruling read.

The decision reads, “California cannot intrude into the realm of the federal government’s exclusive powers to detain undocumented and other removable immigrants if the state law conflicts with federal law and violates the intergovernmental immunity doctrine.”

It also states that the law “bulldozes over the federal government’s ability to detain immigrants by trying to ban all the current immigration detention facilities in California.”

In the dissent, Judge Mary H. Murguia defended the bill, pointing to reports of “substandard conditions, inadequate medical care, sexual assault, and deaths in for-profit facilities” and disagreeing that it discriminates against the federal government.

“Nothing in AB 32 prevents the federal government from apprehending and detaining noncitizens who are present in the country unlawfully,” she wrote.

Bade and Lee were both appointed by former President Donald Trump, while Murguia was appointed by former President Barrack Obama.

The law had previously been upheld by a district court judge but was appealed by the federal government and GEO Group, a private prison company that runs two immigrant centers, the Los Angeles Times reported. California argued it had the legal authority to protect the health and safety of its detainees.

California Attorney General Rob Bonta, who wrote the law while he was in the State Assembly, said in a press release that the state will “continue the fight to ensure the dignities and rights of everyone in California are protected.”

“When we passed AB 32, we sent a clear message that putting an end to for-profit detention centers is key to achieving that goal,” he wrote. “Prisons and detention centers shouldn’t be places of profit.”

A spokesperson for Governor Gavin Newsom said in a statement to Newsweek that his office is reviewing the decision.

“For-profit prisons do not reflect California’s values and lead to over-incarceration. We will continue our efforts to protect the health and safety of all Californians,” the statement said.