California is banning private prisons and immigrant detention centers. On Friday, Gov. Gavin Newsom signed a bill that would end the state’s use of the privately-run facilities.

Under the measure, the state’s Department of Corrections and Rehabilitation is prohibited from entering into or renewing a contract with a private, for-profit prison after January 1, 2020. Additionally, it will phase out the use of such private immigration detention centers by 2028.

“During my inaugural address, I vowed to end private prisons, because they contribute to over-incarceration, including those that incarcerate California inmates and those that detain immigrants and asylum seekers,” the Democratic governor said in a statement Friday. “These for-profit prisons do not reflect our values.”

The move follows increasing protests from immigrant rights and criminal justice activists alike about the inhumane conditions found at many private facilities. At California’s Adelanto ICE Processing Center, for instance, a Department of Homeland Security watchdog discovered unsanitary conditions in the bathrooms, delayed medical care for detainees and food service problems during a surprise visit to the center in 2018. That same year, a DHS report noted concerns about nooses found hanging in cells and overuse of solitary confinement at the same facility, which is operated by the GEO Group.

California currently has four contracts with for-profit, private prison companies with about 1,700 of its 115,000 prison population incarcerated in one of the facilities. Similarly, there are four civil detention centers in the state operated by private companies, which hold about 3,700 immigrants.

“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,” State Assemblyman Rob Bonta, a Democrat who sponsored the bill, said in a statement.

U.S. Immigration and Customs Enforcement, however, is questioning the legality of the bill. The agency currently has legal staff reviewing the legislation.

“The idea that a state law can bind the hands of a federal law enforcement agency managing a national network of detention facilities is simply false,” ICE said in a statement.

The agency argued that transferring detainees to facilities outside California would create more difficulties for “residents of California who would be forced to travel greater distances to visit friends and family in custody.”