                    FOR PUBLICATION
  UNITED STATES COURT OF APPEALS
       FOR THE NINTH CIRCUIT

PAUL ERIC HEBBE,                         
                Plaintiff-Appellant,
                v.                              No. 07-17265
CHERYL PLILER, Warden, CSP                       D.C. No.
                                              CV-00-00306-EFB
Sacramento; STEVEN VANCE,
Correctional Captain, CSP                        OPINION
Sacramento,
             Defendants-Appellees.
                                         
       Appeal from the United States District Court
          for the Eastern District of California
      Edmund F. Brennan, Magistrate Judge, Presiding

                    Argued and Submitted
             April 7, 2010—Pasadena, California

                       Filed July 29, 2010

   Before: Daniel M. Friedman,* Dorothy W. Nelson, and
            Stephen Reinhardt, Circuit Judges.

                 Opinion by Judge Reinhardt;
                Concurrence by Judge Friedman




   *The Honorable Daniel M. Friedman, United States Circuit Judge for
the Federal Circuit, sitting by designation.

                               10899
10902                    HEBBE v. PLILER




                          COUNSEL

Michael G. Williams (argued), U.C.L.A. School of Law Ninth
Circuit Clinic, Los Angeles, California, supervised by Charles
C. Lifland, Jeremy Maltby, Catalina Joos Vergara (argued),
O’Melveny & Myers, LLP, Los Angeles, California, for the
plaintiff-appellant.

Edmund G. Brown, Jr., Rochelle C. East, David Carrasco
(argued), Office of the California Attorney General, Sacra-
mento, California, for the defendants-appellees.


                           OPINION

REINHARDT, United States Circuit Judge:

   Paul Hebbe, a prisoner in the California State Prison-
Sacramento C-Facility (“CSP”), appeals the district court’s
grant of prison officials Cheryl Pliler, Warden of the CSP, and
Steven Vance, Correctional Captain of the CSP (individually
and collectively “the prison officials”) motion to dismiss his
42 U.S.C. § 1983 action under Federal Rule of Civil Proce-
dure 12(b)(6). Hebbe appeals the district court’s ruling with
respect to two distinct constitutional claims. First, Hebbe
claims that the prison officials violated his constitutional right
of court access because they denied him use of the prison law
library without providing any alternative means of legal
research assistance during the limited time period in which he
was permitted to appeal his state court criminal conviction.
Second, Hebbe claims that subsequently the prison officials
                           HEBBE v. PLILER                        10903
violated his Eighth Amendment right to be free from cruel
and unusual punishment because they forced him to choose
between two constitutional rights, his right to exercise and his
right of court access, by allowing him out of his cell only two
hours per day, four days per week, for a period of eight
months. We reverse the district court’s ruling as to both
claims and remand the case for further proceedings.

I.       BACKGROUND

   Paul Hebbe was convicted, pursuant to a plea agreement, of
two counts of burglary. He was sentenced to a term of eigh-
teen years and four months. He appealed his conviction to the
California Court of Appeal. The court appointed pro bono
counsel to represent him on appeal.

   On November 9, 1998, while Hebbe was imprisoned in the
CSP, a fight broke out and parts of the facility, including the
part in which he was held, were subjected to a “lockdown.”
During lockdowns, CSP inmates are confined to their cells at
almost all times and are not allowed to exercise outdoors or
use the institution’s law library. On November 18, 1998,
Hebbe’s pro bono appellate counsel withdrew and filed a “no
issue” Wende brief in the California Court of Appeal.1 The
court accepted the brief, and advised Hebbe of his right to
file, pro se, a supplemental appellate brief within thirty days,
by December 18, 1998. Hebbe states in his complaint that he
was still on lockdown, and thus had no access to the law
library for that entire thirty-day period. He asserts that he was
therefore unable to research and file a supplemental appellate
brief by the December 18, 1998 deadline.

     The CSP alleges that it provides inmates with emergency
     1
   A Wende brief is one that an appellate counsel can file when he finds
no legitimate issues for appeal. See People v. Wende, 25 Cal.3d 436
(1979). When an attorney files a Wende brief the court is then obliged to
undertake an independent review of the record for valid claims.
10904                         HEBBE v. PLILER
library services during a lockdown through a paging system,
although this system offers extremely limited access to legal
materials.2 According to the prison officials, Hebbe was
allowed access to this paging system while he was on lock-
down; according to Hebbe, however, the prison officials never
informed him of the program’s existence or that he had a right
to use the program to access legal reference materials. Hebbe
alleges that he did not learn of the existence of the paging sys-
tem until January of 1999. Consequently, he asserts, he did
not file a supplemental brief before the California Court of
Appeal’s December 18, 1998, filing deadline. For the pur-
poses of a motion to dismiss, we construe the pleading in the
light most favorable to the party opposing the motion, and
resolve all doubts in the pleader’s favor. See Hospital Bldg.
Co. v. Trustees of Rex Hospital, 425 U.S. 738 (1976). We
therefore take the factual allegations in Hebbe’s complaint as
true. See Galbraith v. County of Santa Clara, 307 F.3d 1119,
1121 (9th Cir. 2002)

   On March 8, 1999 Hebbe’s section of the prison was
removed from lockdown status and he was once again
allowed to access the prison’s law library. Shortly thereafter,
there was another disturbance and the prison officials put
Hebbe’s section of the prison back on lockdown, from March
  2
    Using the paging system, inmates with legal deadlines may forward
requests for legal references to the library, and library staff will deliver the
requested items to the inmates, beginning after the third day of lockdown.
However, the prison restricts each inmate to a maximum of three items at
a time, and these items may not be more than thirty pages each. If a docu-
ment is larger than thirty pages then the prison will only deliver the docu-
ment in thirty page increments. Further, the library staff will send only
items that the inmates must request by using a specific form of correct
citation, which it defines narrowly. If the citation is not sufficiently clear
then the library staff will deny the request. For example, the library staff
will deny a request for “Plessy v. Ferguson,” as it is not specific enough.
Also, the library staff will deny a request for “114 S. Ct. 2364, Heck v.
Humphrey” as it is not in the correct citation format. Other citation defects
that if found will result in the library staff ignoring the request are mis-
spellings in case names and lack of all parallel citation.
                           HEBBE v. PLILER                        10905
28, 1999 until April 18, 1999. On April 20, 1999, Hebbe filed
a “continuance request,” with the California Court of Appeal
asserting that the lockdown had made it impossible for him to
research and draft an appellate brief. The California Court of
Appeal, which had dismissed Hebbe’s appeal after he failed
to file a supplemental brief by the court’s deadline, construed
the “continuance request” as a petition for rehearing and
denied it on May 5, 1999.

  From November 10, 1998 to February 14, 2000, a period
of a little more than 15 months, Hebbe spent approximately
seven months in lockdown, without access to the law library
and without an opportunity to exercise outdoors.3 For the
period of time totaling eight months in which Hebbe was not
on lockdown,4 the CSP allowed him two hours per day, four
days per week, during which he could either exercise outdoors
or use the law library. These eight hours per week were
Hebbe’s only opportunity to do either.

   On February 14, 2000, Hebbe filed a complaint in the dis-
trict court under 42 U.S.C. § 1983 alleging that the prison
officials had violated his constitutional rights. Only two of the
claims listed in that complaint are relevant for purposes of this
appeal: the claim that the prison officials violated Hebbe’s
right of access-to-courts by preventing him from using the
law library during the lockdown, and his claim that the prison
officials violated his Eighth Amendment rights by forcing him
to choose between outdoor exercise and use of the law library
when he was not on lockdown.5
  3
     Hebbe was in lockdown between November 10, 1998 - March 8, 1999,
March 28, 1999 - April 18, 1999, and September 11, 1999 - November 10,
1999. ER II 104. However, Hebbe was not himself responsible for any of
the prison lockdowns.
   4
     Specifically: March 8, 1999 - March 28, 1999, April 18, 1999 - Sep-
tember 11, 1999, and November 10, 1999 - February 14, 2000.
   5
     Hebbe filed an amended complaint on July 17, 2000, reiterating these
claims.
10906                       HEBBE v. PLILER
   On April 10, 2001, the prison officials filed a Motion to
Dismiss for failure to state a claim upon which relief can be
granted. On February 20, 2002, the magistrate judge recom-
mended dismissing Hebbe’s access-to-courts claim because
he “fail[ed] to allege he was unable to file a meritorious claim
as a result of his [law] library restrictions.” The magistrate
judge also recommended dismissing the claim that Hebbe was
forced to choose between library access and outdoor exercise
in contravention of the Eighth Amendment because Hebbe
“concede[d] he had yard time and used the law library, and
fail[ed] to allege an inability to file or a rejection of a merito-
rious claim resulted from his having to divide his recreation
time between the yard and the law library.”

   On April 19, 2002, the district court summarily upheld the
findings and recommendations of the magistrate judge and
adopted them in full. The district court granted the prison offi-
cials’ Motion to Dismiss Hebbe’s claims, with prejudice, dis-
missing both his claim that the prison officials impermissibly
restricted his court access during the lockdowns and his claim
that they unconstitutionally forced him to choose between
using the law library and exercising outdoors when the facil-
ity in which he was incarcerated was not on lockdown.6
Hebbe timely appeals the district court’s ruling on these two
distinct constitutional claims.

II.   ANALYSIS

   We “review de novo a district court’s disposition of a
motion to dismiss pursuant to Rule 12(b)(6).” Coto Settlement
v. Eisenberg, 593 F.3d 1031, 1034 (9th Cir. 2010). The prison
officials ask us to apply the standard for reviewing complaints
that the Supreme Court recently adopted in Iqbal v. Ashcroft,
  6
    The sole claim to survive the motion to dismiss was Hebbe’s claim that
the prison denied him yard time during the lockdown periods, in violation
of the Eighth Amendment. On September 27, 2007, a jury returned a ver-
dict in favor of the prison officials on this Eighth Amendment claim.
                         HEBBE v. PLILER                    10907
namely, that a complaint may survive a motion to dismiss
only if, taking all well-pleaded factual allegations as true, it
contains enough facts to “state a claim to relief that is plausi-
ble on its face.” Ashcroft v. Iqbal, 129 S. Ct. 1937, 1949
(2009) (quoting Bell Atl. Corp. v. Twombly, 550 U.S. 544,
570 (2007)). But because Hebbe is an inmate who proceeded
pro se, his complaint “must be held to less stringent standards
than formal pleadings drafted by lawyers,” as the Supreme
Court has reminded us since Twombly. See Erickson v.
Pardus, 551 U.S. 89, 94 (2007) (per curiam). Because Iqbal
incorporated the Twombly pleading standard and Twombly did
not alter courts’ treatment of pro se filings, we continue to
construe pro se filings liberally. This is particularly important
where, as in the instant case, a petitioner is a pro se prisoner
litigant in a civil rights matter. See Bretz v. Kelman, 773 F.2d
1026, 1027 n.1 (9th Cir. 1985) (courts “have an obligation
where the petitioner is pro se, particularly in civil rights cases,
to construe the pleadings liberally and to afford the petitioner
the benefit of any doubt.”).

A.   Hebbe’s court access claim survives the motion to
     dismiss

   Hebbe alleges that the prison officials violated his constitu-
tional right to court access, grounded in the First Amendment
right to petition and the Fourteenth Amendment right to due
process, by denying him access to the prison law library while
the facility was on lockdown, and that the denial prevented
him from filing a brief in support of his appeal of his state
court conviction.

  [1] In 1977 the United States Supreme Court held that “the
fundamental constitutional right of access to the courts
requires prison authorities to assist inmates in the preparation
and filing of meaningful legal papers by providing prisoners
with adequate law libraries or adequate assistance from per-
sons trained in the law.” Bounds v. Smith, 430 U.S. 817, 828
(1977). Nineteen years later, in Lewis v. Casey, the Court reit-
10908                    HEBBE v. PLILER
erated that penal institutions have a duty to afford prisoners
“a reasonably adequate opportunity to present claimed viola-
tions of fundamental constitutional rights to the courts.” 518
U.S. 343, 351 (1996) (citing Bounds, 430 U.S. at 825). How-
ever, the Lewis Court narrowed the scope of Bounds by hold-
ing that there is no “abstract, freestanding right to a law
library or legal assistance[. A]n inmate . . . must . . . demon-
strate that the alleged shortcomings in the library or legal
assistance program hindered his efforts to pursue a legal
claim.” Id. at 351, 353 n.3.

   [2] The Court explained that its “actual injury” require-
ment meant that the state was not required to provide library
access to “enable the prisoner to discover grievances” that
might be aired, id. at 354 (emphasis in original), but rather
was required to provide such access to facilitate the prisoner’s
pursuit of a certain “type of frustrated legal claim,” such as
“direct appeals from the convictions for which [he] w[as]
incarcerated” or “actions under 42 U.S.C. § 1983 to vindicate
‘basic constitutional rights.’ ” Id. (citing Wolff v. McDonnell,
418 U.S. 539, 579 (1974)). Thus, the “tools” that Lewis and
Bounds “require[ ] to be provided are those that the inmates
need in order to attack their sentences, directly or collaterally,
and in order to challenge the conditions of their confinement.”
Id. at 355. Hebbe’s claim that he was frustrated in his desire
to use the law library facilities to research the pro se brief that
he wished to file on direct appeal of his state court conviction
involves exactly the type of “actual injury” discussed in
Lewis. Hebbe did not wish to go on a “fishing expedition” to
discover grievances, rather he wished simply to appeal his
conviction, as was his fundamental right.

   [3] When Hebbe’s pro bono appellate counsel filed a
Wende brief and withdrew from his case on November 18,
1998, the California Court of Appeal correctly advised him of
his right to file, pro se, a supplemental appellate brief. Hebbe
unquestionably had a right to use the legal materials available
in the prison to research which issues he might address in that
                         HEBBE v. PLILER                   10909
brief. The fact that Hebbe’s former attorney had filed a Wende
brief did not affect his right to file his own brief or his right
to use the prison library facilities to research that brief. Nor
did the former attorney’s filing of the Wende brief necessarily
demonstrate that there were no nonfrivolous claims that
Hebbe might raise on direct appeal. As we held in Delgado
v. Lewis, the filing of a Wende brief does not show disposi-
tively that an appeal is without merit. 223 F.3d 976 (9th Cir.
2000).

   [4] Similarly, the fact that Hebbe entered a guilty plea did
not affect his right to appeal, nor did it affect his right to use
the prison library to research the pro se brief that he wished
to file in support of that appeal. Under California law, individ-
uals who have pleaded guilty may nonetheless prevail upon
appeal in certain circumstances. See Cal. Penal Code
§ 1237.5(a) (stating that individuals who enter guilty pleas
may appeal on the basis of “reasonable constitutional, juris-
dictional, or other grounds going to the legality of the pro-
ceedings.”). Hebbe thus had a right to use the prison law
library to research the constitutional, jurisdictional, or other
issues he might raise on appeal.

   [5] Lewis may not have “guarantee[d] inmates the where-
withal to transform themselves into litigating engines capable
of filing everything from shareholder derivative actions to
slip-and-fall claims,” Lewis 518 U.S. at 355, but it did guaran-
tee individuals like Hebbe the right to use the prison law
library to “attack their sentences, directly.” Id. Hebbe was
impermissibly denied the opportunity to appeal his convic-
tion. This fulfills Lewis’s “actual injury” requirement. We
therefore reverse the district court’s ruling on Hebbe’s first
claim.

B.   Hebbe’s Eighth Amendment claim survives the
     motion to dismiss

  Hebbe also alleges that the prison officials violated his
Eighth Amendment right to be free from cruel and unusual
10910                        HEBBE v. PLILER
punishment during the period of time totaling eight months in
which he was permitted to leave his cell for only two hours
per day, four days per week. He asserts that, during that time,
the prison officials impermissibly forced him to choose
between spending the eight hours per week on either using the
law library or exercising outdoors.

   [6] Forcing a prisoner to choose between using the prison
law library and exercising outdoors is impermissible because
“an inmate cannot be forced to sacrifice one constitutionally
protected right solely because another is respected.” Allen v.
City and County of Honolulu, 39 F.3d 936, 940 (9th Cir. 1994).7
As we discuss supra, the Supreme Court in Lewis emphasized
the continued vitality of this rule, but held that an inmate’s
constitutional right to use of a law library was not “freestand-
ing,” but rather predicated upon the pursuit of an “arguably
actionable” legal claim. Id. at 351.

   [7] Here, as Hebbe’s counsel underscored at oral argu-
ment, Hebbe wished to use the law library to research and file
his § 1983 complaint. The prison officials do not dispute that
Hebbe’s § 1983 action involves one or more non-frivolous,
“arguably actionable” legal claims—nor could they, given
   7
     The prison officials urge, erroneously, that our holding in Allen applies
only to individuals held in segregated housing units or otherwise severely
restrictive conditions of confinement. No published opinion of our court
advances such a proposition and it is of little merit for constitutional pur-
poses. What matters for cases such as the one before us is the amount of
time the prisoner is allowed out of his cell to access the law library and
for out-of-cell exercise, not any other limitation imposed upon his freedom
or conditions to which he is subjected. Moreover, we note that there are
many similarities between Hebbe’s conditions of confinement and Allen’s.
Hebbe was on and off lockdown over the course of a 15-month period.
During periods totaling seven of those 15 months, he had no access to the
library and no out-of-cell exercise at all. When he was released from lock-
down, Hebbe was allowed to leave his cell for only eight hours per week
to either exercise or use the law library. Allen was, similarly, allowed to
leave his cell for six hours per week to either exercise or use the law
library. Allen, 39 F.3d at 939.
                        HEBBE v. PLILER                    10911
that one of those claims, Hebbe’s claim that his Eighth
Amendment rights were violated when he was denied all out-
of-cell exercise during the seven month period that he was
held on lockdown, was tried to a jury. In addition to that
claim, Hebbe had other nonfrivolous claims to research as
well. The two counts that are now on appeal before us are cer-
tainly not frivolous. Hebbe also wished to use the law library
to research the state habeas petition that he filed in Sacra-
mento Superior Court, a purpose that falls squarely under
Lewis’s definition of nonfrivolous legal research. See Lewis,
518 U.S. at 355 (interpreting Bounds as requiring prisons to
provide inmates with the legal research facilities that they
“need in order to attack their sentences, directly or collateral-
ly”).

   [8] That Hebbe used the law library to research the § 1983
action during the time that he specifies in his complaint—i.e.
from November 1998 to February 2000—is apparent both
from the face of the complaint and the timing of its filing. The
same is true of Hebbe’s state habeas petition, which was filed
on May 20, 1999. Construing Hebbe’s pro se complaint liber-
ally, as we are required to do under Erickson v. Pardus, 551
U.S. 89, 94 (2007) (per curiam), we hold that Hebbe has suffi-
ciently alleged for the purposes of surviving a motion to dis-
miss that he wished to research a nonfrivolous legal claim and
thus had a cognizable constitutional right to use the law
library.

   For the purposes of surviving a motion to dismiss, Hebbe
has therefore sufficiently alleged that prison officials violated
his Eighth Amendment rights because they forced him to
choose between his constitutional right to exercise and his
constitutional right of access to the courts for at least eight
months. Allen, 39 F.3d at 940. We therefore reverse the dis-
trict court’s ruling and remand for further proceedings.

  REVERSED and REMANDED.
10912                   HEBBE v. PLILER
FRIEDMAN, Circuit Judge, concurring:

   I agree that, under the precedents of this court, the district
court should not have dismissed the two claims here at issue.
I write separately, however, to point out another aspect of the
case.

   For Hebbe to recover damages in his § 1983 suit, he would
have to show that, had it not been for the two alleged constitu-
tional violations to which he was subjected, he probably
would have succeeded in overturning his conviction. In light
of the events in this case, he seems unlikely to be able to
make that showing.

   Hebbe, represented by counsel, entered into a plea agree-
ment with California prosecutors, under which he pleaded
guilty to two counts of burglary and was sentenced to eigh-
teen years imprisonment. The California Court of Appeal, to
which he appealed his conviction, appointed pro bono counsel
for him. His counsel filed a so-called “Wende” brief, stating
that counsel could find no legitimate issue to argue on appeal.
The Court of Appeal permitted Hebbe’s appellate counsel to
withdraw and informed Hebbe that he could file pro se a sup-
plemental appellate brief within thirty days. Hebbe did not do
so within that deadline.

   Hebbe asserts that the reason was because he was on “lock-
down” in prison during that thirty-day period. He contends
that because of the lockdown, he was unable to use the prison
law library to research his proposed appeal, and therefore did
not discover a California statute that would have permitted
him to withdraw his guilty plea. He also argues that he was
subjected to cruel and unusual punishment because, during
non-lockdown periods, he was permitted to leave his cell for
only eight hours a week, which he could use either in the
library or for outdoor exercise. He contends that this required
him to make an unconstitutional choice.
                        HEBBE v. PLILER                   10913
   It is not enough for Hebbe to raise these challenges to enti-
tle him to recover under his § 1983 complaint. I believe he
also must establish that he had credible claims that his convic-
tion on his plea was improper. Here, his appointed appellate
counsel could find no basis for challenging his conviction,
and the California Court of Appeal agreed with that conclu-
sion. I think Hebbe would be required to show that his convic-
tion based upon his guilty plea itself could be reasonably
challenged. It seems unlikely that he could make that show-
ing.
