
627 F.3d 338 (2010)
Paul Eric HEBBE, Plaintiff-Appellant,
v.
Cheryl PLILER, Warden, CSP Sacramento; Steven Vance, Correctional Captain, CSP Sacramento, Defendants-Appellees.
No. 07-17265.
United States Court of Appeals, Ninth Circuit.
Argued and Submitted April 7, 2010.
Filed July 29, 2010.
Amended November 19, 2010.
Michael G. Williams (argued), U.C.L.A. School of Law Ninth Circuit Clinic, Los Angeles, CA, supervised by Charles C. Lifland, Jeremy Maltby, Catalina Joos Vergara (argued), O'Melveny & Myers, *339 LLP, Los Angeles, CA, for the plaintiff-appellant.
Edmund G. Brown, Jr., Rochelle C. East, David Carrasco (argued), Office of the California Attorney General, Sacramento, CA, for the defendants-appellees.
Before: DANIEL M. FRIEDMAN,[*] D.W. NELSON, and STEPHEN REINHARDT, Circuit Judges.
Opinion by Judge REINHARDT; Concurrence by Judge FRIEDMAN.

ORDER
The opinion filed on July 29, 2010, and reported at 611 F.3d 1202, is hereby amended so as to conform with the amended opinion filed herewith. The concurring opinion filed on that date remains unchanged.
The petition for rehearing en banc remains pending before the court and shall be deemed to apply to the amended opinion, unless within 14 days of the date of this order the appellees withdraw or amend their petition.

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 Procedure 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 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 eighteen 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. *340 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 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 lockdown; 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 system 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 purposes 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, 96 S.Ct. 1848, 48 L.Ed.2d 338 (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 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 *341 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 district 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]
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 recommended 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 meritorious 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 officials' Motion to Dismiss Hebbe's claims, with prejudice, dismissing 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 facility 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). We apply the standard for reviewing complaints that the Supreme Court recently adopted in Ashcroft v. Iqbal, namely, that a complaint may survive a motion to dismiss only if, taking all well-pleaded factual allegations as true, it contains *342 enough facts to "state a claim to relief that is plausible on its face." Ashcroft v. Iqbal, ___ U.S. ___, 129 S.Ct. 1937, 1949, 173 L.Ed.2d 868 (2009) (quoting Bell Atl. Corp. v. Twombly, 550 U.S. 544, 570, 127 S.Ct. 1955, 167 L.Ed.2d 929 (2007)). 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 reaffirmed since Twombly. See Erickson v. Pardus, 551 U.S. 89, 94, 127 S.Ct. 2197, 167 L.Ed.2d 1081 (2007) (per curiam). Iqbal incorporated the Twombly pleading standard and Twombly did not alter courts' treatment of pro se filings; accordingly, we continue to construe pro se filings liberally when evaluating them under Iqbal.[7] While the standard is higher, our "obligation" remains, "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." Bretz v. Kelman, 773 F.2d 1026, 1027 n. 1 (9th Cir. 1985) (en banc).

A. Hebbe's court access claim survives the motion to dismiss
Hebbe alleges that the prison officials violated his constitutional 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.
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 persons trained in the law." Bounds v. Smith, 430 U.S. 817, 828, 97 S.Ct. 1491, 52 L.Ed.2d 72 (1977). Nineteen years later, in Lewis v. Casey, the Court reiterated that penal institutions have a duty to afford prisoners "a reasonably adequate opportunity to present claimed violations of fundamental constitutional rights to the courts." 518 U.S. 343, 351, 116 S.Ct. 2174, 135 L.Ed.2d 606 (1996) (citing Bounds, 430 U.S. at 825, 97 S.Ct. 1491). However, the Lewis Court narrowed the scope of Bounds by holding that there is no "abstract, freestanding right to a law library or legal assistance[. A]n inmate ... must... demonstrate 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, 116 S.Ct. 2174.
The Court explained that its "actual injury" requirement 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, 97 S.Ct. 1491 (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. *343 McDonnell, 418 U.S. 539, 579, 94 S.Ct. 2963, 41 L.Ed.2d 935 (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, 97 S.Ct. 1491. 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 plausibly alleges 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.
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 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 dispositively that an appeal is without merit. 223 F.3d 976 (9th Cir.2000).
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, individuals 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, jurisdictional, or other grounds going to the legality of the proceedings."). Hebbe thus had a right to use the prison law library to research the constitutional, jurisdictional, or other issues he might raise on appeal.
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, 116 S.Ct. 2174, but it did guarantee individuals like Hebbe the right to use the prison law library to "attack their sentences, directly." Id. If true, the facts Hebbe alleges would establish that he was impermissibly denied the opportunity to appeal his conviction, which denial would fulfill 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 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.
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 *344 and County of Honolulu, 39 F.3d 936, 940 (9th Cir.1994).[8] 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 "freestanding," but rather predicated upon the pursuit of an "arguably actionable" legal claim. Id. at 351, 116 S.Ct. 2174.
Here, as Hebbe's counsel underscored at oral argument, 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 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 certainly not frivolous. Hebbe also wished to use the law library to research the state habeas petition that he filed in Sacramento Superior Court, a purpose that falls squarely under Lewis's definition of nonfrivolous legal research. See Lewis, 518 U.S. at 355, 116 S.Ct. 2174 (interpreting Bounds as requiring prisons to provide inmates with the legal research facilities that they "need in order to attack their sentences, directly or collaterally").
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 liberally, as we are required to do under Erickson v. Pardus, 551 U.S. 89, 94, 127 S.Ct. 2197, 167 L.Ed.2d 1081 (2007) (per curiam), we hold that Hebbe has plausibly alleged for the purposes of surviving a motion to dismiss 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 district court's ruling and remand for further proceedings.
REVERSED and REMANDED.
FRIEDMAN, Circuit Judge, concurring:
I agree that, under the precedents of this court, the district court should not *345 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 constitutional 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 agreement with California prosecutors, under which he pleaded guilty to two counts of burglary and was sentenced to eighteen 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 supplemental appellate brief within thirty days. Hebbe did not do so within that deadline.
Hebbe asserts that the reason was because he was on "lockdown" 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.
It is not enough for Hebbe to raise these challenges to entitle him to recover under his § 1983 complaint. I believe he also must establish that he had credible claims that his conviction 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 conclusion. I think Hebbe would be required to show that his conviction based upon his guilty plea itself could be reasonably challenged. It seems unlikely that he could make that showing.
NOTES
[*]  The Honorable Daniel M. Friedman, United States Circuit Judge for the Federal Circuit, sitting by designation.
[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, 158 Cal.Rptr. 839, 600 P.2d 1071 (1979). When an attorney files a Wende brief the court is then obliged to undertake an independent review of the record for valid claims.
[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 document is larger than thirty pages then the prison will only deliver the document 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 misspellings in case names and lack of all parallel citation.
[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September 11, 1999, and November 10, 1999February 14, 2000.
[5]  Hebbe filed an amended complaint on July 17, 2000, reiterating these claims.
[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 verdict in favor of the prison officials on this Eighth Amendment claim.
[7]  We therefore join the five other circuits that have determined that pro se complaints should continue to be liberally construed after Iqbal. See McGowan v. Hulick, 612 F.3d 636, 640-42 (7th Cir.2010); Bustos v. Martini Club Inc., 599 F.3d 458, 461-62 (5th Cir.2010); Casanova v. Ulibarri, 595 F.3d 1120, 1124 n. 2, 1125 (10th Cir.2010); Capogrosso v. Sup. Ct. of N.J., 588 F.3d 180, 184 & n. 1 (3d Cir.2009); Harris v. Mills, 572 F.3d 66, 71-72 (2d Cir.2009) (noting that even following Twombly and Iqbal, "we remain obligated to construe a pro se complaint liberally").
[8]  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 purposes. 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.
