California is banning the use of for-profit prisons, once embraced to ease overcrowding, but now scorned by prisoner and immigrant advocacy groups over substandard conditions and alleged abuses.

Gov. Gavin Newsom on Friday signed legislation effectively banning the outsourcing of inmates to private contractors. The law will prohibit the state Department of Corrections and Rehabilitation from entering into or renewing contracts with private-prison corporations beginning in 2020 and bars the state from keeping prisoners in private lockups starting in 2028.

"These for-profit prisons do not reflect our values," Newsom said in a statement.

The Democratic governor promised to end the use of private prisons upon taking office in January. The state's prison system was already phasing them out, despite having to comply with an inmate population cap imposed by federal judges.

THE COLD HARD FACTS ABOUT AMERICA'S PRIVATE PRISON SYSTEM

California houses around 1,600 inmates in three prisons run by Florida-based GEO Group, according to the corrections department. Its contract expires in 2023, at which time it will not be able to renew it under the new law.

California ended its last out-of-state private prison contract over the summer when it moved its final 33 inmates from Arizona to an in-state facility. At one point, Californa had contracts with five other out-of-state prisons, The Sacramento Bee reported.

"By ending the use of for-profit, private prisons and detention facilities, 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," Assemblyman Rob Bonta, an Oakland Democrat and the bill's lead author, said in a statement.

The measure also bans privately-run immigration detention centers, which house illegal immigrants awaiting deportation hearings. Advocates and Democratic lawmakers have railed against using the facilities to hold immigrants, citing poor conditions.

ELIZABETH WARREN CALLS TO BAN PRIVATELY RUN FEDERAL PRISONS

A Homeland Security watchdog report found that immigrants were being crowded into cells and many had trouble accessing medical care, showers, clothes and mental health care.

Immigration and Customs Enforcement (ICE) currently houses 4,000 illegal immigrants in four private detention facilities throughout the state. The largest facility, in Adelanto, has a temporary contract set to expire next year, along with another in Bakersfield.

"Within the next one to five years, private immigration detention will be abolished for good in California," said Christina Fialho, co-founder of Freedom for Immigrants.

An ICE spokesperson told Fox News the agency will most likely transfer detainees to "a greater distance from their arrest location."

"Thus, the only impact would be felt by the residents of California who would be forced to travel greater distances to visit friends and family in custody," the spokesperson said. "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."

Opponents of for-profit prison argue the model incentivizes mass incarceration. The industry has come under a microscope due to reports of poor living conditions and the alleged lack of inmate protections.

CLICK HERE TO GET THE FOX NEWS APP

“These Wall Street-owned for-profit, private facilities inhumanely treat people as commodities. These companies are incentivized to maximize profits and minimize costs — including the important 'costs' of investments in programs, services and rehabilitation efforts that reduce recidivism rates and increase success for Californians upon their reentry into society,” said Assemblyman Bonta.

California became dependent on private prisons after a federal court ruled in 2009 that the state had to reduce its prison population to 137.5 percent of intended capacity, The San Francisco Chronicle reported.

The state has nearly 130,000 prison inmates, with another 82,220 in local jails. As of 2017, it spent $13.5 billion on correction expenditures annually, according to The Sentencing Project.

With the ban, California joins New York, Illinois and Iowa in implementing restrictions on private prisons.

The Associated Press contributed to this report.