                 FOR PUBLICATION
 UNITED STATES COURT OF APPEALS
      FOR THE NINTH CIRCUIT

ANTOLIN ANDREWS,                      
               Plaintiff-Appellant,
UNITED STATES OF AMERICA,
                        Intervenor,         No. 02-17440
                v.                            D.C. No.
V. R. KING, Appeals Coordinator;           CV-01-02316-
                                             GEB(GGH)
S. CERVANTES; T. DICKINSON; ED
ALAMEDIA, Director of CDC;                    OPINION
MCPHERESON, Correctional Officer;
FIELDS, Lt.,
             Defendants-Appellees.
                                      
       Appeal from the United States District Court
          for the Eastern District of California
       Garland E. Burrell, District Judge, Presiding

                   Argued and Submitted
         July 13, 2004—San Francisco, California

                  Filed February 11, 2005

   Before: Ferdinand F. Fernandez, Richard A. Paez, and
           Johnnie B. Rawlinson, Circuit Judges.

                  Opinion by Judge Paez




                           1765
1768                  ANDREWS v. KING


                        COUNSEL

Rohit K. Singla, Munger, Tolles & Olson LLP, San Francisco,
California, for the plaintiff-appellant.

Maria G. Chan, Deputy Attorney General for the State of
Califonia, Sacramento, California, for the defendants-
appellees.

Barbara L. Herwig and Stephanie R. Marcus, Civil Division,
Department of Justice, Washington, D.C., for the intervenor.
                              ANDREWS v. KING                             1769
                                  OPINION

PAEZ, Circuit Judge:

   Appellant Antolin Andrews, an inmate in California State
Prison-Solano (“CSP-Solano”), filed a pro se complaint under
42 U.S.C. § 1983 challenging the way in which the prison
officials administered the process for resolving prisoner griev-
ances. After the district court granted Andrews’ motion to
proceed in forma pauperis (“IFP”), the defendants filed a
motion for summary judgment, arguing that Andrews was not
entitled to proceed IFP under the “three strikes” provision of
28 U.S.C. § 1915(g).1 The district court granted the defen-
dants’ motion and ultimately dismissed Andrews’ complaint
without prejudice, ruling that Andrews had failed to demon-
strate that he did not have three strikes under § 1915(g).

   Whether the burden of establishing the existence or nonex-
istence of three strikes rests with the defendant or with the
prisoner-plaintiff is an issue of first impression in this circuit.
We hold that when the defendant challenges a prisoner’s right
to proceed IFP, the defendant bears the burden of producing
  1
   Section 1915(g) was enacted as part of the 1996 Amendments to the
Prison Litigation Reform Act, Pub. L. No. 104-134, 110 Stat. 1321,
§ 804(d) (“PLRA”) and provides that:
      In no event shall a prisoner bring a civil action or appeal . . .
      under this section if the prisoner has, on 3 or more 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.
This subdivision is commonly known as the “three strikes” provision.
“Strikes” are prior cases or appeals, brought while the plaintiff was a pris-
oner, which were dismissed “on the ground that [they were] frivolous,
malicious, or fail[ ] to state a claim” are generically referred to as
“strikes.” Pursuant to § 1915(g), a prisoner with three strikes or more can-
not proceed IFP.
1770                       ANDREWS v. KING
sufficient evidence to establish that § 1915(g) bars the plain-
tiff’s IFP status. Once the defendant has made out a prima
facie case, the burden shifts to the plaintiff to persuade the
court that § 1915(g) does not apply. Because here the defen-
dants did not meet their initial burden, we reverse the district
court’s dismissal of Andrews’ complaint and remand for fur-
ther proceedings.

                I.   Facts and Procedural History

   Andrews is a state inmate incarcerated in CSP-Solano.
Seeking damages and injunctive relief, Andrews filed a pro se
civil rights action under 42 U.S.C. § 1983 against the defen-
dants V.R. King, S. Cervantes, T. Dickinson and Lt.
McPhereson, prison officials at CSP-Solano, and Ed
Alamedia, the Director of the California Department of Cor-
rections (collectively “the State defendants”). Andrews
alleged that the State defendants administer the prisoner
grievance administrative process at CSP-Solano to effectively
deny prisoners access to the federal courts by making it “al-
most impossible” to exhaust the prison’s administrative reme-
dies.2 The district court initially granted Andrews’ request to
proceed IFP.

   The State defendants did not respond to Andrews’ com-
plaint. Instead, they filed a motion for summary judgment
under Fed. R. Civ. P. 56(d). In their motion, the State defen-
dants argued that Andrews had acquired three strikes and, as
proof of the existence of those strikes, they attached records
from the federal courts’ Public Access to Court Electronic
Records (“PACER”) system showing the docket records for
twenty-two actions in which Andrews was the plaintiff and
the cases had been dismissed. The State defendants also
attached an order from the Superior Court of Los Angeles
County that deemed Andrews a vexatious litigant. The State
  2
   The PLRA requires that prisoners exhaust prison administrative reme-
dies before bringing an action in federal court. See 42 U.S.C. § 1997e(a).
                            ANDREWS v. KING                           1771
defendants did not provide the district court with copies of the
underlying dismissal orders or present any other evidence
regarding the reasons for the dismissals.

   Andrews opposed the motion, stating that he had not filed
three or more actions that were frivolous, malicious or that
failed to state a claim within the meaning of 28 U.S.C.
§ 1915(g). He further argued that the PACER records attached
to the State defendants’ motion were insufficient to establish
the “three strikes” necessary to deny him IFP status under
§ 1915(g).

   The Magistrate Judge issued an Order and Findings and
Recommendations recommending that the district court grant
the State defendants’ motion for summary judgment. The
Findings and Recommendations determined that plaintiffs
bear the burden of proving their qualification for IFP status.
The Magistrate Judge found that plaintiffs bear the initial pro-
duction burden, stating: “it is up to plaintiffs to describe their
previous litigations against different defendants; present
defendants should not have to perform this research.” The
Findings and Recommendations also determined that it was
Andrews’ burden to negate the defendants’ “prima facie
showing that the number of federal suits filed disqualified
[him] from proceeding IFP.” Thus, the Magistrate Judge rec-
ommended that because Andrews had failed to rebut the State
defendants’ showing regarding his litigation history, he was
not entitled to proceed IFP in filing his 42 U.S.C. § 1983
action.

   The Magistrate Judge then reasoned that even if the burden
were not on Andrews to prove that he had fewer than three
strikes, “the record shows sufficient strikes to warrant
IFP disqualification.”3 The Magistrate Judge concluded, how-
  3
   The Magistrate Judge counted the following five cases as strikes: (1)
an appeal that was dismissed for lack of jurisdiction (Andrews v. Croker,
No. 98-55330 (9th Cir.)); (2) a case that was dismissed for failure to state
1772                       ANDREWS v. KING
ever, that dismissed habeas petitions do not constitute strikes
under 28 U.S.C. § 1915(g). Nonetheless, the Magistrate Judge
determined that Andrews had at least three dismissals that
constituted strikes within the meaning of § 1915(g), and rec-
ommended that Andrews’ case be dismissed without preju-
dice.

   Andrews filed objections to the Magistrate Judge’s Find-
ings and Recommendations in which he argued that, under the
plain text of the statute, only cases dismissed as frivolous or
malicious or for failure to state a claim count as strikes and
that the State defendants had not met their burden of showing
that he had three or more such strikes. The State defendants
also filed objections to the Findings and Recommendations, in
which they objected to the recommendation that petitions for
writs of habeas corpus do not count as “strikes” for purposes
of § 1915(g).

  The district court adopted the Magistrate Judge’s Findings
and Recommendations in full and dismissed Andrews’ action
without prejudice. This appeal followed.

                           II.   Jurisdiction

   The State defendants initially contend that we lack jurisdic-
tion to review the district court’s order dismissing Andrews’
action without prejudice “because this is a matter in abate-
ment” under 28 U.S.C. § 2105.4 The State defendants argue

a claim (Rudder v. Vargas & Associates, No. 94-CV-67 (D.C. Cir.)); (3)
a case that was dismissed without leave to amend (Rudder v. Revitz, 93-
CV-2778 (C.D. Cal.); and (4) two other district court cases that had been
dismissed with prejudice (Rudder v. Dep’t of Justice, No. 93-CV-1913
(C.D. Cal.) and Andrews v. Croker, No. 97-CV-5333 (C.D. Cal.)).
   4
     “One of the most commonly ignored provisions of the Judicial Code,”
15 C. Wright, A. Miller & E. Cooper, Federal Practice and Procedure
§ 3903, at 139 (1992), 28 U.S.C. § 2105 provides that: “There shall be no
reversal in the Supreme Court or court of appeals for error in ruling upon
matters in abatement which do not involve jurisdiction.”
                          ANDREWS v. KING                         1773
that the revocation of Andrews’ IFP status does not address
the merits of his claims under 42 U.S.C. § 1983 and therefore,
it “fits within the definition of a ‘matter in abatement.’ ”5

   We disagree. Although the defendants styled their com-
plaint as one for summary judgment under Rule 56(d), they
are in fact seeking to vacate the district court’s order permit-
ting Andrews to proceed IFP. The denial of a motion to pro-
ceed IFP is appealable as a final judgment under 28 U.S.C.
§ 1291. See Roberts v. United States Dist. Ct. for the N. Dist.,
339 U.S. 844, 845 (1950) (“The denial by a district judge of
a motion to proceed in forma pauperis is an appealable
order.”); Lipscomb v. U.S., 301 F.2d 905, 905 (9th Cir. 1962)
(“An order denying leave to proceed in the district court in
forma pauperis is appealable.”).

   Moreover, even if we considered the defendants’ motion as
one for summary judgment, this is not a “matter in abate-
ment” because our review of the dismissal of a prisoner’s
claim on the ground that he should not proceed IFP involves
a decision on the merits. That is, Andrews would not other-
wise have the opportunity to address whether any of the prior
cases constitute a “strike” under § 1915(g) or to correct the
district court’s allegedly erroneous denial of IFP status.

   Accordingly, we reject the State’s challenge to our jurisdic-
tion and hold that we have jurisdiction to review the district
court order dismissing Andrews’ case.

      III.   Defendants’ Motion for Summary Judgment

   Andrews challenges the district court’s determination that
because he had acquired three strikes within the meaning of
§ 1915(g) he could not proceed IFP. We review “de novo a
  5
   A “matter in abatement” is “the suspension or defeat of an action for
a reason unrelated to the merits of the claim.” Black’s Law Dictionary 3
(8th ed. 2004).
1774                          ANDREWS v. KING
grant of summary judgment and must determine whether,
viewing the evidence in the light most favorable to the non-
moving party, there are any genuine issues of material fact
and whether the district court correctly applied the relevant
substantive law.” Lopez v. Smith, 203 F.3d 1122, 1131 (9th
Cir. 2000) (en banc) (citation omitted).6 The district court’s
interpretation and application of § 1915(g) is also subject to
de novo review. See Tierney v. Kupers, 128 F.3d 1310, 1311
(9th Cir. 1997).

            A.    Burdens of Production and Persuasion

   To determine whether the district court erred in dismissing
Andrews’ complaint, we must address whether Andrews or
the State defendants bore the burden of production to show
that Andrews was not entitled to proceed IFP under the
PLRA’s three strikes provision.

   [1] Although we have not previously addressed this particu-
lar provision of the PLRA, we addressed a similar question in
the context of the PLRA’s exhaustion requirement. See 42
U.S.C. § 1997e(a).7 In Wyatt v. Terhune, we concluded that
  6
     Although the State defendants styled their motion as a motion for sum-
mary judgment under Rule 56(d), it was effectively a motion to vacate the
order allowing Andrews to proceed IFP because he was precluded from
doing so under § 1915(g). Because Andrews did not dispute the fact that
he had filed at least twenty-two lawsuits that had been dismissed and that
he had been declared a vexatious litigant, what is at stake here are the
legal consequences that flow from these undisputed facts. Thus, whether
we treat the State defendants’ motion under Rule 56(d) or a motion to
vacate makes little difference. In either circumstance, we review de novo
the district court’s interpretation of § 1915(g) and related legal conclu-
sions. See Balint v. Carson City, Nev., 180 F.3d 1047, 1050 (9th Cir.
1999); Jeff D. v. Kempthorne, 365 F.3d 844, 850-51 (9th Cir. 2004).
   7
     Section 1997e(a) of the PLRA states:
      No action shall be brought with respect to prison conditions
      under section 1983 of this title, or any other Federal law, by a
      prisoner confined in any jail, prison, or other correctional facility
      until such administrative remedies as are available are exhausted.
42 U.S.C. § 1997e(a).
                            ANDREWS v. KING                             1775
the PLRA’s exhaustion requirement creates an affirmative
defense that must be raised and proved by the defendant. See
315 F.3d 1108, 1117-18 (9th Cir. 2003). In so deciding, we
reasoned that we would not impose a heightened pleading
requirement where Congress had not expressly instructed us
to do so. See id. at 1118 (citing Swierkiewicz v. Sorema, 534
U.S. 506 (2002)). Moreover, we recognized that imposing
such a requirement on prisoners “would be contrary to the lib-
eral approach we take to pleadings by pro se prisoners” and
also unrealistic, given that “prison officials are likely to have
greater legal expertise and, as important, superior access to
prison administrative records in comparison to prisoners.” Id.
at 1119.

   [2] We find that our decision in Wyatt provides a helpful
paradigm for deciding which party has the burden of estab-
lishing the existence or nonexistence of three strikes under 28
U.S.C. § 1915(g). First, as in Wyatt, we do not discern in the
relevant statute an express congressional intent to place the
initial burden on the prisoner-plantiff. See Wyatt, 315 F.3d at
1118. Indeed, § 1915 explicitly details the requirements for
prisoners applying to proceed IFP, see § 1915(a)(1) & (2),
and although prisoners must demonstrate that they are not
able to pay the filing fee with an affidavit and submission of
their prison trust account records, see id., Congress did not
require prisoners to declare that § 1915(g) does not bar their
request to proceed IFP.8 Had Congress intended to require
  8
   Indeed, such a requirement would be difficult, if not impossible, to
meet, given that, in dismissing a prisoner’s action, the district court is not
required to determine whether the prisoner’s case is frivolous, malicious
or fails to state a claim and therefore will count as a future strike under
§ 1915(g). See e.g., Rodriguez v. Cook, 169 F.3d 1176, 1178 (9th Cir.
1999); DeLeon v. Doe, 361 F.3d 93, 95 (2d Cir. 2004); Wilson v. Yaklich,
148 F.3d 596, 602-03 (6th Cir. 1998); Patton v. Jefferson Corr. Cir., 136
F.3d 458, 461 (5th Cir. 1998); Lucien v. Jockish, 133 F.3d 464, 469 n.8
(7th Cir. 1998). Because district courts do “not issue these strikes one by
one, in their orders of judgment,” DeLeon, 361 F.3d at 95, most prisoners
would not be able to determine whether they have accumulated any strikes
within the meaning of § 1915(g) prior to filing an application to proceed
IFP.
1776                        ANDREWS v. KING
prisoners to affirmatively show that they were not subject to
the three strikes provision, we have no doubt that it would
have included that requirement in the list of requirements
prisoners must address in order to obtain IFP status. See
Wyatt, 315 F.3d at 1118 (“Legislatures know how to indicate
. . . a pleading requirement when they want to.”).

   [3] Moreover, we agree with Andrews that here, as in
Wyatt, considerations of policy and fairness militate in favor
of imposing the burden on the State defendants to produce
evidence to demonstrate that the prisoner should be denied
IFP status because he had three strikes under § 1915(g). Here,
Andrews alleged that, as a prisoner, he cannot maintain files
for each lawsuit that he has previously brought.9 Andrews also
stated that he does not have access to PACER nor can he visit
clerks’ offices to obtain relevant orders. Moreover, because he
is indigent, Andrews cannot order the relevant documents
directly from the court or pay a third-party, such as a court fil-
ing service, to obtain the records for him. The State defen-
dants do not dispute these facts. The State defendants, on the
other hand, have greater access to prison administrative
records, court documents and a host of knowledgeable attor-
neys who have represented the state prison officials in law-
suits brought by state prisoners. See Wyatt, 315 F.3d at 1119.

   [4] Therefore, we hold that if defendants challenge a
prisoner-plaintiff’s IFP status, then the initial production bur-
den rests with the defendants. Thus, when challenging a pris-
oner’s IFP status, the defendants must produce documentary
evidence that allows the district court to conclude that the
plaintiff has filed at least three prior actions that were dis-
missed because they were “frivolous, malicious or fail[ed] to
state a claim.” § 1915(g). In some instances, the district court
  9
    In his current facility, Andrews represents that he is permitted only six
cubic feet of possessions—and that this is not enough space to maintain
comprehensive files. The State defendants do not challenge this represen-
tation.
                       ANDREWS v. KING                      1777
docket records may be sufficient to show that a prior dis-
missal satisfies at least one of the criteria under § 1915(g) and
therefore counts as a strike. However, in many instances, the
docket records will not reflect the basis for the dismissal. In
these instances, the defendants may not simply rest on the fact
of dismissal. Rather, the defendants must produce court
records or other documentation that will allow the district
court to determine that a prior case was dismissed because it
was “frivolous, malicious or fail[ed] to state a claim.”
§ 1915(g).

   [5] Once the defendants have met this initial burden, the
burden then shifts to the prisoner, who must attempt to rebut
the defendants’ showing by explaining why a prior dismissal
should not count as a strike. We agree with the approach
taken by our sister circuit in Evans v. Ill. Dep’t of Corrs., 150
F.3d 810, 811-12 (7th Cir. 1998). In Evans, the Seventh Cir-
cuit found that by identifying three specific examples of
potential strikes, the district court put the plaintiff on notice
as to what it had considered in denying his request to proceed
IFP. Id. The burden of persuasion then shifted to the plaintiff
to show that prior dismissals did not qualify as strikes. In
sum, once a prisoner has been placed on notice of the poten-
tial disqualification under § 1915(g) by either the district
court or the defendant, the prisoner bears the ultimate burden
of persuading the court that § 1915(g) does not preclude IFP
status.

   [6] Because the district court incorrectly determined that
Andrews bore the initial burden of producing evidence to
show that he was not disqualified under § 1915(g), and
because we find that the State defendants did not present suf-
ficient evidence regarding the prior dismissals to establish a
prima facie case of IFP disqualification under § 1915(g), we
vacate the judgment and remand for further proceedings.

               B.   The Meaning of a “Strike”

  To provide guidance to the district court on remand, we
address the district court’s interpretation of a “strike” under
1778                   ANDREWS v. KING
§ 1915(g). Section 1915(g) states that a prisoner may not pro-
ceed IFP “if the prisoner has, on three or more prior occa-
sions, 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 was frivolous, malicious or
fails to state a claim upon which relief could be granted.”
§ 1915(g).

   In applying § 1915(g) to disqualify Andrews from proceed-
ing IFP, the district court gave an expansive interpretation of
the clause “frivolous, malicious or fails] to state a claim.”
Thus, for example, without determining that the case was friv-
olous, malicious or failed to state a claim, the district court
nonetheless determined that the Ninth Circuit’s dismissal of
an appeal for lack of jurisdiction constituted a strike under
§ 1915(g). We disagree with this approach.

   The PLRA does not define the terms “frivolous,” or “mali-
cious,” nor does it define dismissals for failure to “state a
claim upon which relief could be granted.” We have held that
the phrase “fails to state a claim on which relief may be grant-
ed,” as used elsewhere in § 1915, “parallels the language of
Federal Rule of Civil Procedure 12(b)(6).” See Barren v. Har-
rington, 152 F.3d 1193, 1194 (9th Cir. 1998) (interpreting
§ 1915(e)(2)(B)(ii) and employing the same de novo standard
of review applied to Rule 12(b)(6) motions). Yet there is no
Ninth Circuit case law on the 1996 Amendments to the PLRA
that explains precisely what the terms “frivolous” or “mali-
cious” mean. In defining these terms, we look to their “ordi-
nary, contemporary, common meaning.” Wilderness Soc’y v.
United States Fish & Wildlife Serv., 353 F.3d 1051, 1060 (9th
Cir. 2003) (en banc) (internal quotation marks and citations
omitted). Thus, a case is frivolous if it is “of little weight or
importance: having no basis in law or fact.” Webster’s Third
New International Dictionary 913 (1993); see also Goland v.
United States, 903 F.2d 1247, 1258 (9th Cir. 1990) (adopting
a definition of “frivolous”). A case is malicious if it was filed
                        ANDREWS v. KING                      1779
with the “intention or desire to harm another.” Webster’s
Third New International Dictionary 1367 (1993).

   Not all unsuccessful cases qualify as a strike under
§ 1915(g). Rather, § 1915(g) should be used to deny a prison-
er’s IFP status only when, after careful evaluation of the order
dismissing an action, and other relevant information, the dis-
trict court determines that the action was dismissed because
it was frivolous, malicious or failed to state a claim.

   Here, the State defendants attempted to meet their burden
of production by pointing to the fact that Andrews had filed
at least twenty-two prior cases that had been dismissed. This
was insufficient to shift the burden to Andrews. Although the
Magistrate Judge, relying on the PACER docket records,
identified prior cases that potentially qualified as strikes under
§ 1915(g), only one case plainly qualified as a strike because
the docket record showed that it was dismissed for failure to
state a claim under Rule 12(b)(6). As for the four other cases,
the Magistrate Judge determined that each one counted as a
strike without considering the underlying court orders or mak-
ing an independent assessment of whether the prior cases
were frivolous or malicious or failed to state a claim.

   [7] We hold that, under the plain language of § 1915(g), the
prior dismissals would qualify as strikes only if, after review-
ing the orders dismissing those actions and other relevant
information, the district court determined that they had been
dismissed because they were frivolous, malicious or failed to
state a claim. See § 1915(g). Under the circumstances, we
must remand this case to the district court so it can make the
necessary determinations on the basis of a more complete fac-
tual record.

           C.   Dismissals While in INS Detention

  [8] Andrews argues that he was not a “prisoner” for the
purposes of 28 U.S.C. § 1915(g) when he filed three of the
1780                     ANDREWS v. KING
actions that the district court counted as strikes.10 We hold that
dismissals of actions brought while a plaintiff was in the cus-
tody of the INS do not count as “strikes” within the meaning
of § 1915(g), so long as the detainee did not also face criminal
charges. See Agyeman v. INS, 296 F. 3d 871, 885-86 (9th Cir.
2002).

   [9] The language of § 1915(g) does not limit the type of
facility in which a plaintiff must be detained when the prior
actions were filed. It states that a prisoner may not proceed
IFP if the three dismissed actions were filed while the pris-
oner was “incarcerated or detained in any facility.” § 1915(g).
Yet the scope of § 1915 is narrowed to plaintiffs who are in
custody as the result of a conviction or who have been
detained for an alleged criminal law violation:

       As used in this section, the term “prisoner” means
       any person incarcerated or detained in any facility
       who is accused of, convicted of, sentenced for, or
       adjudicated delinquent for, violations of criminal law
       or the terms and conditions of parole, probation, pre-
       trial release or diversionary program.

§ 1915(h). Thus, a civil detainee is not a “prisoner” within the
meaning of the PLRA. Agyeman, 296 F.3d at 886; Page v.
Torrey, 201 F.3d 1136, 1139-40 (9th Cir. 2000) (holding that
§ 1915 “requirements apply only to ‘prisoners.’ . . . currently
detained as a result of accusation, conviction, or sentence for
a criminal offense.”) (citations omitted).

  [10] In Agyeman, we held that an INS detainee who does
not also face criminal charges is not a prisoner under § 1915.
296 F.3d at 886; see also LaFontant v. INS, 135 F.3d 158, 165
(D.C. Cir. 1998) (same); Ojo v. INS, 106 F.3d 680, 682 (5th
  10
    Andrews refers to Rudder v. Vargas & Associates, No. 94-CV-67
(D.C. Cir.); Rudder v. Revitz, 93-CV-2778 (C.D. Cal.); and Rudder v.
Dep’t of Justice, No. 93-CV-1913 (C.D. Cal.).
                           ANDREWS v. KING                           1781
Cir. 1997) (same). Thus, if Andrews was not detained pursu-
ant to “an accusation, conviction or sentence for a criminal
offense” while in INS custody, he was a civil detainee and not
subject to the PLRA’s provisions. Under such circumstances,
the dismissal of a case that Andrews filed while he was in the
custody of the INS would not count as a strike for the pur-
poses of § 1915(g).11 On remand, Andrews bears the burden
of establishing that he was in INS custody and that he was not
facing criminal charges at the time he filed the actions.

               D.    Dismissals of Habeas Petitions

   [11] Finally, we agree with the district court that dismissed
habeas petitions do not count as strikes under § 1915(g).12 We
previously have held that the “PLRA’s revised [in] forma
pauperis provisions relating to prisoners do not apply to
habeas proceedings.” Naddi v. Hill, 106 F.3d 275, 277 (9th
Cir. 1997). In Naddi, we reasoned that the language of
§ 1915(g) does not encompass habeas petitions and also that
Congress intended § 1915(g) to address civil rights and prison
condition cases, not habeas petitions. See id. See also Jen-
nings v. Natrona County Det. Ctr. Med. Facility, 175 F.3d
775, 779 (10th Cir. 1999) (holding that the “district court
erred when it counted . . . prior habeas corpus action as a
strike under § 1915(g)”); In re Nagy, 89 F.3d 115, 117 (2d
  11
      This interpretation comports with Congress’s purpose in enacting the
PLRA to prevent frivolous prison condition lawsuits filed by criminals.
See generally, Joshua D. Franklin, Comment, Three Strikes and You’re
Out of Constitutional Rights? The Prison Litigation Reform Act’s “Three
Strikes” Provision and Its Effect on Indigents, 71 U. COLO. L. REV. 191
(2000); Brian J. Ostrom, Roger A. Hansen, and Fred L. Cheesman, Con-
gress, Courts and Corrections: An Empirical Perspective on the Prison
Litigation Reform Act, 78 NOTRE DAME L. REV. 1525 (2003).
   12
      We recognize, however, 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). In such cases, the dis-
trict court may determine that the dismissal of the habeas petition does in
fact count as a strike for purposes of § 1915(g).
1782                    ANDREWS v. KING
Cir. 1996) (holding that the application of the PLRA to man-
damus petitions depends on the nature of the relief sought—
only if the prisoner’s mandamus claim is analogous to the typ-
ical suits brought under 42 U.S.C. § 1983 complaining about
prison conditions does the PLRA apply).

                E.   Constitutional Challenges

   Andrews also argues that § 1915(g) is unconstitutional on
its face and as applied to him. We previously have held that
§ 1915(g) is not facially unconstitutional. Rodriguez v. Cook,
169 F.3d 1176, 1181 (9th Cir. 1999). In Rodriguez, we found
that deterring frivolous lawsuits is rationally related to a legit-
imate government interest and therefore does not violate the
Equal Protection Clause of the Fourteenth Amendment. Id. at
1180-81. We explained that “[b]udgetary concerns are a legit-
imate governmental interest and curbing the costs of defend-
ing against frivolous litigation is rationally related to
maintaining the budget.” Id. Although we recognize that seri-
ous constitutional concerns would arise if § 1915(g) were
applied to preclude those prisoners who had filed actions that
were not “frivolous, malicious or fail[ed] to state a claim”
from proceeding IFP, we do not decide Andrews’ as-applied
challenge because we can resolve this case on narrower
grounds.

   Accordingly, we vacate the dismissal and remand for fur-
ther proceedings consistent with this opinion.

  VACATED AND REMANDED.
