SACRAMENTO, Calif. (AP) — California will ban the use of for-profit, private detention facilities, including those under contract to the federal government to hold immigrants awaiting deportation hearings, under a bill that Gov. Gavin Newsom said Friday that he had signed.

The Democratic governor said the measure helps fulfill a promise he made to end private prison use, which he said contributes to over-incarceration and does “not reflect our values.”

The state’s prison system was already phasing them out, despite having to comply with an inmate population cap imposed by federal judges.

“Within the next one to five years, private immigration detention will be abolished for good in California.”

Immigrant advocates have praised the bill authored by Democratic Assemblyman Rob Bonta, which they said would put an end to almost all immigration detention in California in the next few years.

California has been at the forefront of resisting President Donald Trump’s efforts to deport those who are in the country illegally and has a so-called “sanctuary state” law that restricts police from asking people about their immigration status or participating in federal immigration enforcement actions.

The new measure prohibits the state corrections department from renewing contracts starting next year and from housing any state inmates in private, for-profit prisons starting in 2028.

“We are sending a powerful message that we vehemently oppose the practice of profiteering off the backs of Californians in custody,” Bonta said.

California previously halted growth in local government contracts to house immigration detainees. After that, populous Orange County south of Los Angeles and other local governments ended their contracts to hold detainees for U.S. Immigration and Customs Enforcement.

Four dedicated immigration detention facilities remain in California with an average daily population of about 3,700 detainees. ICE has previously said the largest one, run by The Geo Group in Adelanto, California, has a temporary contract set to expire in 2020, as does another facility in Bakersfield, California.

ICE’s acting press secretary, Bryan Cox, said immigration enforcement would still take place, noting that California accounts for less than 10 percent of the agency’s detention capacity. He said the impact “would be felt primarily by residents of California who would theoretically have to travel greater distances to visit friends and family in custody.”

Christina Fialho, co-founder of Freedom for Immigrants, said she doesn’t believe ICE could legally extend the contracts ending in 2020. The remaining two private detention contracts are set to expire within five years and cannot be renewed after the bill takes effect, she said.

“Within the next one to five years, private immigration detention will be abolished for good in California,” she said, adding that rural Yuba County in northern California still has a contract to detain immigrants but may also soon end it. “This is huge.”

Yolo County supervisors this week ended its decade-old contract with the federal government to house troubled immigrant children in a facility west of Sacramento that is one of two in the nation for teens who entered the country unaccompanied by parents and are considered dangerous to themselves or others.

The move in California comes as ICE has expanded immigration detention across the U.S. amid the Trump administration’s immigration crackdown.

California isn’t the only state pushing back, Fialho said, adding that Illinois also passed similar legislation and that New Mexico and Minnesota are weighing proposals.

The bill “will deal a critical blow to the Trump administration’s efforts to further expand its system of immigration detention, especially as other states follow our lead,” she said.

California’s corrections department last month ended one of its four contracts with The GEO Group to run three male prisons and one for women that that together house about 1,600 inmates. The remaining contracts expire in 2023.

The federal receiver who controls medical care in California state prisons recently found inadequate health care at all four privately run prisons, citing problems with their policies and procedures, training, health care grievance process, emergency medical response and physician case reviews. The deficiencies are being reviewed again, with results expected in December.

In 2006, then-Gov. Arnold Schwarzenegger started sending California inmates to private out-of-state prisons to relieve crowding in prisons where nearly 20,000 inmates were bunked three-deep in gymnasiums and dayrooms. The state then relied on the private prisons for years to help meet the federal population cap.

But the last inmate housed out-of-state returned to California in June as the state ended those contracts. The new law allows the department to renew or extend the existing private prison contracts to comply with the court-ordered population cap until 2028.

The state’s inmate population has been declining under several measures easing criminal sentences approved by voters and state lawmakers in recent years. Inmates housed in private prisons now make up less than 1% of the prisons’ overall 125,000 inmate population.

A 2018 law already directed the corrections department to close male private in-state facilities as the state’s prison population declined.

Taxin reported from Tustin, California.