                   FOR PUBLICATION

  UNITED STATES COURT OF APPEALS
       FOR THE NINTH CIRCUIT


ADONAI EL-SHADDAI, AKA              No. 13-56104
James R. Wilkerson,
         Plaintiff-Appellant,          D.C. No.
                                 2:13-cv-02327-UA-JC
              v.

L. D. ZAMORA, Chief                   OPINION
CCHCS in individual
capacity and official
capacity; P. PAK, MD in
individual capacity and
official capacity, C. WU, MD
Physician and Surgeon in
individual capacity and
official capacity,
                   Defendants,

             and

JEFFERY WANG, MD Chief
Medical Executive in
individual capacity and
official capacity, TERESA
MACIAS, Chief Executive
Officer in individual capacity
and official capacity; GLENN
THIEL, DO PHD in individual
capacity and official
capacity; C. MCCABE, MD in
2                EL-SHADDAI V. WANG

individual capacity and
official capacity; NGUYEN,
MD in individual capacity
and official capacity; EDGAR
CLARK, MD Secretary Pain
Committee in individual
capacity and official
capacity; RUFF, PHD
Psychologist in individual
capacity and official
capacity; BURR, Physical
Therapist in individual
capacity and official
capacity; A. ADAMS, MD
Chief Physician and Surgeon
in individual capacity and
official capacity; P. SHANK,
Chief Executive Officer in
individual capacity and
official capacity; P.
FINANDER, MD Chief
Medical Executive in
individual capacity and
official capacity; J. FITTER,
MD in individual capacity
and official capacity; W.
OLUKAMNI, Physician
Assistant in individual
capacity and official
capacity,
        Defendants-Appellees.
                      EL-SHADDAI V. WANG                              3

        Appeal from the United States District Court
            for the Central District of California
       George H. King, Chief District Judge, Presiding

              Argued and Submitted April 4, 2016
                     Pasadena, California

                      Filed August 12, 2016

       Before: JEROME FARRIS, CARLOS T. BEA,
        and MILAN D. SMITH, JR., Circuit Judges.

             Opinion by Judge Milan D. Smith, Jr.


                           SUMMARY*


                      Prisoner Civil Rights

    The panel reversed the district court’s denial of a
prisoner’s motion to proceed in forma pauperis after the
district court found that the “three-strikes” rule in the Prison
Litigation Reform Act prohibited the prisoner from
proceeding in forma pauperis because he had brought at least
three actions that were “dismissed on the grounds that [they
were] frivolous, malicious, or fail[ed] to state a claim upon
which relief may be granted.” 28 U.S.C. § 1915(g).

    The panel held that of the eleven potential strikes that the
district court may have relied upon in finding the prisoner

  *
    This summary constitutes no part of the opinion of the court. It has
been prepared by court staff for the convenience of the reader.
4                   EL-SHADDAI V. WANG

ineligible for in forma pauperis status, only one was a valid
strike under the Prison Litigation Reform Act. Therefore, the
panel remanded for the district court to assess whether the
prisoner was otherwise entitled to proceed in forma pauperis.

    In assessing whether the prior dismissals qualified as
strikes, the panel held that: (1) in an action where in forma
pauperis status is denied solely on the ground that the
plaintiff has accumulated too many strikes, and there has
been no additional finding that the action is itself frivolous,
malicious, or fails to state a claim, the denial of in forma
pauperis status and subsequent dismissal of the case do not
count as a strike for purposes of § 1915(g); (2) the district
court’s prior dismissal of an action for failure to exhaust
administrative remedies, as required under the Prison
Litigation Reform Act, did not count as a strike because the
failure to exhaust was not clear from the face of the
complaint, and the district court made no finding that the
complaint was frivolous or malicious; (3) the prior summary-
judgment dismissals did not count as strikes because they
were not decided on the ground that the complaint was
frivolous, malicious, or failed to state a claim, but rather were
decided on evidentiary grounds; (4) an appellate affirmance
does not count as separate strikes unless the court expressly
states that the appeal itself was frivolous, malicious or failed
to state a claim; and (5) actions brought pursuant to § 1983
which challenge the fact or duration of a prisoner’s sentence
and should be construed as habeas petitions, do not count as
strikes.
                    EL-SHADDAI V. WANG                         5

                         COUNSEL

Michael Shipley (argued), Kirkland & Ellis LLP, Los
Angeles, California, for Plaintiff-Appellant.

Misha D. Igra (argued) and Thomas S. Patterson, Supervising
Deputy Attorneys General; Jonathan L. Wolff, Senior
Assistant Attorney General; Kamala D. Harris, Attorney
General; Office of the Attorney General, Sacramento,
California; for Defendant-Appellee Jeffery Wang.

No appearance for Defendants-Appellees L. D. Zamora, P.
Pak, C. Wu, Teresa Macias, Glenn Thiel, C. McCabe,
Nguyen, Edgar Clark, Ruff, Burr, A. Adams, P. Shank, P.
Finander, J. Fitter, and W. Olukamni.


                          OPINION

M. SMITH, Circuit Judge:

    While incarcerated in California, Adonai El-Shaddai
(previously known as James Wilkerson), filed at least eleven
lawsuits against prison officials prior to filing this case. On
appeal, we must decide whether these previous cases amount
to at least three “strikes” under the Prison Litigation Reform
Act of 1995 (PLRA), 28 U.S.C. § 1915(g), such that El-
Shaddai is barred from proceeding in forma pauperis (IFP) in
this and future cases. Because we conclude that only one of
the prior actions was “dismissed on the grounds that it [was]
frivolous, malicious, or fail[ed] to state a claim,” id., we hold
that El-Shaddai has not incurred three strikes, and we reverse
the contrary decision of the district court.
6                  EL-SHADDAI V. WANG

    FACTS AND PROCEDURAL BACKGROUND

    El-Shaddai is a prisoner incarcerated in California. In
1976, before his incarceration, he was injured in a car
accident. As a result of his accident, El-Shaddai suffers from
chronic back pain and related health issues. Since at least
2007, he has received a variety of accommodations for his
conditions, including a bottom bunk, a back brace, orthopedic
shoes, special bedding, and lifting restrictions.

    In April 2011, El-Shaddai requested that the prison begin
treating his pain with medical marijuana, glucosamine
chondroitin, and Osteo Bi-Flex, consistent with his religious
belief in African Holistic Healing. His request was denied,
and his bottom-bunk accommodation was also revoked. El-
Shaddai brought suit against prison officials, claiming
deliberate indifference to his medical needs because they
failed to grant his requested course of medical treatment and
revoked his accommodation.

    El-Shaddai submitted his complaint in this case in
conjunction with a request to proceed IFP. The district court
denied the motion, concluding that the “three-strikes” rule in
the PLRA prohibited El-Shaddai from proceeding IFP
because he had brought at least three actions that were
“dismissed on the grounds that [they were] frivolous,
malicious, or fail[ed] to state a claim upon which relief may
be granted.” 28 U.S.C. § 1915(g). The district court cited two
cases that it categorized as strikes under the PLRA, and noted
that one of those cases, Wilkerson v. Prunty, Civ. No. 96-
1222B (S.D. Cal. Oct. 28, 1997) (Prunty I) listed several
other strikes. The district court also found that El-Shaddai had
not shown that he was entitled to the “imminent danger”
exception to the three-strikes rule. See 28 U.S.C. § 1915(g).
                       EL-SHADDAI V. WANG                                  7

In response to El-Shaddai’s motion for reconsideration, the
district court explicitly found three additional cases to be
strikes. Counting all of the cases cited in the district court’s
two orders, as well as all of the cases identified as strikes in
Prunty I, there are eleven potential strikes that the district
court may have relied on in finding El-Shaddai ineligible for
IFP status. El-Shaddai timely appealed the denial of his
motion for reconsideration.1

                              ANALYSIS

    The PLRA provides that “[i]n no event shall a prisoner
bring a civil action or appeal a judgment in a civil action or
proceeding [in forma pauperis] if the prisoner has, on 3 or
more prior occasions, while incarcerated or detained in any
facility, brought an action or appeal in a court of the United
States that was dismissed on the grounds that it is frivolous,
malicious, or fails to state a claim upon which relief may be
granted, unless the prisoner is under imminent danger of
serious physical injury.” 28 U.S.C. § 1915(g). “Not all


  1
    Although El-Shaddai’s notice of appeal stated that he was appealing
only the district court’s order denying his motion for reconsideration, we
construe the appeal to encompass the district court’s original order
denying IFP status. “[T]he rule is well settled that a mistake in designating
the judgment appealed from should not result in loss of the appeal as long
as the intent to appeal from a specific judgment can be fairly inferred from
the notice and the appellee is not misled by the mistake.” Munoz v. Small
Bus. Admin., 644 F.2d 1361, 1364 (9th Cir. 1981). Here, El-Shaddai filed
the notice of appeal pro se, his motion for reconsideration fairly referenced
the district court’s order denying IFP status and the reasons for that
decision, an appeal from the district court’s order denying IFP status
would have been timely, and both parties have fully briefed the merits of
the district court’s order which denied IFP status. As a result, we do not
restrict our analysis to the district court’s order which denied El-Shaddai’s
motion for reconsideration. See id.
8                   EL-SHADDAI V. WANG

unsuccessful cases qualify as a strike under § 1915(g).
Rather, § 1915(g) should be used to deny a prisoner’s IFP
status only when, after careful evaluation of the order
dismissing an action, and other relevant information, the
district court determines that the action was dismissed
because it was frivolous, malicious, or failed to state a claim.”
Andrews v. King, 398 F.3d 1113, 1121 (9th Cir. 2005).

    As a general matter, when we review a dismissal to
determine whether it counts as a strike, the style of the
dismissal or the procedural posture is immaterial. Instead, the
central question is whether the dismissal “rang the PLRA
bells of frivolous, malicious, or failure to state a claim.”
Blakely v. Wards, 738 F.3d 607, 615 (4th Cir. 2013); see also
Andrews, 398 F.3d at 1121; Byrd v. Shannon, 715 F.3d 117,
126 (3d Cir. 2013); Thompson v. Drug Enforcement Admin.,
492 F.3d 428, 436 (D.C. Cir. 2007).

    El-Shaddai concedes that he has one strike. In Popke, the
district court dismissed the case on the grounds that El-
Shaddai failed to state a claim for relief under 42 U.S.C.
§ 1983. This appeal addresses whether the ten other cases
were dismissed on one of the grounds enumerated in the
statute. Those cases were disposed of on several different
procedural postures: through denials of motions to proceed
IFP, rulings that El-Shaddai had failed to exhaust his
administrative remedies, grants of summary judgment in
favor of the defendants, appellate affirmances, and dismissals
for filing actions that should have been brought as habeas
petitions. We address each category of dismissal in turn.
                    EL-SHADDAI V. WANG                           9

I. Denial of IFP Status

     In four of the cases that are potential strikes, El-Shaddai
was denied IFP status on the basis that he had already
accumulated three strikes. After he failed to pay the required
filing fee, the cases were dismissed. We hold that this ground
for dismissal does not count as a strike. Where a dismissal is
based solely on a finding that the plaintiff has previously
incurred at least three strikes, without any additional finding
that the instant action is itself frivolous, malicious, or fails to
state a claim, the dismissal does not count as an additional
strike. This is so because having incurred three strikes,
standing alone, is not an enumerated ground for creating an
additional strike under the language of § 1915(g).

     We have previously held that “when a district court
disposes of an in forma pauperis complaint ‘on the grounds
that [the claim] is frivolous, malicious, or fails to state a claim
upon which relief may be granted,’ such a complaint is
‘dismissed’ for purposes of § 1915(g) even if the district
court styles such dismissal as denial of the prisoner’s
application to file the action without prepayment of the full
filing fee.” O’Neal v. Price, 531 F.3d 1146, 1153 (9th Cir.
2008) (alteration in original). Thus, a dismissal predicated on
a denial of IFP status may be strike-worthy. Id. But that does
not mean that all dismissals predicated on denials of IFP
status are strikes; to constitute a strike, the denial of IFP
status must be based on one of the enumerated grounds in the
statute. Where IFP status is denied solely on the ground that
the plaintiff has accumulated too many strikes, the denial of
IFP status and subsequent dismissal of the case do not count
as a strike for purposes of § 1915(g). Rather, denying IFP
status simply because the plaintiff has too many strikes is
unrelated to whether the action before the court is frivolous,
10                   EL-SHADDAI V. WANG

malicious, or fails to state a claim. That is because the three-
strikes rule applies regardless of whether the plaintiff’s
current claim is well-pleaded or brought in good faith. See
28 U.S.C. § 1915(g) (providing that “[i]n no event shall a
prisoner” proceed IFP if he has incurred three or more strikes,
unless he meets the “imminent danger” exception (emphasis
added)).

    Four of the dismissals that the district court identified as
strikes against El-Shaddai follow this fact pattern. In Prunty
I, the district court dismissed El-Shaddai’s case on two
alternative grounds,2 one of which was that “Plaintiff is a
vexatious litigant not entitled to in forma pauperis status
pursuant to 28 U.S.C. § 1915(g).” The district court did not
rule that Prunty I itself was frivolous, malicious or failed to
state a claim.

    El-Shaddai appealed from Prunty I in Wilkerson v.
Prunty, No. 98-55154 (9th Cir. Apr. 2, 1998) (Prunty II). We
denied IFP status on appeal, concluding that “the record
confirms that appellant is not entitled to in forma pauperis
status for this appeal. . . . Failure to pay the [filing] fees will
result in the automatic dismissal of the appeal by the Clerk
for failure to prosecute.” El-Shaddai failed to pay, and the
appeal was dismissed. We did not make any finding that the
appeal itself fell within one of the enumerated grounds of
§ 1915(g).

   In El-Shaddai v. Woodford, No. 08-CV-2429 (E.D. Cal.
June 18, 2009) (Woodford), the district court denied IFP


  2
   We address whether the second justification for dismissal in Prunty
I—failure to exhaust administrative remedies—is a strike-worthy
dismissal in Part II of this opinion.
                      EL-SHADDAI V. WANG                              11

status again because it concluded that El-Shaddai had
accumulated too many strikes. Not only did the Woodford
court not rule that El-Shaddai’s claim fell within one of the
enumerated grounds, it affirmatively noted that El-Shaddai
had successfully “stated plausible procedural due process
claims.”

    Finally, in El-Shaddai v. Doyle, No. 1:10-CV-01159,
2011 WL 3875478 (E.D. Cal. Aug. 31, 2011) (“Doyle”), the
district court similarly denied IFP status because it concluded
that El-Shaddai had accrued too many strikes, without
addressing the merits of his case.

    Because the grounds for dismissal in Prunty I, Woodford,
and Doyle were that El-Shaddai had incurred too many
strikes, and not because the cases were themselves frivolous,
malicious, or failed to state a claim, they do not count as
separate strikes against El-Shaddai. Similarly, in Prunty II,
we did not dismiss the appeal under one of the three
enumerated grounds, and it does not count as a strike.

II. Failure to Exhaust Administrative Remedies

    The alternative basis on which the district court dismissed
El-Shaddai’s action in Prunty I was that he had “failed to
exhaust all available non-judicial administrative remedies
prior to filing suit,” as required by the PLRA.3 The district
court in Prunty I ruled that the case could be dismissed via a
pre-answer “non-enumerated 12(b) motion.”



  3
    An alternative ground for dismissal can create a strike when it is “a
fully sufficient condition . . . for a dismissal with prejudice.” O’Neal,
531 F.3d at 1156.
12                  EL-SHADDAI V. WANG

    The phrase “fails to state a claim upon which relief may
be granted” from § 1915(g) purposely “parallels the language
of Federal Rule of Civil Procedure 12(b)(6).” Andrews,
398 F.3d at 1121 (internal quotation marks omitted). Thus, if
a claim is dismissed for failure to state a claim under rule
12(b)(6), it counts as a strike for PLRA purposes. “A
complaint is subject to dismissal for failure to state a claim if
the allegations, taken as true, show the plaintiff is not entitled
to relief.” Jones v. Bock, 549 U.S. 199, 215 (2007). Under the
PLRA, a plaintiff must exhaust all administrative remedies
before bringing suit against prison officials, but is not
required to affirmatively allege that he has done so in order
to state a cognizable claim. Id. Instead, failure to exhaust is
an affirmative defense. Id.; see also Albino v. Baca, 747 F.3d
1162, 1166 (9th Cir. 2014) (en banc).

    Notwithstanding the fact that failure to exhaust is an
affirmative defense, a “complaint may be subject to dismissal
under Rule 12(b)(6) when an affirmative defense . . . appears
on its face.” Jones, 549 U.S. at 215 (alteration in Jones)
(quoting Leveto v. Lapina, 258 F.3d 156, 161 (3d Cir. 2001));
see also Albino, 747 F.3d at 1169 (“[I]n those rare cases
where a failure to exhaust is clear from the face of the
complaint, a defendant may successfully move to dismiss
under Rule 12(b)(6) for failure to state a claim.”); Thompson,
492 F.3d at 438 (“[E]ven when failure to exhaust is treated as
an affirmative defense, it may be invoked in a Rule 12(b)(6)
motion if the complaint somehow reveals the exhaustion
defense on its face.”).

    In Prunty I, the district court considered documents
outside the four corners of the complaint in finding that El-
Shaddai had failed to exhaust his administrative remedies.
The district court did not dismiss El-Shaddai’s claim because
                        EL-SHADDAI V. WANG                                 13

a failure to exhaust was “clear from the face of the
complaint,” Albino, 747 F.3d at 1169, which would have been
sufficient to dismiss under 12(b)(6). The district court also
made no finding that the complaint was frivolous or
malicious. Thus, this alternative basis for dismissal in Prunty
I does not count as a strike.

III.     Summary Judgment

    Three of El-Shaddai’s potential strikes were not disposed
of on a motion to dismiss; instead, they were resolved by
summary judgment in favor of the defendants. We hold that
the summary-judgment dismissals at issue here do not count
as strikes, because they were not decided on the ground that
the complaint was frivolous, malicious, or failed to state a
claim.4

   This reasoning is consistent with our holding in Richey v.
Dahne, 807 F.3d 1202 (9th Cir. 2015). In Richey, the district
court granted a motion to dismiss, but did not limit its
analysis to the four corners of the pleadings. Id. at 1207–08.

  4
    In doing so, we do not hold that no summary-judgment disposition
could ever count as a strike. We agree with other circuits that have held
that where an order explicitly states summary judgment is proper because
the case is frivolous, malicious, or fails to state a claim, the dismissal
counts as a strike. Blakely, 738 F.3d at 613; see also Byrd, 715 F.3d at
126; Thompson, 492 F.3d at 436. This is consistent with our reasoning in
Andrews, in which we stated that it is not the style or procedural posture
of a dismissal that is dispositive, but whether we can determine, “after
careful evaluation of the order . . . and other relevant information,” that the
district court dismissed the case on one of the grounds enumerated in
§ 1915(g). 398 F.3d at 1121. The Fourth Circuit in Blakely noted,
however, that it would be a rare summary judgment order that fits this
criteria because “at that point, frivolousness, maliciousness, and failure to
state a claim are not typically addressed.” 738 F.3d at 614.
14                   EL-SHADDAI V. WANG

Instead, it considered evidence submitted by the parties in
reaching its decision. Id. We construed its order as a grant of
summary judgment, and concluded that “[c]onsequently, it
was not a strike under the PLRA.” Id. at 1208. The
underlying principle is that we must decide whether the case
was disposed of because the complaint was frivolous,
malicious, or failed to state a claim, regardless of how the
district court labels its decision. The summary-judgment
orders against El-Shaddai were not based on one of these
grounds, and do not count as strikes.

    In Wilkerson v. Lawrence, No. 93-CV-1732, 1994 WL
412441 (N.D. Cal. Aug. 3, 1994) (Lawrence), El-Shaddai
claimed that prison officials had restricted his access to the
prison law library such that he did not have meaningful
access to the courts. This allegation, taken as true, stated a
claim for relief. See Bounds v. Smith, 430 U.S. 817, 828
(1977). The district court acknowledged that “[p]risoners
possess the constitutional right of meaningful access to the
courts,” and that right is abridged if “inmates are not allowed
a reasonable amount of time to use a law library.” On
summary judgment, however, El-Shaddai failed to “establish
that he ha[d] suffered an actual injury.” Specifically, the
evidence reviewed by the district court showed that he had
accessed the law library “fifty-four times over a period of
approximately six months.” The district court concluded that
this did not create a genuine issue of material fact concerning
whether his access to the law library was unconstitutionally
restricted. In this context, it is clear that the district court did
not grant summary judgment on a ground enumerated by the
PLRA—it granted summary judgment because the evidence
did not support the claim. Lawrence does not count as a
strike.
                   EL-SHADDAI V. WANG                       15

    In Wilkerson v. Marshall, No. 94-CV-0009, 1994 WL
564650 (N.D. Cal. Oct. 3, 1994) (Marshall I) El-Shaddai
raised claims that prison officials were deliberately
indifferent to his medical needs. The district court noted that
“[d]eliberate indifference to serious medical needs presents
a cognizable claim” where “prison officials deny, delay, or
intentionally interfere with medical treatment.” Based on the
evidence presented by the defendants at summary judgment,
the court concluded that El-Shaddai’s allegations lacked merit
because the court could “not find any similarity between the
acts performed by the defendants in this case and those in
which courts have previously found Eighth Amendment
violations.” Because summary judgment was granted on
evidentiary grounds, rather than for frivolousness,
maliciousness, or failure to state a claim, Marshall I does not
count as a strike.

    In Wilkerson v. Smith, No. 94-CV-3962, 1996 WL
432324 (N.D. Cal. July 23, 1996) (Smith), El-Shaddai brought
two claims. He alleged again that prison officials denied him
sufficient access to the law library, and also alleged that
prison officials had retaliated against him for filing civil-
rights suits by “manipulating” his trust account. The district
court dismissed the law library claim and granted summary
judgment on the retaliation claim. Although the first claim
was nominally decided on a motion to dismiss, the substance
of the disposition shows that the district court actually
decided both claims based on the “facts presented in . . .
summary judgment papers,” and evidence beyond the
pleadings. As a result, we construe the full disposition as a
grant of summary judgment, which does not count as a strike.
See Richey, 807 F.3d at 1208.
16                  EL-SHADDAI V. WANG

IV.     Appellate Affirmance

   Another one of El-Shaddai’s potential strikes involved his
appeal of the dismissal of an action, in which we affirmed the
decision of the district court. We hold that where an appellate
decision simply affirms the district court, and does not
dismiss the appeal on a statutorily enumerated ground, the
appellate decision does not count as a separate strike.

    The PLRA defines a strike-worthy dismissal as an “action
or appeal in a court of the United States that was dismissed
on the grounds that it is frivolous, malicious, or fails to state
a claim upon which relief may be granted.” 28 U.S.C.
§ 1915(g) (emphasis added). As the D.C. Circuit noted in
Thompson, the statute “speaks only of dismissals, not
affirmances. The choice of the word ‘dismiss’ rather than
‘affirm’ in relation to appeals was unlikely an act of careless
draftsmanship.” 492 F.3d at 436. Again, the style of the
disposition is not determinative. Knapp v. Hogan, 738 F.3d
1106, 1109 (9th Cir. 2013) (“[T]he procedural mechanism or
Rule by which the [appellate] dismissal is accomplished,
while informative, is not dispositive.”). “To be sure, we can
easily imagine a case in which an appellate court expressly
states that an appeal was frivolous but erroneously styles its
disposition as an affirmance rather than as a dismissal.”
Thompson, 492 F.3d at 436. We agree with the D.C. Circuit
that “[a]ppellate affirmances do not count as strikes unless the
court expressly states that the appeal itself was frivolous,
malicious or failed to state a claim.” Id. at 440.

    This holding is consistent with the reasoning we adopted
in Knapp. In that case, we held that two dismissed appeals
counted as strikes “because they relied on district court
findings that the appeal ‘[was] not taken in good faith,’ and
                   EL-SHADDAI V. WANG                       17

lack of ‘good faith’ in this context has been held to be
equivalent to a finding of frivolity.” Knapp, 738 F.3d at 1110
(footnote and citations omitted). This strongly implies that
where the appellate disposition does not conclude that the
appeal itself is frivolous or malicious, it does not count as a
separate strike.

    Wilkerson v. Marshall, 53 F.3d 341 (9th Cir. 1995)
(unpublished table decision) (Marshall II) affirmed the
district court’s grant of summary judgment in Lawrence. We
directly reviewed the summary-judgment order on its merits,
looking to the substance of El-Shaddai’s claim that he was
unconstitutionally denied access to the law library. Id. The
decision does not state that the appeal itself was frivolous,
malicious, or failed to state a claim, and does not adopt any
certification of the district court that an appeal would be
brought in bad faith. Cf. Knapp, 738 F.3d at 1110. Marshall
II does not count as a strike.

V. Would-Be Habeas Petitions

    When a prisoner challenges the fact or duration of his
confinement, the sole federal remedy is a writ of habeas
corpus. Young v. Kenny, 907 F.2d 874, 875 (9th Cir. 1989).
When a habeas petition is dismissed, that disposition cannot
count as a strike under the PLRA because the “PLRA’s
revised [in] forma pauperis provisions relating to prisoners do
not apply to habeas proceedings.” Andrews, 398 F.3d at 1122
(alteration in original) (internal quotation marks omitted)
(quoting Naddi v. Hill, 106 F.3d 275, 277 (9th Cir. 1997)).
“[T]he language of § 1915(g) does not encompass habeas
petitions,” because “Congress intended § 1915(g) to address
civil rights and prison condition cases, not habeas petitions.”
Id.
18                 EL-SHADDAI V. WANG

    El-Shaddai filed two actions alleging that parole officials
were arbitrarily refusing to set his parole eligibility date. In
Wilkerson v. Gillis, No. 94-CV-3278, 1995 WL 84197 (N.D.
Cal. Feb. 21, 1995) (Gillis), El-Shaddai brought this claim
pursuant to 42 U.S.C. § 1983. The district court held that such
a suit challenged the duration of his confinement, and thus his
sole remedy was a habeas petition. The district court thus
dismissed the suit without prejudice, and indicated that El-
Shaddai could file his claim as a habeas petition after he had
exhausted all of his state remedies. In Wilkerson v. Nelson,
No. 95-CV-0248, 1995 WL 251147 (N.D. Cal. Apr. 25, 1995)
(Nelson), El-Shaddai brought the same claim as a petition for
a writ of mandamus to compel parole officials to promptly
“assign him a fixed primary term and parole release date.”
The district court similarly dismissed the petition, because the
remedy sought sounded in habeas.

    Although it is correct that El-Shaddai’s claims in Gillis
and Nelson were not cognizable under the form of suit that
El-Shaddai chose to use, they were both, in essence, habeas
claims. Our circuit’s case law directs district courts to
construe § 1983 claims challenging the fact or duration of the
plaintiff’s sentence as a petition for habeas corpus when the
“complaint evince[s] a clear intention to state a habeas
claim.” Trimble v. City of Santa Rosa, 49 F.3d 583, 586 (9th
Cir. 1995); see Tucker v. Carlson, 925 F.2d 330, 332 & n.2
(9th Cir. 1991). Had the district court in Gillis and Nelson
done so, it would have construed each case as a habeas
petition and dismissed them as premature because El-Shaddai
had not yet exhausted his state remedies. Such a dismissal
would not have counted as a strike. Andrews, 398 F.3d at
1122–23.
                    EL-SHADDAI V. WANG                        19

    Furthermore, we recognized in Andrews that we should
look to the substance of the dismissed lawsuit in order to
determine whether it can be counted as a “strike.” Id. at 1122
n.12. We recognized that “some habeas petitions may be little
more than 42 U.S.C. § 1983 actions mislabeled as habeas
petitions so as to avoid the penalties imposed by 28 U.S.C.
§ 1915(g).” Id. In that case, we held that it would be proper
for the district court to “determine that the dismissal of the
habeas petition does in fact count as a strike for purposes of
§ 1915(g).” Id. We recognize that the opposite can also be
true: a habeas petition can be mislabeled as a § 1983 claim
(either inadvertently, or as a strategy to avoid the significant
substantive hurdles of our habeas jurisprudence). In such a
case, it follows that the mislabeled habeas petition should be
considered such for purposes of the PLRA, and that it should
not count as a strike. Gillis was, in substance, a habeas
petition that the district court dismissed for failure to exhaust
state remedies, and does not constitute a strike.

    Nelson was likewise a mislabeled habeas petition. The
mandamus petition sought relief that could be obtained only
on habeas and, as in Gillis, the district court dismissed the
case without prejudice to allow El-Shaddai the opportunity to
exhaust his state remedies and then bring a habeas petition.
Unlike habeas petitions mislabeled as § 1983 claims,
however, our case law does not specifically indicate that
district courts should construe mislabeled mandamus
petitions as habeas petitions. But we need not decide that
issue to analyze the dismissal in Nelson, because the petition
for a writ of mandamus in Nelson is criminal, not civil, in
nature and is thus not the proper basis for a PLRA strike.

   In our concurrently-issued opinion Washington v. Los
Angeles County Sheriff’s Department, No. 13-56647 (9th Cir.
20                  EL-SHADDAI V. WANG

Aug. 12, 2016), we adopted a framework for determining
when a petition for writ of mandamus is civil or criminal in
nature for PLRA purposes. In Washington, we held that
mandamus, as a common-law writ that functions in some
respects like an appeal, is not categorically either civil or
criminal. Id. at 19–20. Instead, its characterization depends on
the nature of the underlying claim. A writ of mandamus
against a judge presiding in the petitioner’s civil prison
litigation, for instance, would function like a civil appeal and
could properly be counted as a strike under the PLRA. Id. at
19 (citing Martin v. United States, 96 F.3d 853, 854–55 (7th
Cir. 1996)). “A petition for mandamus in a criminal
proceeding,” however, “is not a form of [civil] prison
litigation,” Martin, 96 F.3d at 854, and would not be
susceptible to being counted as a strike. Here, Nelson directly
challenged El-Shaddai’s sentence and parole terms. As it
challenged the duration of his criminal sentence, it was like
a habeas petition and outside of the scope of the PLRA.
Nelson does not count as a strike.

                       CONCLUSION

    Of the eleven potential strikes that the district court could
have relied upon in denying El-Shaddai’s motion for
reconsideration, only one is a valid strike under the PLRA.
Therefore, we REVERSE the decision of the district court,
and REMAND for the district court to assess whether El-
Shaddai is otherwise entitled to proceed in forma pauperis.
