#### Jimmy Lee BILLS, Petitioner-Appellant, v. Ken CLARK, Warden, Respondent-Appellee.

No. 08-17517.

United States Court of Appeals, Ninth Circuit.

Argued and Submitted June 17, 2010.

Filed Dec. 8, 2010.

*1093Marylou Hillberg, Sebastopol, CA, for the petitioner-appellant.

Robert Gezi, Deputy Attorney General, Edmund G. Brown, Jr., Attorney General of California, Michael P. Farrell, Senior Assistant Attorney General, and Julie A. Hokans, Supervising Deputy Attorney General, Office of the California Attorney General, Sacramento, CA, for the respondent-appellee.

Before: MICHAEL DALY HAWKINS and RAYMOND C. FISHER, and TIMOTHY M. TYMKOVICH, Circuit Judges.*

*

 The Honorable Timothy M. Tymkovich, United States Circuit Judge for the Tenth Circuit, sitting by designation.

OPINION

TYMKOVICH, Circuit Judge:

This case requires us to consider when a petitioner’s mental condition may constitute an extraordinary circumstance justifying equitable tolling of the untimely filing of a habeas petition. We conclude equitable tolling is permissible when a petitioner can show a mental impairment so severe that the petitioner was unable personally either to understand the need to timely file or prepare a habeas petition, and that impairment made it impossible under the totality of the circumstances to meet the filing deadline despite petitioner’s diligence.

The petitioner in this case is Jimmy Lee Bills, a California state prisoner. Bills filed his habeas petition outside of the one-year limitations period contained in the Antiterrorism and Effective Death Penalty Act of 1996 § 101, 28 U.S.C. § 2244 (2006) (AEDPA), but argues he is entitled to equitable tolling due to his low IQ and writing deficiencies during the limitations period. The district court found Bills’s mental deficiencies were not so severe as to constitute an extraordinary circumstance that prevented him from filing his petition on time.

Because we conclude the district court should in the first instance review Bills’s claims under the legal standard we discuss below, we REVERSE the dismissal of Bills’s habeas petition and REMAND the case for application of the facts to the correct standard.

*1094I. Background

While serving time in California state prison on other charges, Bills was convicted of possession of a sharp instrument by a state prisoner and sentenced to 25 years to life in prison. He proceeded with a direct appeal through the California appellate courts. The California Supreme Court denied review on October 29, 2003. Bills’s state court judgment became final 90 days later, on January 28, 2004, when the time expired for an appeal to the United States Supreme Court. Under AED-PA, Bills had one year from that date to file a federal habeas petition. *See*28 U.S.C. § 2244(d)(1)(A) (2006).

On November 15, 2004, during the one-year AEDPA limitations period, Bills filed a state habeas petition. The filing of this petition tolled the limitations period. His state petition was denied on October 12, 2005. At that time, the AEDPA limitations period began to run again, expiring on December 25, 2005. Bills filed a pro se federal habeas petition neaziy 10 months later, on October 10, 2006.

In his federal habeas petition, Bills alleges various trial errors and ineffective assistance of counsel. The district court appointed counsel for Bills “[i]n light of the length of petitioner’s sentence.... ” Because the petition was untimely filed, Bills’s counsel urged the district court to equitably toll the AEDPA limitations period “due to his inability to read and write, his neurological deficits, borderline to mildly retarded level of intelligence, concurrent psychosis and lack of assistazzce available to him.”

The magistrate judge ordered an evidentiary hearing concerning Bills’s mental capacity and his right to equitable tolling. At the hearing, Bills submitted evidence in support of his tolling claim, and both Bills and a mental health expert testified.

*A. Evidentiary Hearing*

Bills testified he did not write his federal habeas petition, instead relying on another prisoner for assistance. But Bills acknowledged that while in jail he prepared a number of administrative and judicial filings, including a pro se federal habeas petition in 2000, an administrative complaint regarding medical care in 2001, a 42 U.S.C. § 1983 complaint in 2001, and the state habeas petition that preceded this action in 2004. Bills also represented himself pro se during the prisoner in possession of a sharp instrument trial — including examining witnesses and making opening and closing arguments. Nonetheless, Bills testified he had difficulty understanding some of the language used in his trial court briefs.

An expert witness, clinical psychologist Dr. John S. Miller, attested to Bills’s capabilities both by affidavit and at the hearing. Miller’s affidavit reflected his observations and testing of Bills while in prison and an examination of related medical documents. In summary, the affidavit states Bills’s “thoughts were linear and his associations wez'e logical.” Although “[tjhere was no overt evidence of hallucinations or delusions,” Bills told Miller he suffered from them constantly. Additionally, Miller found Bills “was not able to name the current president, was not able to subtract serial 7s or 3s, and was not able to spell the word ‘world’ ” forwards or backwards. Miller surveyed Bills’s mental health file, which showed a history of substance abuse and behavioral disorders, for which he was prescribed a variety of medications.

Miller also reported on several cognition tests he performed. An intelligence scale test showed Bills was in the lowest percentile for verbal IQ, verbal comprehension, and working memory. On other tests, Bills fared better. He tested borderline and low average for memory, and prison-*1095administered tests showed him to have normal cognitive functioning. In the end, Miller diagnosed Bills as bipolar with a variety of behavioral and cognitive disorders, and concluded Bills “could [not] understand his legal rights sufficiently to make rational choices with respect to acting upon them.”

At the evidentiary hearing, Miller was the only witness other than Bills who testified. His direct examination generally confirmed the observations set forth in his affidavit. But on cross-examination, Miller agreed that “central features” of one of Bills’s personality disorders was “deceit and manipulation,” and it was “typified by ... disregard for the law.” Miller also testified a set of Bills’s test results had to be discarded because Bills “exaggerated his symptoms,” although on redirect Miller contended “[i]t’s easy to exaggerate, but it’s easy to be caught.”

When asked whether Bills had the “reasonable degree of rational understanding” needed to consult with an attorney, Miller responded, “Well, it’s just I can’t, again, talk in absolutes. It’s not that there was a total absence of reason and logic, and it’s not that there was an abundance of it, and he would be closer to the absence of it than the abundance of it on the continuum.” Later, Miller testified that in his opinion Bills was incapable of the inferential thinking necessary to complete a federal habeas form. Miller was unable to say for certain whether the cognitive functioning he observed was present during the AEDPA limitations period. Although he said the records showed Bills’s abilities “stayed in the same ballpark,” he also conceded there may have been “quite a bit of fluctuation.”

Bills also presented two psychological evaluations performed on him in late 2000 while in prison. The first was performed by Dr. Shawn Adair Johnston, a psychologist the California superior court appointed to evaluate whether Bills was competent to stand trial for the prisoner in possession of a sharp instrument charge. Many of Johnston’s observations were consistent with those of Miller: Bills had a below average or borderline intellectual functioning, he described an abusive childhood, and he said he heard voices. But Johnston concluded Bills was competent to stand trial because “[h]e obviously understands both the nature of the charges and proceedings being taken against him and is ... capable of working with his attorney in preparing a rational defense in his case.”

Dr. John Alan Foster performed the second psychological evaluation. Foster concluded Bills had a low average to borderline intellectual ability. Bills told Foster about auditory hallucinations, and Bills’s medical record showed he was prescribed a variety of medications for bipolar and psychotic disorders. In the end, like Johnston, Foster believed Bills was competent to stand trial.

*B. Magistrate Judge’s Recommendation*

Based on the testimony and affidavits presented, the magistrate judge recommended the district court deny equitable tolling. The magistrate judge concluded that Bills’s repeated legal filings and his pro se representation in the state trial showed he was competent during the AEDPA limitations period. In addition, the discrepancies between the psychologists’ submissions and testimony and Bills’s demeanor when testifying at the hearing cut in favor of finding Bills competent. The magistrate judge observed, “petitioner on occasion appeared to undermine his own credibility in his effort to convince the court of his deficiencies.” Finding that Bills failed to establish he “was unable by reason of mental defect to understand his *1096need to timely file a habeas petition and unable to take steps to effectuate that filing” (citing *Dusky v. United States,*362 U.S. 402, 80 S.Ct. 788, 4 L.Ed.2d 824 (1960) (per curiam)), the magistrate judge rejected equitable tolling.

The district eourt adopted the magistrate judge’s findings and recommendations in full. We granted a certificate of appealability (COA) on whether the district court applied the correct legal standard in denying equitable tolling.1

II. Analysis

Bills makes two arguments on appeal. First, he argues the district court identified and applied the incorrect legal standard for equitable tolling due to mental deficiencies. Second, Bills challenges the district court’s conclusion that his mental condition was not so severe as to prevent him from filing a timely petition.

“The dismissal of a petition for writ of habeas corpus as time-barred is reviewed de novo. If the facts underlying a claim for equitable tolling are undisputed, the question of whether the statute of limitations should be equitably tolled is also reviewed de novo. Otherwise, findings of fact made by the district eourt are to be reviewed for clear error.” *Spitsyn v. Moore,*345 F.3d 796, 799 (9th Cir.2003). We review the district court’s finding of competency for clear error. *See Comer v. Schriro,*480 F.3d 960, 962 (9th Cir.2007) (en banc) (per curiam).

Before addressing Bills’s arguments, we begin with some background principles that apply to equitable tolling.

*A. Equitable Tolling*

AEDPA commands that a “1-year period of limitation shall apply to an application for a writ of habeas corpus by a person in custody pursuant to the judgment of a State court.” 28 U.S.C. § 2244(d)(1) (2006). When can that limitation period be tolled for circumstances beyond a prisoner’s control?

Just this year, the Supreme Court joined the eleven circuit courts that have considered the question in holding the one-year statute of limitations for filing a habeas petition may be equitably tolled if extraordinary circumstances beyond a prisoner’s control prevent the prisoner from filing on time. *See Holland v. Florida,*560 U.S. -, -, -, 130 S.Ct. 2549, 2554, 2562, 177 L.Ed.2d 130 (2010). In *Holland,*the Court recognized equitable tolling of the AEDPA one-year limitations period when the prisoner can show “(1) that he has been pm-suing his rights diligently, and (2) that some extraordinary circumstance stood in his way.” *Id.*at 2562 (quoting *Pace v. DiGuglielmo,*544 U.S. 408, 418, 125 S.Ct. 1807, 161 L.Ed.2d 669 (2005)). The diligence that is required is “reasonable diligence.” *Id.*at 2565. While eschewing a “mechanical rule” for determining extraordinary circumstances, the Court pointed to a “flexibl[e],” “case-by-case” approach, drawing “upon decisions made in other similar cases for guid*1097anee.” *Id.*at 2563. We should “exercise judgment in light of prior precedent, but with awareness of the fact that specific circumstances, often hard to predict in advance, could warrant special treatment in an appropriate case.” *Id.*

We have long recognized a general rule that equitable tolling is available where the prisoner can show extraordinary circumstances were the cause of an untimely filing. *See, e.g., Calderon v. U.S. Dist. Court,*128 F.3d 1283, 1289 (9th Cir.1997), overruled on other grounds en banc by 163 F.3d 530 (recognizing equitable tolling applies to AEDPA); *Spitsyn,*345 F.3d at 799. Under our cases, equitable tolling is available for this reason only when “ ‘extraordinary circumstances beyond a prisoner’s control make it *impossible*to file a petition on time’ ” and “ ‘the extraordinary circumstances’ were the *cause*of [the prisoner’s] untimeliness.” *Id.*(emphasis added). We have also stressed that “equitable tolling is ‘unavailable in most cases’.... Indeed, ‘the threshold necessary to trigger equitable tolling [under AEDPA] is very high, lest the exceptions swallow the rule.’ ” *Miranda v. Castro,*292 F.3d 1063, 1066 (9th Cir.2002). And we have long-cautioned that “[e]quitable tolling determinations are ‘highly fact-dependent,’ ” *Mendoza v. Carey,*449 F.3d 1065, 1068 (9th Cir.2006), and are to be decided on a case-by-case basis.

Following the general rule, our cases have applied equitable tolling in a variety of contexts. For example, we have held an attorney’s misconduct may be “sufficiently egregious” to warrant equitable tolling, when the attorney was hired a year in advance of the AEDPA deadline, failed to prepare a petition, and — critically—kept the petitioner’s case file so that it was “unrealistic” to expect the petitioner to file pro se. *See Spitsyn,*345 F.3d at 800-01. *See also Corjasso v. Ayers,*278 F.3d 874, 878 (9th Cir.2002) (holding equitable tolling warranted when the district court incorrectly dismissed a habeas petition and then lost the petition); *Miles v. Prunty,*187 F.3d 1104, 1107 (9th Cir.1999) (holding prison officials’ failure to timely prepare a check for the court filing fee was an extraordinary circumstance beyond the petitioner’s control).

Not surprisingly, we also have long recognized equitable tolling in the context of a petitioner’s mental illness. In *Calderon v. United States,*for example, without delving into the details, we acknowledged a “habeas petitioner’s mental incompetency [is] a condition that is, obviously, an extraordinary circumstance beyond the prisoner’s control” to justify equitable tolling pending a competency hearing. 163 F.3d 530, 541 (9th Cir.1998), *rev’d on other grounds by Woodford v. Garceau,*538 U.S. 202, 123 S.Ct. 1398, 155 L.Ed.2d 363 (2003) (regarding AEDPA’s effective date). And in a different context, in *Rohan ex rel. Gates v. Woodford,*334 F.3d 803, 813 (9th Cir.2003), we similarly recognized a “constitutional due process right” to competency in postconvietion proceedings involving the death penalty.

Perhaps most pertinent is *Laws v. Lamarque,*351 F.3d 919 (9th Cir.2003), where we reiterated the causation requirement recognized in our equitable tolling cases, holding that where a habeas petitioner can show “mental incompetence *in fact*caused him to fail to meet the AEDPA filing deadline, his delay was caused by an ‘extraordinary circumstance ...,’ and the deadline should be equitably tolled.” *Id.*at 923 (emphasis added). In making the assessment, we examined “whether his *mental illness*[during the limitations period] constituted the kind of extraordinary circumstances beyond his control, making filing impossible, for which equitable tolling is available.” *Id.*at 922-23 (emphasis added). But nothing in *Laws*required us *1098to refíne the legal standard and explore what mental conditions would satisfy the extraordinary circumstances requirement.

Only a few other courts have wrestled with this problem with respect to tolling AEDPA. Earlier this year, for example, the Second Circuit held that “mental illness” can constitute an extraordinary circumstance depending on “how severe an obstacle [the illness] is for the prisoner endeavoring to comply with AEDPA’s limitations period.” *Bolarinwa v. Williams,*593 F.3d 226, 231-32 (2d Cir.2010). To be eligible under this severity standard, the petitioner “must demonstrate that her particular disability constituted an ‘extraordinary circumstance’ severely impairing her ability to comply with the filing deadline, despite her diligent efforts to do so.” *Id.*at 232. But the court did not give content to its severity standard, instead remanding the “highly case-specific inquiry” to the district court. *See id.*

With this background, we next turn to the proper legal standard.

*B. Legal Standards for Tolling Due to Mental Impairment*

The district court and parties put forth several different approaches for evaluating a petitioner’s mental illness in this context.

We start with the district court’s formulation. Under the district court’s analysis, Bills must show:

> he was unable by reason of mental defect to understand his need to timely file a habeas petition and unable to take steps to effectuate that filing. Included within this showing would be a demonstration that during the pertinent period, he was unable to ask for available assistance in filing the habeas [petition].

The court based that standard on its reading of *Dusky v. United States,*362 U.S. 402, 80 S.Ct. 788, 4 L.Ed.2d 824 (1960) (per curiam), where the Supreme Court held, in the context of whether a defendant is mentally fit to stand trial, the issue is “whether [the petitioner] has sufficient present ability to consult with his lawyer with a reasonable degree of rational understanding — and whether he has a rational as well as a factual understanding of the proceedings against him.” *Id.*at 402, 80 S.Ct. 788.

Bills argues this standard — applicable to mental competency to stand trial — is too narrow. He contends his mental disabilities impaired his ability to “communicate rationally with the federal courts,” i.e., prepare a written application, thereby making it impossible for him to comply with AEDPA’s filing deadlines. The state, in contrast, urges us to find Bills was competent if he had a “rational and factual understanding of the proceedings against him and he has the current ability to consult his lawyer with a reasonable degree of rational understanding.”

Each of these positions has some merit. To answer this question, like the district court, we start with applicable Supreme Court precedent. Several cases are instructive, though not fully on point.

The first case is *Dusky.*In its brief per curiam opinion, the Supreme Court set forth the standard a defendant must meet to be competent to *stand*trial. Competency to stand trial includes both (1) “whether [the defendant] has sufficient present ability to consult with his lawyer with a reasonable degree of rational understanding”; and (2) “whether he has a rational as well as factual understanding of the proceedings against him.” 362 U.S. at 402, 80 S.Ct. 788. As the Court later emphasized in reiterating the *Dusky*standard, it “has long been accepted that a person whose mental condition is such that he lacks the capacity to understand the nature and object of the proceedings against him, to consult with counsel, and to assist in preparing his defense may not be subjected to *1099a trial.” *Drope v. Missouri,*420 U.S. 162, 171, 95 S.Ct. 896, 43 L.Ed.2d 103 (1975).

Several years later, the Supreme Court expanded its use of the *Dusky*standard to *pretrial*proceedings. In *Godinez v. Moran,*509 U.S. 389, 113 S.Ct. 2680, 125 L.Ed.2d 321 (1993), the Court held the same standard should apply in determining whether a defendant is competent to plead guilty and knowingly and voluntarily waive the right to assistance of counsel. *Id.*at 398, 113 S.Ct. 2680 (rejecting “the notion that competence to plead guilty or to waive the right to counsel must be measured by a standard that is higher than (or even different from) the *Dusky*standard”).

But in a 2008 case, the Supreme Court held a different standard for mental competency should apply to a defendant seeking *self-representation*at trial. In *Indiana v. Edwards,*the Court held defendants do not have a Sixth Amendment right to refuse court-appointed counsel and represent themselves if “they are not competent to conduct trial proceedings by themselves.” 554 U.S. 164, 178, 128 S.Ct. 2379, 171 L.Ed.2d 345 (2008). Although the Court did not define precisely the self-representation competency standard, it did conclude competency to represent oneself is a higher bar than *Dusky’s*competency to stand trial standard. Courts may “take realistic account of the particular defendant’s mental capacities,” and find some defendants “competent enough to stand trial under *Dusky*but who still suffer from severe mental illness to the point where they are not competent to conduct trial proceedings by themselves.” *Id.*at 177-78, 128 S.Ct. 2379.

None of these cases precisely apply here, but they are instructive for then-reasoning. For instance, in *Godinez*the Court held the trial competency standard applies to plea hearings because “while the decision to plead guilty is undeniably a profound one, it is no more complicated than the sum total of decisions ... during the course of a trial.” *Godinez,*509 U.S. at 398, 113 S.Ct. 2680. The Court observed, however, that “the competence that is required of a defendant seeking to waive his right to counsel is the competence to *waive the right,*not the competence to represent himself.” *Id.*at 399, 113 S.Ct. 2680. And in *Edwards*the Court concluded that *Godinez*would not apply to self-representation because “a defendant who would choose to forgo counsel at trial presents a very different set of circumstances ... [and] calls for a different standard.” *Edwards,*554 U.S. at 174-75, 128 S.Ct. 2379. The contrast between *Godinez*and *Edwards*shows the “competency” standard does not exist in a vacuum — it varies in relation to the task the defendant is expected to perform. A decision to stand trial or plead guilty is different from undertaking a self-defense at trial.

Given this Supreme Court authority, any standard for equitable tolling due to mental impairment must evaluate whether the petitioner’s condition made it impossible to comply with the filing deadline. *See Spitsyn,*345 F.3d at 799. We recognize the myriad circumstances at play — petitioners may be representing themselves, employing counsel, or relying on available prison resources while incarcerated. The inquiry focuses on the ability of petitioners to comply with what the law requires given then-particular circumstances.

With these cases in mind, we conclude that eligibility for equitable tolling due to mental impairment requires the petitioner to meet a two-part test:

> (1) *First,*a petitioner must show his mental impairment was an “extraordinary circumstance” beyond his control, *see Holland,*130 S.Ct. at 2562, by dem*1100onstrating the impairment was so severe that either

> (a) petitioner was unable rationally or factually to personally understand the need to timely file, or

> (b) petitioner’s mental state rendered him unable personally to prepare a habeas petition and effectuate its filing.2

> (2) *Second,*the petitioner must show diligence in pursuing the claims to the extent he could understand them, but that the mental impairment made it impossible to meet the filing deadline under the totality of the circumstances, including reasonably available access to assistance. *See id.*

To reiterate: the “extraordinary circumstance” of mental impairment can cause an untimely habeas petition at different stages in the process of filing by preventing petitioner from understanding the need to file, effectuating a filing on his own, or finding and utilizing assistance to file. The “totality of the circumstances” inquiry in the second prong considers whether the petitioner’s impairment was a but-for cause of any delay. Thus, a petitioner’s mental impairment might justify equitable tolling if it interferes with the ability to understand the need for assistance, the ability to secure it, or the ability tó cooperate with or monitor assistance the petitioner does secure. The petitioner therefore always remains accountable for diligence in pursuing his or her rights.

This standard flows naturally from *Dusky, Godinez,*and *Edwards.*All three of those cases ask whether the defendant or petitioner is mentally competent to do what the law requires: in *Dusky,*stand trial; in *Godinez,*plead guilty; and in *Edwards,*represent oneself at trial. Our standard requires the court to evaluate the petitioner’s ability to do by himself the two functions involved in complying with the AEDPA filing *deadlines*— i.e., understand the need to file within the limitations period, and submit a minimally adequate habeas petition — and to evaluate the petitioner’s diligence in seeking assistance with what he could not do alone.3

In practice, then, to evaluate whether a petitioner is entitled to equitable tolling, the district court must: (1) find the petitioner has made a non-frivolous showing that he had a severe mental impairment during the filing period that would entitle him to an evidentiary hearing; (2) determine, after considering the record, whether the petitioner satisfied his burden that he was in fact mentally impaired; (3) determine whether the peti*1101tioner’s mental impairment made it impossible to timely file on his own; and (4) consider whether the circumstances demonstrate the petitioner was otherwise diligent in attempting to comply with the filing requirements.

With respect to the necessary diligence, the petitioner must diligently seek assistance and exploit whatever assistance is reasonably available. The court should examine whether the petitioner’s mental impairment prevented him from locating assistance or communicating with or sufficiently supervising any assistance actually found. The record does not address whether Bills was diligent in seeking assistance with his claim. Nor does it address whether there was any assistance available to Bills on reasonable terms.

The magistrate judge relied on the availability of a “jailhouse lawyer” — an inmate who assists other prisoners with legal filings — to show Bills was not entitled to equitable tolling since he had assistance in preparing legal materials during the limitations period. In support of this conclusion, the magistrate judge noted that our cases have required prisoners to demonstrate diligence by showing they sought “assistance from an inmate, library personnel, or other source,” if it was available. *See Mendoza,*449 F.3d at 1070.

The availability of assistance is an important element to a court’s diligence analysis. For example, if prison officials or even other prisoners were readily available to assist Bills in filing his habeas petition but Bills refused to accept their assistance, a court could conclude Bills may not have been diligent in pursuing his claims such that he is entitled to equitable tolling. That is not to say a prisoner fails the diligence requirement for refusing jailhouse assistance. It is only part of the overall assessment of the totality of circumstances that goes into the equitable determination. Thus, in many circumstances, the existence of such help would be highly relevant to the question of whether a petitioner’s mental condition made it impossible to file a timely petition. But the availability of jailhouse assistance could also cut the other way. If legal help is available only because a prisoner has to resort to bribery or succumb to extortion, and a prisoner does not do so, a court would not find a lack of diligence. Here it is unclear what assistance Bills had and how that assistance, if any, bore on his ability to meet the filing deadline.

Given our clarification of the legal standard governing Bills’s entitlement to equitable tolling, we conclude the district court did not properly frame its inquiry into the effects of Bills’s mental impairment on his ability to pursue his claims diligently during the AEDPA limitations period, including whether he had reasonable access to assistance. We therefore remand for reconsideration under the standard set forth above.

III. Conclusion

Mindful of the Supreme Court’s observation that “often the exercise of a court’s equity powers must be made on a case-by-case basis,” *Holland,*130 S.Ct. at 2563, we find it appropriate for the district court in the first instance to apply the facts of the case to the legal standards we set forth today. Therefore, we REVERSE the district court’s dismissal of Bills’s habeas petition and REMAND for further proceedings.

1

. Bills also seeks a COA under the Americans with Disabilities Act (ADA). He seems to argue the AEDPA limitations period must be tolled for any petitioner with an ADA-covered disability. We deny the request. "Under 28 U.S.C. § 2253(c)(2), a COA may issue only if the applicant has made a substantial showing of the denial of a constitutional right.... [A] COA should issue if jurists of reason would find it debatable whether the petition states a valid claim of the denial of a constitutional right.” *Wilson v. Belleque,*554 F.3d 816, 825-26 (9th Cir.2009), *cert. denied,*— U.S. —, 130 S.Ct. 75, 175 L.Ed.2d 53 (2009). Bills’s ADA claim does not assert the denial of a constitutional right, and the district court correctly denied Bills a COA on this claim.

2

. The magistrate judge stated a habeas petitioner must show "he was unable by reason of mental defect to understand his need to timely file a habeas petition *and*unable to take steps to effectuate that filing.” (emphasis added). Under our formulation, a petitioner would be entitled to equitable tolling if he could show either of those conditions were met: *either*he did not understand his need to timely file *or*his mental impairment made him unable to take steps to effectuate that filing. In either case, if the mental impairment is so severe that it causes the untimely filing, the petitioner is entitled to equitable tolling.

3

. Applying this standard will require the district court to evaluate how a petitioner's mental impairment bore on his ability to file. The relevant question is: Did the mental impairment cause an untimely filing? *See Spitsyn,*345 F.3d at 799 (equitable tolling is available if it was "impossible to file a petition on time”); *but see Harris v. Carter,*515 F.3d 1051, 1055 n. 5 (9th Cir.2008) ("Despite the unequivocal 'impossibility' language in our standard, we have not insisted that it be literally impossible for a petitioner to file a federal habeas petition on time as a condition of granting equitable tolling. We have granted equitable tolling in circumstances where it would have technically been possible for a prisoner to file a petition, but a prisoner would have likely been unable to do so.”).