California’s governor, Gavin Newsom, signed into law on Friday a statewide ban on private prisons, in a move likely to set off another legal battle between the Trump administration and California.

The new law prohibits California’s prison authority from contracting with private companies to jail criminal detainees and requires the state to phase out existing contracts by 2028. The ban also applies to companies that hold immigrant detainees for the US Immigration and Customs Enforcement agency.

A Geo Group spokesperson said that the company, which operates four private prisons and two immigration detention centers in California, has been in talks with Ice and the US Marshals Service, and that they believe the new law will be struck down by the courts.

“In particular, we believe the restrictions to force a phase-out of federal detention facilities under private management run afoul of the US constitution’s supremacy clause,” the company’s spokesperson said. “States cannot lawfully pass legislation mandating the closure of federal facilities that displease them on the basis of ideological differences.”

California lawmakers disagree and say the ban is part of a broader criminal justice reform push that will protect prisoners serving criminal sentences and immigrants in civil detention from dangerous conditions inside privately run jails.

“We are sending a powerful message that we vehemently oppose the practice of profiteering off the backs of Californians in custody, that we will stand up for the health, safety and welfare of our people, and that we are committed to humane treatment for all,” said the assembly member Rob Bonta, who authored the measure, AB 32.

Grisel Ruiz, the supervising attorney for the Immigrant Legal Resource Center, predicted the law would withstand any legal challenge by the Trump administration or private prison companies.

“This is a step in the right direction,” said Ruiz. “It’s bold and big and totally within California’s police powers to do this.”

Several constitutional legal scholars chimed in during hearings for the bill this past summer about whether the ban could be applied to private prisons housing federal prisoners and immigration detainees. The UC Berkeley law dean, Erwin Chemerinsky, wrote in an analysis of the bill that states had broad powers to protect citizens and non-citizens within their borders.

“I do not believe that this is pre-empted by federal law or violates any intergovernmental immunity doctrine,” wrote Chemerinsky. “Quite importantly, California is not regulating the federal government; it is regulating private companies, which is very much within the state’s constitutional authority.”

An Ice spokeswoman, Paige Hughes, said Department of Homeland Security attorneys still needed to review the law. But Hughes added: “The idea that a state law can bind the hands of a federal law enforcement agency managing a national network of detention facilities is wrong.”

Hughes said the law could result in Ice transferring detainees out of the state and far away from families and attorneys.

Ruiz said that Ice should release immigrant detainees rather than transferring them out of state. “If fed chooses to transfer people, then advocates will view that as a retaliatory act against California and we will fight tooth and nail to defend those people.”