In re Morales

Opinion

POLLAK, J.

The warden of Pelican Bay State Prison (Pelican Bay) appeals from an order granting a writ of habeas corpus, reiterating an order entered some 10 years ago and affirmed by another division of this court in an unpublished decision. (Escalera v. Terhune (Feb. 10, 2004, A101614) [nonpub. opn.] (Escalera).) Both Escalera and the order now before us prohibit preferential treatment of inmates on the basis of ethnicity. The warden defends the prison’s race-based practices as responding “to longstanding and constant hostilities between rival Hispanic prison-gangs and their disruptive-group affiliates, whose repeated efforts to attack each other at every opportunity threatened the safety and security of all the inmates housed there and the staff responsible for them.” He characterizes the challenged order as “prohibiting Pelican Bay . . . from responding to ongoing violence between rival Hispanic prison gangs and their disruptive-group affiliates.” We do not question the magnitude of the problems confronted by prison authorities in dealing with racially motivated violence of prison gangs. But the warden mischaracterizes the terms and effect of the challenged order and provides no justification for disregarding the prior court order and for practices that are not narrowly tailored to further prison security.

Pelican Bay racially segregates prisoners and, during extended periods of perceived threatened violence, denies family visits, work assignments, yard exercise, religious services and other privileges to prisoners of one race while granting those same privileges to prisoners of other races. This habeas corpus proceeding was brought by a Hispanic prisoner alleging that the prison’s policy of disparate treatment based on race and ethnicity denies him equal protection of the laws. (U.S. Const., 14th Amend.) The United States Supreme Court, in a prior challenge to California prison segregation, held that government officials are not permitted “to use race as a proxy for gang membership and violence without demonstrating a compelling government interest and proving that their means are narrowly tailored” to advance that interest. (Johnson v. California (2005) 543 U.S. 499, 511 [160 L.Ed.2d 949, *1413125 S.Ct. 1141] (Johnson).) The trial court here applied Johnson and found that “there are more narrowly tailored means of controlling violence than to restrict entire ethnic groups.” The court ordered the prison “to refrain from affording preferential treatment to inmates on the basis of ethnicity” but the order permits prison officials to “separate inmates on the basis of ethnicity, if prison security requires it, so long as it is not done preferentially” and is done “[o]n a short-term emergency basis.”1 We shall affirm the order.

STATEMENT OF FACTS

The basic security classification and assignment system within California prisons

California’s Department of Corrections and Rehabilitation (CDCR) operates 33 prisons with approximately 170,000 inmates. (CDCR Annual Report 2010 <http://www.cdcr.ca.gov/News/docs/CDCR_Year_At_A_Glance2010.pdf> [as of Jan. 23, 2013].) Under the applicable regulations, “All persons entering the [CDCR] penal system are given a classification score which determines an inmate’s security level. Based on this score, an inmate will be given a designation ranging from Level I—reserved for the lowest security risk prisoner—to Level IV—reserved for the highest security risk prisoner. The score is arrived at by tabulating points that are based on an array of objective factors which include, among other things, length of sentence, nature of the crime committed, criminal history, employment history, military service, marital status, age, prior escape attempts, and prior incarceration behavior.” (Madrid v. Gomez (N.D.Cal. 1995) 889 F.Supp. 1146, 1239; see Cal. Code Regs., tit. 15, §§ 3375, 3375.3.) Gang activity is also considered in determining an inmate’s security level classification. (Cal. Code Regs., tit. 15, § 3375.3, subd. (a)(4).) An inmate is assigned to a prison commensurate with the inmate’s security level classification, as each of California’s prisons has a designated security level based on its physical construction, type of housing (dormitories or cells), and the extent of armed coverage. (Cal. Code Regs., tit. 15, § 3377.)

Once assigned to a prison, prison officials use classification committees to determine an inmate’s program and cell assignments at the institution. (Cal. Code Regs., tit. 15, § 3376.) In 2008, the CDCR began implementing regulations requiring racial integration at its institutions with the avowed intention that “[a]n inmate’s race will not be used as a primary determining factor in housing an institution’s inmate population.” (Cal. Code Regs., tit. 15, § 3269.1.) The regulations were adopted upon settlement of the case that *1414challenged California’s policy of racially segregating prisoners in reception centers before they entered a new correctional facility. (Johnson, supra, 543 U.S. at p. 502.) The United States Supreme Court held that the practice must be subjected to strict scrutiny and remanded the case for the CDCR to demonstrate a compelling governmental interest supporting the race-based practice and that the practice is narrowly tailored to address that interest. (Id. at p. 514.) The case settled on remand with CDCR’s adoption of the integrated housing policy. However, the integrated housing policy has not been implemented at level IV maximum security prisons like Pelican Bay, and a prison official testified that he “sincerely doubt[ed]” that it would ever be implemented at these prisons.

Gangs in prison

Prison gangs2 arose in California around 1956, when Hispanic inmates from Southern California banded together to form the Mexican Mafia. (CDCR, Operations Manual (2009) Historical Perspective, § 52070.4, p. 366 (Manual).) “Other prison gangs were subsequently formed along racial lines: The Black Family in 1966, changing its name to Black Guerrilla Family in 1971; the Nuestra Familia (Northern California Hispanics) in 1966-67; and, the Aryan Brotherhood (white) in 1968.” (Ibid.) Today, there are seven designated “prison gangs”—i.e., gangs originating in prison—all formed along racial lines. (Manual, § 52070.17.2.) There are also hundreds of “disruptive groups,” which are criminal street gangs that did not originate in prison but operate there. (See Cal. Code Regs., tit. 15, § 3000.)

The CDCR has determined that “prison gangs and disruptive groups, through their illegal activities, are a threat to the security of all institutions.” (Manual, § 52070.5.) The record contains substantial evidence supporting this determination, especially as it applies to Pelican Bay. CDCR has adopted a strategy to manage and suppress gangs. (Manual, § 52070.6.) The declared strategy is “to identify gang affiliated inmates/parolees, track them, monitor their conduct, take interdiction action, and apply sanctions when they are found to be involved in illicit or unlawful gang activity.” (Manual, § 52070.6.)

State regulations establish a “validation” process for identifying an inmate as a member or associate of a gang. (Cal. Code Regs., tit. 15, § 3378; In re *1415Cabrera (2012) 55 Cal.4th 683 [148 Cal.Rptr.3d 500, 287 P.3d 72]; see In re Furnace (2010) 185 Cal.App.4th 649, 656-666 [110 Cal.Rptr.3d 820] [applying regulations].) The regulations require three independent “source items” to prove gang membership or association, and provide the inmate with an opportunity to rebut the evidence. (Cal. Code Regs., tit. 15, § 3378, subd. (c)(2), (6)(A).) Source items include gang offenses, self-admission, association with validated gang affiliates, and other evidence connecting the inmate with a gang. (Cal. Code Regs., tit. 15, § 3378, subd. (c)(8).) An inmate validated as a prison gang member “is deemed to be a severe threat to the safety of others or the security of the institution” and is committed for an indeterminate term to the security housing unit, commonly referred to as the “SHU.” (Cal. Code Regs., tit. 15, § 3341.5, subd. (c)(2)(A)(2).)

Pelican Bay

Pelican Bay has over 3,000 inmates, most of whom are housed in two primary units: a maximum security prison and the SHU. (CDCR, Pelican Bay State Prison, Institution Statistics <http://www.cdcr.ca.gov/Facilities_Locator/ PBSP-Institution_Stats.html> [as of Jan. 23, 2013].) The maximum security prison houses about 1,700 inmates in a “general population setting.” (CDCR, Pelican Bay State Prison, Mission Statement <http://www.cdcr.ca.gov/ Facilities_Locator/PBSP.html> [as of Jan. 23, 2013]; see Madrid v. Gomez, supra, 889 F.Supp. at p. 1155 [describing Pelican Bay operations].) The general population unit is subdivided into facility A and facility B, with facility B having the more “difficult to manage inmates.” Facility B has roughly 600 inmates, one of whom was petitioner Jose Morales. “The daily routine for these inmates is comparable to that in other maximum security prisons in California.” (Madrid, supra, at p. 1155.) General population inmates are assigned to double cells and are eligible for work and educational programs.

The second unit is the SHU. “Located in a completely separate complex inside the security perimeter, the SHU has gained a well-deserved reputation as a place which, by design, imposes conditions far harsher than those anywhere else in the California prison system.” (Madrid v. Gomez, supra, 889 F.Supp. at p. 1155.) The roughly 1,200 inmates confined in the SHU “remain isolated in windowless cells for 22 and 1/2 hours each day, and are denied access to prison work programs and group exercise yards. . . . SHU cells are reserved for those inmates in the California prison system who become affiliated with a prison gang or commit serious disciplinary infractions once in prison.” (Ibid.) At the time relevant here, the “vast majority” of the SHU inmates were prison gang members.

Despite the sequestration of prison gang members in the SHU, gang violence within the prison’s general population persists. The power and *1416influence of prison gangs extend to the streets and prison gangs often form symbiotic relationships with street gangs. The incarceration of a street gang member in Pelican Bay’s general population provides a conduit from the prison gang member housed in the SHU to the street gang member living in the general population. Prison gang members in the SHU contact street gang members in the prison’s general population through inmate notes, messages relayed through visitors, and mail routed through third parties. In this manner, prison gang members can direct criminal acts through affiliated street gang members in the general population.

Pelican Bay officials believe that most of the prison’s general population inmates are affiliated with prison gangs but the inmates are not put through the regulatory validation process to prove gang membership or association. The regulatory validation process was established for both prison and street gangs (Cal. Code Regs., tit. 15, § 3378) but Pelican Bay uses the validation process only for prison gang members targeted for SHU sequestration. In prior litigation, inmates classified as prison gang members and committed to a SHU term challenged the commitments as a deprivation of due process. (See Garcia v. Stewart (N.D.Cal., Mar. 16, 2009, No. C 06-6735 MMC (PR)) 2009 U.S.Dist. Lexis 20886, p. *8.) The regulatory gang validation process was adopted in settlement of that litigation. (Ibid.) A Pelican Bay official testified that the validation process is used exclusively for prison gang members because they are entitled to the process before being committed to the SHU. The regulatory validation process is not used for suspected street gang, or disruptive group members because, according to prison officials, the validation process “is a very lengthy investigative process” and there are not enough hours “in the day to conduct investigations to validate members of disruptive groups.”

To minimize and control gang violence among the general population of inmates, Pelican Bay utilizes a race-based classification system distinct from the security level classification applied to all California prisoners described above. As the trial court found, based on substantial evidence, Pelican Bay has an unwritten policy of using race as the primary factor determining housing assignments, activity levels, and restrictions among the general population of inmates.3 A Pelican Bay classification committee assigns every general population inmate to one of five racial or ethnic groups: White, Black, Northern Hispanic, Southern Hispanic, or “Other.” Prison officials testified that, in placing an inmate in one of the five groups, the prison considers the inmate’s race, the race of the cellmate he requests, the race of *1417the victims of any prior violent acts perpetrated by the inmate, and “intel” from watching the exercise yard to see the race of those with whom the inmate socializes.4

A host of prison housing and management decisions are based on an inmate’s group designation, including cell assignment and access to programs. Pelican Bay’s general population is housed two inmates to a cell; all cellmates share the same group designation and are thus segregated by race. Color-coded signs are placed above the cells; white for White, yellow for Other (mostly Asians), blue for Black, red for Southern Hispanic, and green for Northern Hispanic. Group designation also determines an inmate’s access to programs and activities during periods of unrest when the prison implements partial lockdowns, some of which last for years.

Pelican Bay recognizes three levels of operation: regular program, modified program, and lockdown. A regular program allows full movement and activities, a modified program (also called a partial lockdown) restricts some inmate movement and activities, and a full lockdown confines all inmates to their cells. A Pelican Bay facility captain explained the distinction between a modified program and a lockdown: “a lockdown typically involves the restriction of all inmates to their cells or dormitory beds and suspension of all programs and all but essential functions. Lockdowns can be imposed on the entire prison or on a specific facility within a prison. . . . [f] A modified program is less restrictive than a lockdown and typically involves suspension of various programs or services for a specific group of inmates and[/]or in a specific portion of a facility.”

The specifics of a modified program may change over time depending on evolving threat levels. Following an incident in August 2008 in which two inmates classified as Northern Hispanics attacked a Southern Hispanic inmate, a modified program was imposed on facility B that remained in effect until July 2011, when terminated by the court’s order in this litigation. The precise terms of the modified program varied over time, as reflected in *1418weekly program status reports.5 The plan of operation for the week of September 27, 2010, for example, indicates that all Hispanic inmates were denied visits, work assignments, phone calls, and canteen. The written plan of action for that week further specifies that religious services were limited to “in cell religious study upon request for Black, White and Hispanics.”6 In other weeks, Southern Hispanics were denied more privileges than were Northern Hispanics. For the week beginning March 14, 2011, inmates classified as Black, White, and Others were allowed daily yard recreation, Northern Hispanics were allowed four days of yard access, and Southern Hispanics were denied all access. Southern Hispanics were “escorted in restraints” outside their cells and were denied all visitation, even with family members.

Prior litigation over lockdowns of racial and ethnic groups

As indicated at the outset, this is not the first litigation challenging Pelican Bay’s use of racial and ethnic classifications to impose restrictions on inmate activity. Following a February 2000 attack by a large group of Southern Hispanic inmates on Black inmates, Pelican Bay imposed a full lockdown of the entire general population for a month and then eased restrictions on all but Southern Hispanics. Whites and Blacks, for example, were allowed yard exercise and program participation on alternate days, segregated by race. Southern Hispanics were kept on lockdown and denied exercise, visitation, work assignments, and school programs permitted other ethnic groups. The lockdown of Southern Hispanics continued for nearly four years, during which time inmates who had not been at the prison when the fight occurred arrived at the institution and were subjected to the lockdown based on their ethnicity.

The lockdown ended when the practice was held unconstitutional in Escalera. In that case, a Hispanic inmate filed a habeas corpus petition *1419alleging that Pelican Bay’s policy of disparate treatment based on race and ethnicity denied him equal protection of the laws. (U.S. Const., 14th Amend.) The petition was consolidated with similar petitions filed by other Hispanic inmates. Following an evidentiary hearing, the trial court found that the prison had “a policy of segregating inmates based upon ethnicity,” that the prison “policies governing race relations resulted in a ‘culture of separation,’ which contributed to inter-racial violence, creating a situation where it became necessary to impose segregation to stop the violence,” and that the lockdown of Southern Hispanics “was constitutionally impermissible, because it was preferential on the basis of ethnicity.”

The trial court ordered Pelican Bay to “refrain from affording preferential treatment to inmates on the basis of ethnicity.” The court noted that the prison may, “[o]n a short-term emergency basis . . . separate inmates on the basis of ethnicity, if prison security requires it, so long as it is not done preferentially.” The court also noted that the prison had begun implementing a policy of classifying inmates by “individual behavior, rather than ethnic grouping” and ordered the prison to “allocate sufficient resources to promptly complete the evaluation of inmates who remain on lockdown . . . [and] to determine, on an individual basis, and without ethnic preference, which inmates may safely be released from lockdown . . . .” The trial court ordered Pelican Bay to submit plans for compliance and reserved jurisdiction to make further orders to implement its decision. The orders were affirmed on appeal in February 2004. (Escalera, supra, A101614.)

In June and October 2004, Pelican Bay submitted reports on its compliance with the Escalera court orders. Pelican Bay reported that it had returned to a regular program in September 2003 and that the few short lockdowns occurring since that time were imposed on all inmates equally “with an unlock process based on individual case factors without consideration given to an individual’s ethnic background.” The prison used an individual threat assessment score based on individual factors and behavior that looked at age, education level, prior gang involvement, recent violence while incarcerated, and other factors. Pelican Bay said future lockdowns would be managed on the same basis and assured the court that “[a]ll associate wardens and facility captains will be provided with training on the Escalera decision and Pelican Bay’s unlock procedure on an annual basis.”

Pelican Bay continues to classify inmates by race and ethnicity

The policy of individual assessments implemented following Escalera was short lived. Following a change in wardens, without seeking court approval, Pelican Bay reverted to group classifications based on race and ethnicity as described above. It is not clear exactly when the prison returned to group *1420classifications, but an associate warden testified that individual assessments of inmates officially ended in 2009 at the command of a CDCR associate director. A Pelican Bay facility captain testified that individual risk assessment of inmates was labor intensive and difficult to implement because there were no regulations supporting the methodology. He also stated that to ignore race in classifying inmates is to ignore “the big elephant in the room” because inmates align themselves by race.

Following the August 2008 incident between Hispanic inmates, the prison removed the perpetrators of the assault to the administrative segregation unit and implemented a “modified program” as described above, restricting all other Hispanic inmates’ access to programs, which remained in effect for almost three years. An associate warden testified that Pelican Bay made attempts at reintegrating Northern Hispanic and Southern Hispanic inmates over the years but the attempts failed. A facility captain said that the Mexican Mafia and Nuestra Familia prison gangs are at war statewide and that Southern Hispanic street gang members (associated with the Mexican Mafia and often referred to as Sureños) and Northern Hispanic street gang members (associated with Nuestra Familia and referred to as Norteños) would attack each other on sight. Prison officials testified they had no control over the war between the Hispanic prison gangs and that the prison gangs alone controlled when Hispanic inmates could be safely reintegrated. Pelican Bay’s facility captain testified that security concerns over the three years preceding the 2011 trial made inmates classified as Other the only prison “work force.” These inmates, mostly Asians, had to work “double shifts” cooking, doing laundry, and handling the garbage because all other inmates were on partial lockdown. While Asian inmates did the work, inmates of other races were denied visitation, exercise, religious services, and other privileges.

Morales’s habeas corpus petition

Morales is a Pelican Bay inmate serving an indeterminate life sentence for first degree murder. He is Hispanic and lived in Southern California before his incarceration. In 2008, Pelican Bay authorities held a classification committee hearing to assign him to one of the prison’s five-group classifications. A document from the hearing shows that Morales told the prison authorities that he “could live with anyone.” Prison authorities assigned him to the Southern Hispanic group. Morales testified that he was never given a choice to decline an ethnic classification, to choose another classification, or to challenge the classification assigned to him.

In late 2008, Morales was placed in the prison’s general population. His arrival occurred several months after the fight between Hispanic inmates that led to implementation of the modified program restricting the movement and *1421activities of Hispanics. Morales’s movement and access to programs was restricted under the modified program. He asked Pelican Bay officials why he was denied privileges like yard recreation, visits, phone calls, and other activities and was told that it was because he is a Southern Hispanic and “Southern Hispanics were on lockdown.”

In January 2009, Morales filed an administrative appeal contending that he was being denied recreational yard access on the basis of his ethnicity, which was an unconstitutional deprivation of equal protection of the laws. Morales did not receive relief from the modified program and, in January 2010, filed a motion in the Escalera case to enjoin race-based lockdowns. The motion was returned by the court clerk because Morales was not a party to the case. Later that month, Morales filed the instant petition.

Morales’s petition for a writ of habeas corpus alleges that “prison officials are violating the Equal Protection Clause by segregating Southern Hispanic inmates and imposing atypical and significant confinement on Southern Hispanic inmates, such as no: outdoor recreational exercise; ability to receive property packages; access to trust account to purchase [hygiene] and food items from canteen; [and] visits.”

The trial court held a five-day evidentiary hearing in April 2011, at which it heard testimony from Morales and five high-level Pelican Bay officials.7 The court also took judicial notice of its findings in the Escalera case and the testimony of Pelican Bay’s warden during the time of Escalera who said “a behavior-based, rather than a race-based approach is a suitable and effective method of managing inmate violence.” Following the hearing and posttrial briefing, in July 2011, the court issued a nine-page decision.

The court made the following findings: “1. As they exist in [the general population] B Facility at [Pelican Bay State Prison (PBSP)], Blacks, Whites, Northern and Southern Hispanics, and Others are ethnic groups, not disruptive groups (gangs), although among those ethnic groups many, and perhaps most, inmates are engaged in, or associated with, gang-related activities. [][] 2. Staff at PBSP are not presently in compliance with this court’s order in the Escalera case, because ethnic groups are being managed in a preferential manner, [f] 3. Inmates are being classified as members or associates of disruptive groups without compliance with the validation requirements of [California Code of Regulations, title 15, section] 3378, and primarily on the basis of their ethnic identification. On this basis, they are subject to substantial deprivations of privileges compared to other inmates. [][] 4. Although *1422there is a compelling governmental interest in prison safety, the CDCR has used race as a proxy for gang membership and violence, and the means employed by CDCR to serve that compelling interest in this case are not narrowly tailored. [][] 5. The issues presented by this case are likely to recur, but because the inmate population is transient over time, inmates who are not parties to this case should be able to seek enforcement of the orders herein, in the interest of judicial economy, unless a published appellate opinion results, which would make it possible for the rulings herein to be cited.”

Based on these findings, the court issued the following orders: “1. The court reiterates its orders in the case of Escalera v. Terhune . . . Specifically, CDCR staff at PBSP is ordered to refrain from affording preferential treatment to inmates on the basis of ethnicity. In their discretion, the [habeas corpus petition] respondents may lock down the prison, and may release inmates from lockdown based upon individual behavior, and upon informed predictions of individual behavior; but not on the basis of ethnicity. On a short-term emergency basis, respondents may separate inmates on the basis of ethnicity, if prison security requires it, so long as it is not done preferentially. [][] 2. CDCR staff at Pelican Bay State Prison is ordered, within 60 days, to cease and desist from managing inmates as members or associates of disruptive groups, unless those inmates have been individually validated as members or associates pursuant to [California Code of Regulations, title 15, section] 3378. [f] 3. Inmates who are not parties to this case, or to the case of Escalera v. Terhune may seek enforcement of the orders made herein by filing a pleading in this case.”

The court noted that “there are more narrowly tailored means of controlling violence than to restrict entire ethnic groups.” It observed that the former warden had success with using “a system of evaluating inmates based upon an individual threat assessment score” and that the CDCR has gang regulations that can be used to separate “inmates who are prone to racially-based gang violence.” The court concluded: “Instead of these and perhaps other approaches that might be found in the prison systems of most other states and the Federal prisons, CDCR has chosen to paint with a broad brush, and their methods are not the narrowly tailored means contemplated” by controlling law.

Pelican Bay’s warden filed a timely notice of appeal. Both the superior court and this court denied the warden’s request to stay the superior court’s order pending appeal. A prison official later reported to the trial court that *1423there was no violence requiring a lockdown or partial lockdown from the time the modified program ended in July 2011 to April 2012, the date of the report.8

In challenging the trial court’s order, the warden argues that Pelican Bay’s classification of inmates as White, Black, Northern Hispanic, Southern Hispanic, and Other is not based on race but on gang “affiliation,” which the warden believes to be outside the scope of state regulations governing the classification of gang members and associates. The warden contends that even if these group classifications are race based, the classification and prison management practices employing them are justified as necessary security measures.

DISCUSSION

I. Strict scrutiny is the proper standard to review the prison’s race-based policies

“Prison walls do not form a barrier separating prison inmates from the protections of the Constitution.” (Turner v. Safley (1987) 482 U.S. 78, 84 [96 L.Ed.2d 64, 107 S.Ct. 2254] (Turner).) “[P]risoners retain the constitutional right to petition the government for the redress of grievances [citation]; they are protected against invidious racial discrimination by the Equal Protection Clause of the Fourteenth Amendment [citation]; and they enjoy the protections of due process.” (Ibid.)

In analyzing prisoners’ constitutional claims, the courts recognize that “ ‘the problems of prisons in America are complex and intractable’ ” and that “[r]unning a prison is an inordinately difficult undertaking that requires expertise, planning, and the commitment of resources, all of which are peculiarly within the province of the legislative and executive branches of government.” (Turner, supra, 482 U.S. at pp. 84-85.) Thus, ordinarily “when a prison regulation impinges on inmates’ constitutional rights, the regulation is valid if it is reasonably related to legitimate penological interests.” (Id. at p. 89.) This deferential standard of judicial review has been applied to “First Amendment challenges to prison regulations, including restrictions on freedom of association [citation]; limits on inmate correspondence [citation]; restrictions on inmates’ access to courts [citation]; restrictions on receipt of subscription publications [citation]; and work rules limiting prisoners’ attendance at religious services . . . .” (Johnson, supra, 543 U.S. at p. 510.) The deferential “reasonably related” rule has also been applied to “some due *1424process claims, such as involuntary medication of mentally ill prisoners [citation]; and restrictions on the right to marry . . . .” (Ibid.)

A more stringent rule applies, however, to race-based prison regulations. (Johnson, supra, 543 U.S. at p. 510.) All racial classifications imposed by the government, including those imposed by prison officials, receive strict scrutiny. (Id. at p. 505.) A prison regulation or policy that makes “an express racial classification ... is ‘immediately suspect.’ ” (Id. at p. 509.) The government therefore bears the burden, under the strict scrutiny standard of review, “of proving that racial classifications ‘are narrowly tailored measures that further compelling governmental interests.’ ” (Id. at p. 505.)

In Johnson, supra, 543 U.S. at page 502, the United States Supreme Court considered California’s “policy of racially segregating prisoners in double cells in reception centers for up to 60 days each time they enter a new correctional facility.” The CDCR assigned cellmates “based on a number of factors, predominately race.” (Ibid.) At the time, the CDCR “admitted that the chances of an inmate being assigned a cellmate of another race are ‘ “[p]retty close” ’ to zero percent.” (Ibid.) The CDCR further subdivided prisoners within each racial group, segregating northern California Hispanics from southern California Hispanics. (Ibid.) “The [CDCR’s] asserted rationale for this practice [was] that it [was] necessary to prevent violence caused by racial gangs.” (Ibid.) The court held that strict scrutiny must be applied in reviewing such a race-based practice. (Id. at pp. 504-515.) In a previous case, the high court had applied a heightened standard of review to strike down Alabama’s policy of racial segregation in its prisons over claims that desegregation would undermine prison security. (Id. at pp. 506-507, citing Lee v. Washington (1968) 390 U.S. 333, 333-334 [19 L.Ed.2d 1212, 88 S.Ct. 994].) Referring to that case, the Johnson court concluded: “The need for strict scrutiny is no less important here, where prison officials cite racial violence as the reason for their policy. As we have recognized in the past, racial classifications ‘threaten to stigmatize individuals by reason of their membership in a racial group and to incite racial hostility.’’ [Citation.] Indeed, by insisting that inmates be housed only with other inmates of the same race, it is possible that prison officials will breed further hostility among prisoners and reinforce racial and ethnic divisions. By perpetuating the notion that race matters most, racial segregation of inmates ‘may exacerbate the very patterns of [violence that it is] said to counteract.’ ” (Johnson, supra, at p. 507.) The court also noted that “public respect for our system of justice is undermined when the system discriminates based on race.” (Id. at p. 511.) “When government officials are permitted to use race as a proxy for gang membership and violence without demonstrating a compelling government interest and proving that their means *1425are narrowly tailored, society as a whole suffers.” (Ibid.) The court affirmed that prison officials may “address legitimate problems of race-based violence” but, in doing so, “will have to demonstrate that any race-based policies are narrowly tailored” to address prison safety. (Id. at p. 514.)

The warden contends that Pelican Bay’s modified program, or partial lockdown, restricting an inmate’s movement and activities based upon the inmate’s classification as White, Black, Northern Hispanic, Southern Hispanic, or Other is not a race-based program. He maintains that the designations refer to gangs, not races or ethnicities, and that the constitutionality of the program must therefore be determined by asking if it is reasonably related to legitimate penological interests (Turner, supra, 482 U.S. at p. 89) rather than by asking if it is narrowly tailored to address prison safety (Johnson, supra, 543 U.S. at p. 514). The trial court properly rejected this contention, making the express finding that Pelican Bay’s group classifications “are ethnic groups, not disruptive groups (gangs).”9 “In an appeal from an order granting a petition for habeas corpus after an evidentiary hearing, basic principles of appellate review apply,” including the principle that “findings of fact will be accorded due deference under the substantial evidence standard.” (In re Douglas (2011) 200 Cal.App.4th 236, 242 [132 Cal.Rptr.3d 582].)

Substantial evidence unquestionably supports the trial court’s finding. The court correctly observed that classifications like White, Black, and Hispanic “are racial or ethnic by their nature,” that “each group is composed almost entirely of the ethnic group designated by the name,” and that every inmate is assigned to one of the groups with “no choice but to be placed into one of the groups.” The testimony confirms the racial nature of the classifications. Prison officials admitted that the group classifications are not based on gang membership or association. As the warden concedes on appeal, state regulations mandate a formal process for designating an inmate as a gang member or associate, and the testimony establishes that very few prison inmates are so designated. The warden argues that the group classifications are based on gang “affiliation,” which is a level of gang activity lower than membership or association that he contends is outside the scope of the formal gang regulations. But, as prison officials acknowledge, not every inmate is affiliated with a gang. Yet, every inmate is placed into the prison’s racially termed classification system because, according to an associate warden, every inmate aligns *1426by race. A facility captain admitted that Pelican Bay’s five-group-classification system uses “the language of ethnic groups” and that the prison manages inmates on the basis of ethnicity, at least “[t]o a certain extent.” A prison gang investigator testified that race is a key consideration in classifying inmates because an inmate cannot simply disclaim identification with a group—other inmates will react to the perceived race of the inmate. He said that a racially White inmate may deny affiliation with gangs or other inmates but “[o]dds are because of the way [he] appear[s] the first time [he] come[s] out to the yard the first Black inmate that sees [him] will attack [him].” According to a facility captain, “it’s just a cold hard fact that race is a factor in identifying an inmate.” Whatever the reasons for the practice, it is plainly a race-based practice and thus its constitutionality must be evaluated under the strict scrutiny standard of review.

The appropriateness of this heightened standard of review is confirmed by other cases presenting similar factual circumstances. In Johnson itself, in reviewing California’s practice of segregating newly arrived inmates by race because racial segregation assertedly was “necessary to prevent violence caused by racial gangs” (Johnson, supra, 543 U.S. at p. 502), the high court characterized the practice as using “race as a proxy for gang membership” and held that the race-based practice required strict scrutiny. (Id. at p. 511.) Following Johnson, federal cases that have reviewed the racial segregation of prisoners, during lockdowns have found the lockdowns to be race-based practices subject to strict scrutiny. (E.g., Richardson v. Runnels (9th Cir. 2010) 594 F.3d 666, 670-671.) In Richardson, an African-American inmate at California’s High Desert State Prison brought a civil rights action against prison officials who locked down all African-American inmates after several African-American inmates assaulted staff and inmates. (Ibid.) The Ninth Circuit held that strict scrutiny applied, and reversed a defense summary judgment because the prison officials “made no evidentiary showing at all concerning the basis for regarding all African-Americans as a security risk when one or a few African-American inmates are responsible for an assault.” (Id. at pp. 671-672.) As in Richardson, the lockdown here restricted inmate movement and activities based on an inmate’s classification as Black, White, Northern Hispanic, Southern Hispanic, or Other is a racial classification subject to strict scrutiny.

H. Pelican Bay’s race-based partial lockdown is not narrowly tailored to further a compelling state interest

“Prisoners are protected under the Equal Protection Clause of the Fourteenth Amendment from invidious discrimination based on race.” (Wolff v. McDonnell (1974) 418 U.S. 539, 556 [41 L.Ed.2d 935, 94 S.Ct. 2963].) *1427Invidious discrimination like racial segregation, which is unconstitutional outside prisons, is also unconstitutional within prisons. (Johnson, supra, 543 U.S. at pp. 505-506.) Moreover, segregation and disparate treatment of racial and ethnic groups risks reinforcing racial and ethnic divisions. (Id. at p. 507 [prison racial classifications “will breed further hostility among prisoners and reinforce racial and ethnic divisions”].) Any prison classification based on race is “ ‘immediately suspect’ ” and, as indicated above, subject to the same strict scrutiny as a racial classification outside prison. (Id. at pp. 508-510.) This is not to say that every racial classification is unconstitutional. “Prisons are dangerous places, and the special circumstances they present may justify racial classifications in some contexts.” (Id. at p. 515.) “[P]rison authorities have the right, acting in good faith and in particularized circumstances, to take into account racial tensions in maintaining security, discipline, and good order in prisons and jails.” (Lee v. Washington, supra, 390 U.S. at p. 334 (cone. opn. of Black, J.).) But “[t]he ‘necessities of prison security and discipline . . .’ [citation] are a compelling government interest justifying only those uses of race that are narrowly tailored to address those necessities.” (Johnson, supra, at p. 512.)

The trial court properly found that the practices employed at Pelican Bay are not narrowly tailored to further prison security. The modified program places restrictions on all members of a racial group for extended and indefinite periods of time without any attempt to determine which individuals of the particular race have any affiliation with a racial gang, without any attempt to determine which inmates had any responsibility for the incident that triggered the modified program, and without any attempt to determine which inmates are likely to engage in future misconduct. Moreover, many of the restrictions, such as the denial of all visitation, appear primarily punitive in nature, rather than designed to maintain security, especially when imposed on a large group of inmates for an extended period of time.

The warden argues that Pelican Bay’s modified program is necessary to address chronic violence between rival Hispanic prison gangs and their associated disruptive groups whose members’ repeated attacks prevent reintegration. The compelling interest in preventing gang violence is unquestioned but the means of addressing that interest nonetheless must be narrowly focused on responding to the particular threat and avoiding restrictions that are unnecessary to reduce the risk of violence. Other than stressing the degree of animosity between racial gangs and the constant potential for violence, the warden does not advance any rational basis for concluding that in order to avoid violence between Hispanic gangs it is necessary to deny all Hispanic prisoners, or all members of any race or ethnicity, the right to participate in *1428all programs, the right to use the canteen, the right to have visitors, or the right to any privileges—for years at a time. Certainly the trial court was justified in finding that such sweeping restrictions allocating privileges and penalties based on race are far more than is reasonably necessary to prevent gang violence. As the court stated, “there are more narrowly tailored means of controlling violence than to restrict entire ethnic groups.”10

In discussing race-based prison practices that may pass constitutional muster, the Johnson court offered the example of a temporary segregation of inmates following a race riot. (Johnson, supra, 543 U.S. at pp. 512-513.) Race-based lockdowns and partial lockdowns have been upheld in other cases only when narrowly tailored in this manner. In Larry v. Tilton (S.D.Cal., Mar. 3, 2011, No. 09-CV 0950-JLS (WVG)) 2011 U.S.Dist. Lexis 115034, pages *27-*37, a federal magistrate judge recommended that California prison officials be granted summary judgment in an inmate’s civil rights suit challenging a modified program that restricted the movement and activities of all African-American inmates after a coordinated attempt by five African-American inmates to kill two correctional officers. The recommendation was adopted by the district court. (Larry v. Tilton (S.D.Cal., Sept. 28, 2011, No. 09-CV-00950 JLS (WVG)) 2011 U.S.Dist. Lexis 110347.) The modified program lasted only three months, during which time there were additional acts and threats of violence by African-American inmates against correctional officers and an investigation showed that African-Americans alone among the inmates sought to attack correctional officers for perceived wrongs. (Larry v. Tilton, supra, 2011 U.S.Dist. Lexis 115034 at pp. *5-* 12, *29-*32.) The prison authorities also began to individually screen African-American inmates and released inmates from the modified program if they did not pose an immediate safety threat. (Id. at p. *11.) Similarly, in Fischer v. Ellegood (11th Cir. 2007) 238 Fed. Appx. 428, 429-434, a federal court upheld summary judgment in a civil rights action against Florida jail officials who instituted a two-week segregated lockdown of inmates after Whites reported fears of violence from African-American inmates. The penal institution’s race-based practice was short in duration and designed as an emergency measure to address a specific race-based threat.

The trial court’s order in the present case similarly permits the prison to respond to specific instances of gang or other racially charged violence. The order directs prison officials “to refrain from affording preferential treatment to inmates on the basis of ethnicity.” But the order also permits prison staff *1429“[i]n their discretion . . . [to] lock down the prison” and “[o]n a short-term emergency basis, . . . [to] separate inmates on the basis of ethnicity, if prison security requires it, so long as it is not done preferentially.”11 The order is fully consistent with Johnson, supra, 543 U.S. at page 512, which recognized that “[t]he ‘necessities of prison security and discipline’ ” may sometimes require race-based practices but those practices must be “narrowly tailored to address those necessities.”

III. The trial court had authority to grant declaratory relief and to assert continuing jurisdiction to enforce its order

The trial court found that the issues presented in this case are a recurrence of the issues presented in Escalera and are likely to recur in the future. As set out above, before filing the present action Morales filed a motion in the Escalera case to enjoin race-based lockdowns but the motion was returned by the court clerk because Morales is not a party in that action. The court’s order disposing of Morales’s subsequently filed habeas corpus petition provides that “[i]nmates who are not parties to this case, or to the case of Escalera v. Terhune may seek enforcement of the orders made herein by filing a pleading in this case.”12 The court made the order “in the interest of judicial economy, and to avoid a multiplicity of litigation.” The court later explained that the enforcement provision is “a procedural device designed to conserve judicial resources by avoiding repeated hearings on the same issue. The court will still expect inmates to exhaust administrative remedies before making a motion to enforce the order, and if the Court of Appeal issues a published decision, that part of the order may become unnecessary. However, as we have seen, there is a danger that after a period of compliance, the order may be forgotten and ignored, unless there is a means for inmates to seek redress.”

The warden contends that this portion of the order exceeds the authority of the trial court, which assertedly is limited to adjudicating Morales’s individual right to relief from the modified program in effect from *14302008 to 2011. The warden asserts that the court had “no authority to provide prospective relief or to rule on issues not alleged in Morales’s petition.” The warden’s argument understates the scope of permissible habeas corpus relief. “It is well recognized that the habeas corpus procedure may be properly utilized to obtain a declaration of rights in the prevailing circumstances.” (In re Head (1983) 147 Cal.App.3d 1125, 1131 [195 Cal.Rptr. 593].) “Moreover, a trial court may grant habeas corpus petitioners ‘prospective or class relief’ to redress recurring deprivations of rights at correctional facilities. [Citation.] The writ is thus an effective and versatile means by which to remedy persistent violations of prisoners’ rights, and has been so used.”13 (Mendoza v. County of Tulare (1982) 128 Cal.App.3d 403, 420 [180 Cal.Rptr. 347].)

It is true, as the warden maintains, that a court may not rule on issues outside the allegations of a habeas corpus petition. “[I]t is the parties’ pleadings that define the issues” in a habeas corpus proceeding and thus “the issues to be addressed may not extend beyond the claims alleged in the habeas corpus petition.” (Board of Prison Terms v. Superior Court (2005) 130 Cal.App.4th 1212, 1235 [31 Cal.Rptr.3d 70].) The trial court’s order does not breach this rule. Morales alleged that “prison officials are violating the Equal Protection Clause by segregating Southern Hispanics and imposing atypical and significant confinement on Southern Hispanics inmates” and that, despite Escalera and Johnson, prison officials “continue to place ethnic groups on lockdown for nonemergency reasons,” keep “the lockdown inmates segregated” for years, and apply “preferential treatment.” The constitutionality of the prison’s practice of race-based lockdowns was raised by the allegations of Morales’s petition and thus was properly adjudicated in this action.

In authorizing other affected inmates to enforce the order “to refrain from affording preferential treatment to inmates on the basis of ethnicity,” the order does not, as the warden claims, “deprived” him of “the opportunity to defend existing or future modified programs.” In the event that other inmates allege that a future modified program violates the order, the warden of course will be entitled to file responsive pleadings and to present evidence that its program is consistent with the court’s order. What the warden may not do is relitigate the constitutionality of imposing long-term penalties and restrictions on the basis of its race-based classifications, a practice that the trial court, now with our approval, has enjoined.

*1431DISPOSITION

The order is affirmed.

McGuiness, P. J., and Jenkins, J., concurred.

The full provisions of the trial court’s order are set out at page 1422, post.

A gang is defined as “any ongoing formal or informal organization, association or group of three or more persons which has a common name or identifying sign or symbol whose members and/or associates, individually or collectively, engage or have engaged, on behalf of that organization, association or group, in two or more acts which include, planning, organizing!,] threatening, financing, soliciting, or committing unlawful acts” or serious disciplinary rule violations within prison. (Cal. Code Regs., tit. 15, § 3000.)

There was testimony that other level IV maximum security prisons, and perhaps all of them, use race in making housing assignments and managing inmates but we limit our discussion to Pelican Bay, which was the focus of the witnesses’ testimony.

Some prison officials were more explicit than others in admitting that Pelican Bay’s five-group-classification system is race based. One Pelican Bay gang investigator admitted that the prison categories of White and Black mean the White and Black races, and the category Other is “a conglomeration of the remaining races,” mostly Asian. The gang investigator also testified that Hispanic is a racial category that is divided into Northern Hispanic and Southern Hispanic “by gang politics.” Other prison officials testified that Pelican Bay assigns a group classification like Black not because the inmate is racially Black but because a racially Black inmate will align himself with Black gangs when there is unrest in the prison. The associate warden testified that inmates align by race in a fight because “[i]f they didn’t, they would be disciplined, so to speak, by their own race.” A facility captain testified that “ ‘individuals in prison’ is kind of a misnomer” because “inmates break themselves into groups,” perpetrate violence as groups, and do so along racial lines.

The facility captain generally makes a recommendation to institute a modified program to the warden, who must approve or reject it. If a modified program is approved, the facility captain completes a program status report. Updated program status reports are submitted weekly to the CDCR. Prison staff and inmates are informed of the modified program, its specific implementation, and any revisions by plan of action memoranda.

The record before us includes weekly program status reports for the periods from January 14, 2010, to April 26, 2010, and September 27, 2010, to March 14, 2011. These reports include a preprinted form called a plan of operation that has various boxes checked. The section for “inmates affected” lists five categories: All, Black, White, Hispanic, and Other. On each, the category Hispanic is checked. The form has sections for movement, visiting, work, recreation, canteen (store), phone calls, and religious services, among other activities and programs, and each section has a box to be checked to indicate the amount of restriction on activities.

The plan of action reflects the implementation of overlapping modified programs: the program arising from the August 20, 2008 fight among Hispanic inmates and a program implemented following a June 2008 fight between White and Black inmates.

Morales was moved from the prison’s general population facility during the course of the proceedings but the court declined to dismiss his petition as moot given the continuing nature of the issues and the impact of those issues on a large number of inmates. That ruling is not challenged on appeal.

We grant Morales’s request for judicial notice of these court records. (Evid. Code, § 452, subd. (d).)

In rejecting the deferential standard of review applied in Turner, we do not imply that the prison’s practices necessarily would be acceptable under that standard. To the contrary, as Morales notes, racial classifications were held to be unconstitutional in Escalera under the Turner standard, before Johnson had been decided.

As noted above, the court observed that a former warden had success with using “a system of evaluating inmates based upon an individual threat assessment score” and that the CDCR has gang regulations that can be used to separate “inmates who are prone to racially-based gang violence.”

We do not understand the final qualification to preclude the department in an emergency situation from imposing a temporary lockdown or other security measures on a racial or ethnic group of inmates, so long as the measures are designed solely to restore or maintain calm in the institution until individual responsibility for the source of concern is determined and more permanent measures are implemented. Those steps must be taken as promptly as the emergency situation permits and may never include broad restrictions on a racial or ethnic group that are not strictly designed to prevent imminent violence.

Consequently, the court issued an order dismissing a habeas corpus petition filed by another inmate alleging race discrimination and advised the inmate that he may file a motion for enforcement in this action. We grant the warden’s request for judicial notice of the order. (Evid. Code, § 452, subd. (d).)

The warden advises that there is an action challenging the CDCR’s modified programs pending in federal court but provides no details. (Mitchell v. Felker (E.D.Cal., June 28, 2012, No. 2:08-cv-1196 JAM EEB P) 2012 U.S.Dist. Lexis 90045.) The pendency of that case does not lessen the superior court’s authority, and duty, to provide effective relief in this action.