On Tuesday, California agreed to stop housing imprisoned gang members in solitary confinement for an indefinite amount of time.

The decision was made after a settlement was reached in the class action lawsuit Ashker v. Governor of California, which was filed by the Center for Constitutional Rights (CCR) on behalf of nearly 3,000 California inmates held in isolation across the state.

In the 2009 federal lawsuit, two inmates at the Pelican Bay State Prison argued that harsh conditions in the security housing unit equated to cruel and unusual punishment.

A judge then ruled to free thousands of gang-affiliated inmates being held in isolated, soundproof and windowless cells. Instead, the state will only segregate inmates who commit new crimes behind bars.

"It will move California more into the mainstream of what other states are doing while still allowing us the ability to deal with people who are presenting problems within our system, but do so in a way where we rely less on the use of segregation," Corrections and Rehabilitation Secretary Jeffrey Beard told The Associated Press.

About 6,400 inmates in California were in segregated units as of Aug. 31. Now, the prisoners who have been held in isolation for a decade or more but have not committed a major violation in the last two years can be put in general population.

"If he hasn't done anything, does he have to be in a place where he languishes indefinitely?" California Department of Corrections and Rehabilitation spokeswoman Terry Thornton said, according to Fox 40. "The department has moved from a affiliation system to a behavior based system. It aligns California more with national best practices."

Prison reform advocates applauded the ruling as a victory for human rights.

"We have the Constitution and the Eighth Amendment that prohibits cruel and unusual punishment, even for people who have committed crimes" attorney Kinsey Reynolds said.

Under the settlement, both gang members and nonmembers will now be sent to segregated housing for up to five years only if they commit serious crimes behind bars, reports USA Today. Meanwhile, inmates who refuse to participate in rehabilitation programs or constantly violate prison rules will be sent into a new, less-harsh housing area called a Restricted Custody General Population Unit. Plus, segregated inmates will be allowed to make a limited amount of telephone calls and participate in some rehabilitation programs.