#### HUU THANH NGUYEN, Petitioner-Appellant, v. Silvia GARCIA, Warden; Edward S. Alameida, Jr., Director, Director of Corrections, California State Department of Corrections, Respondents-Appellees.

No. 05-56596.

United States Court of Appeals, Ninth Circuit.

Argued and Submitted Oct. 24, 2006.

Filed Feb. 9, 2007.

*718Allen Bloom, San Diego, CA, for the petitioner-appellant.

Bill Lockyer, Attorney General of the State of California, Robert R. Anderson, Chief Assistant Attorney General, Gary W. Schons, Senior Assistant Attorney General, Kevin Vienna, Deputy Attorney General, Lise Jacobsen, Deputy Attorney General, Quisteen S. Shum, Deputy Attorney General, San Diego, CA, for the respondents-appellees.

Before EUGENE E. SILER, JR.,* TASHIMA, and BEA, Circuit Judges.

*

 The Honorable Eugene E. Siler, Jr., Senior United States Circuit Judge for the Sixth Circuit, sitting by designation.

BEA, Circuit Judge.

In *Wainwright v. Greenfield,*474 U.S. 284, 295, 106 S.Ct. 634, 88 L.Ed.2d 623 (1986), the Supreme Court held that prosecution evidence the defendant maintained silence after his arrest, offered to show he wasn’t all *that*crazy, and to rebut defendant’s insanity defense in the guilt phase of trial, constituted a violation of due process. Here, we consider whether *Wainwright,*or other applicable federal law, prohibits the prosecutor’s mention that defendant requested counsel to show he was able to cooperate in his own defense — not at the guilt phase of trial but during a hearing to determine whether the defendant was mentally competent to stand trial. We conclude that the. state court decision finding *Wainwright*inapplicable to a state court competency hearing is not “contrary to” clearly established federal law and therefore affirm the denial of appellant’s petition for writ of habeas corpus brought pursuant to 28 U.S.C. § 2254.

I.

In the early morning of November 15, 1997, a fight broke out at a billiard hall in Stanton, California. The fight continued in the parking lot of the billiard hall and shots were fired. Two of the shots fired struck the outer wall of the billiard hall and one shot pierced the front window and struck an interior wall. No one was killed or hit, but probably not for lack of trying. The owner of the billiard hall saw someone firing a weapon out of the passenger window of a Nissan Maxima. After hearing the shots, Deputy Albert Macias observed a beige Nissan Maxima automobile speed away from the billiard hall parking lot. A brief pursuit ended when the Maxima spun out of control. Appellant Huu Thanh *719Nguyen (“Nguyen”) was the sole occupant of the vehicle.

Deputy Macias ordered Nguyen out of the car and then handcuffed Nguyen and placed him in the back of the patrol car. Macias read Nguyen his *Miranda*rights after arresting him, and Nguyen responded that he understood each of his rights. Nguyen then stated he wanted to tell Macias what had happened. Nguyen told Macias that a friend had fired the shots. Nguyen stated he drove off to allow his friend to escape, and that Nguyen had tossed the gun out of his window because it was not his. After telling Deputy Macias these details, Nguyen stated he wanted to talk with a lawyer. Macias stopped his interrogation.

The gun used to fire the shots was found 30 to 50 feet from where the Maxima came to rest. Gunshot residue was found on Nguyen’s left hand, on the interior and exterior of the passenger door, and on the windshield.

In January 1998, Nguyen was charged with attempted first degree murder, CaLPenal Code §§ 187(a), 664, assault with the personal use of a firearm, *id.*§ 245(a)(2), shooting at an occupied building, *id.*§ 246, and being a felon in possession of a firearm, *id.*§ 12021(a)(1).1 He was charged to have committed the attempted murder willfully, deliberately, and with premeditation. Before the jury trial, the proceedings in the criminal prosecution were suspended pursuant to California Penal Code §§ 1367-69 for a hearing to determine whether Nguyen was competent to stand trial.2

The competency hearing was held in March 1999 before a jury impaneled solely to decide whether Nguyen was competent to stand trial on the charges lodged against him.3 At this competency hearing, Dr. Paul Blair testified for the defense. He testified that he had evaluated Nguyen twice, once in September 1992 (at the request of a public defender who was defending Nguyen for the 1992 burglary charge) and again in January 1999. Dr. Blair opined that Nguyen “is not competent to participate in his own defense at this point in time, nor is he competent to discuss with you in a legitimate, forthright manner .... ” During cross examination of Dr. Blair, the prosecutor mentioned Nguyen’s *720request for an attorney on the night of the billiard hall shooting:

> Q: Let me ask you this, Dr. Blair. If Mr. Nguyen on the day of his arrest in November of 1997 gave a police officer a rational, apparently cogent statement, even — even a defense to what he was suspected of doing, saying he may not have been involved, telling him that he didn’t want to speak to him any longer, *wanted a lawyer,*would that mean that he’s competent to stand trial today?4 A: No.

(emphasis added).

The prosecution’s psychiatric expert, Dr. Kaushal Sharma, testified about his interview with Nguyen. Sharma explained that Nguyen described in detail the charges against him and explained his defenses. Nguyen’s request for an attorney on the night of the shooting was not mentioned during Sharma’s testimony. But Sharma testified that Nguyen’s statement that he understood his *Miranda*rights demonstrated “mental intact functioning.”

Deputy Macias, the arresting officer, testified as to the arrest, his recitation of the *Miranda*rights, and Nguyen’s acknowledgment of the rights (including his request for an attorney) and explanation of the events of the crime. Finally, during closing arguments of the competency hearing, the prosecution mentioned Nguyen’s acknowledgment of his *Miranda*rights as evidence of his competency:

> When [Macias] says, “You have the right to an attorney. Do you understand that? One will be appointed to you free of charge before speaking to me.” “Yes,” he understands that.

> That tends to show circumstantially that he’s aware of at least the element that he’s involved in a criminal court proceeding. He’s aware of going to court, things that he says to the deputy could be used against him, he has a right to a lawyer free of charge before talking to the sheriffs deputy. So circumstantially, that tends to show to a reasonable person he’s aware of things.

SER 435-36. Following closing arguments, the jury empaneled only for the competency hearing found Nguyen mentally competent to stand trial.

On November 16, 1999, a jury composed totally of persons who had not served on the jury which determined competency convicted Nguyen of the charged offenses and found true the allegations that Nguyen had acted willfully, deliberately, and with premeditation and that he personally used the firearm in committing the attempted murder. Nguyen makes no assertion that his invocation of his right to counsel was at all mentioned during the criminal phase of trial. On January 21, 2000, Nguyen was sentenced to state prison for 25 years to life pursuant to California’s Three Strikes Law.

Nguyen appealed the judgment, asserting, *inter alia,*that his due process rights were violated when his request to talk to an attorney was used against him during the competency hearing. Nguyen relied on *Wainwright v. Greenfield,*474 U.S. 284, 106 S.Ct. 634, 88 L.Ed.2d 623 (1986) as support for this contention. On direct appeal, the California Court of Appeal rejected Nguyen’s application of *Wainwright*on the ground that evidence of a defendant’s invocation of *Miranda*rights as an indicum of competency during a competency hearing is distinguishable from the use of *post-Miranda*silence to overcome a plea of insanity during the criminal phase of trial. Specifically, the court stated that whereas the criminal phase of trial involves a penalty- — -a poten*721tial guilty verdict — a “mental competency hearing does not involve any penalty....” Therefore, “what applies to a criminal case does not necessarily apply to a competency proceeding.” On these grounds, the state appellate court held that it was not a violation of due process to use Nguyen’s invocation of his right to counsel as evidence during the competency hearing. Without comment, the California Supreme Court denied Nguyen’s petition for review.5

Nguyen then filed a petition for writ of habeas corpus with the United States District Court for the Central District of California. Nguyen raised only one claim in his petition: “[Nguyen’s] constitutional right to due process was violated when his post *-Miranda*warning invocation of his right to counsel was admitted, over defense objections,6 as evidence of his mental competency at a hearing under California Penal Code section 1368.”

The district court adopted its magistrate’s Report, denied Nguyen’s habeas petition, and dismissed Nguyen’s habeas petition with prejudice. The district court held the California Court of Appeal’s decision was not an objectively unreasonable application of either *Wainwright,*474 U.S. 284, 106 S.Ct. 634, 88 L.Ed.2d 623, or *Doyle v. Ohio,*426 U.S. 610, 96 S.Ct. 2240, 49 L.Ed.2d 91 (1976) (holding that it is a violation of due process to use a defendant’s invocation of his right to remain silent to impeach defendant’s testimony at trial, where such claim of right to remain silent follows a *Miranda*warning).

Here, a certificate of appealability was granted on one issue: “[w]hether the state court’s decision — that Petitioner had suffered no violation of his Miranda rights when his invocation of his right to counsel was brought out at his competency hearing — was contrary to, or an unreasonable application of, clearly established federal law as determined by the Supreme Court... ,”7 Accordingly, Nguyen appeals the district court’s denial of his federal habeas petition and claims the state court’s decision holding *Wainwright*is inapplicable to competency hearings is contrary to federal law. The holding in *Wainwright, Nguyen*posits, extended *Doyle*from silence to the request for an attorney and is not limited to issues of guilt or non-guilt.

II.

A.

The district court’s decision to deny Nguyen’s petition for writ of habeas corpus is reviewed *de novo,*and its factual findings are reviewed for clear error. *Rios v. Garcia,*390 F.3d 1082, 1084 (9th Cir.2004).

*722The Antiterrorism and Effective Death Penalty Act of 1996, Pub.L. No. 104-132, 110 Stat. 1214, (“AEDPA”) applies to this case because Nguyen’s petition for writ of habeas corpus was filed after April 24, 1996. Under AEDPA, ha-beas relief is proper only if the state court’s adjudication of the merits of a ha-beas claim “resulted in a decision that was contrary to, or involved an unreasonable application of, clearly established Federal law, as determined by the Supreme Court of the United States.” 28 U.S.C. § 2254(d)(1).8 We will “defer to the state court’s determination of the federal issues unless that determination is ‘contrary to, or involved an unreasonable application of, clearly established Federal law.’ ” *Himes v. Thompson,*336 F.3d 848, 852 (9th Cir. 2003) (quoting *Lockyer v. Andrade,*538 U.S. 63, 71, 123 S.Ct. 1166, 155 L.Ed.2d 144 (2003)). The relevant state court decision here is the decision of the California Court of Appeal, as that is the last reasoned state decision. *See Ylst v. Nunne-maker,*501 U.S. 797, 803, 111 S.Ct. 2590, 115 L.Ed.2d 706 (1991). Only United States Supreme Court holdings, but not dicta, constitute “clearly established federal.law” for purposes of the AEDPA deference standard. *See Williams v. Taylor,*529 U.S. 362, 412, 120 S.Ct. 1495, 146 L.Ed.2d 389 (2000); *Lambert v. Blodgett,*393 F.3d 943, 974 (9th Cir.2004) (quoting *Lockyer,*538 U.S. at 71-72, 123 S.Ct. 1166).

B.

Because resolution of this case turns on whether the state court’s decision is contrary to the holdings in *Wainwright,*474 U.S. 284, 106 S.Ct. 634, 88 L.Ed.2d 623, and *Doyle,*426 U.S. 610, 96 S.Ct. 2240, 49 L.Ed.2d 91, we begin by examining these holdings.9 First, in *Doyle,*defendants charged with selling marijuana testified at trial that they had not sold marijuana but been set up by law enforcement in an effort to buy marijuana. *Id.*at 612-13, 96 S.Ct. 2240. To impeach the *723veracity of the defendants’ exculpatory story, the prosecutor on cross-examination questioned each defendant why they had not told this story at the time of their arrest. *Id.*at 613-14, 96 S.Ct. 2240. On these facts, the Supreme Court considered whether the prosecutor’s use of post-Mi*randa*silence to impeach a defendant’s exculpatory testimony given at trial violates due process. The Court held that it did and thereby proscribed the use of an arrestee’s *post-Miranda*silence to impeach trial testimony: “while it is true that the *Miranda*warnings contain no express assurance that silence will carry no penalty, such assurance is implicit to any person who receives the warnings.” *Doyle,*426 U.S. at 618, 96 S.Ct. 2240; *see also United States v. Hale,*422 U.S. 171, 182-83, 95 S.Ct. 2133, 45 L.Ed.2d 99 (1975) (White, J., concurring). Hence, “it would be fundamentally unfair and a deprivation of due process to allow the arrested persons’s silence to be used to impeach an explanation subsequently offered at trial.” *Doyle,*426 U.S. at 619, 96 S.Ct. 2240.

*Wainwright*presented the Court with a variation on the theme of *Doyle.*The question in *Wainwright*was whether post-*Miranda*silence could be used as evidence to prove a defendant’s sanity, following a defendant’s plea of insanity, during the criminal phase of trial. 474 U.S. at 285, 106 S.Ct. 634. Pursuant to the state law applicable in *Wainwright,*“when a defendant pleads not guilty by reason of insanity and when his evidence is sufficient to raise a reasonable doubt about his sanity, the State has the burden of proving sanity beyond a reasonable doubt.” *Id.*at 286, 106 S.Ct. 634. If the State were unable to meet this burden, the defendant would be entitled to an acquittal. *Id.*at 286 n. 1, 106 S.Ct. 634 (citing cases). The Court found *Doyle*analogous:

> The point of the *Doyle*holding is that it is fundamentally unfair to promise an arrested person that his silence will not be used against him and thereafter to breach that promise by using the silence to impeach his trial testimony. It is equally unfair to breach that promise by using silence to overcome a defendant’s plea of insanity. In both situations, the State gives warnings to protect constitutional rights and implicitly promises that any exercise of those rights will not be penalized. In both situations, *the State then seeks to make use of the defendant’s exercise of those rights in obtaining his conviction.*The implicit promise, the breach, and the consequent penalty are identical in both situations.

*Id.*at 284-85, 106 S.Ct. 634 (emphasis added). The Court ruled the use of post-*Miranda*silence to disprove insanity unfairly penalized the defendant in contravention of the Due Process Clause of the Fourteenth Amendment. *Id.*at 293-95, 106 S.Ct. 634.

In sum, the due process violations found in these decisions are a result of the fundamental unfairness of the prosecution’s use of *post-Miranda*silence to infer the defendant’s guilt and thereby aid in persuading a jury to convict. Such use amounts to “penalizing” the defendant for invocation of their rights. *Compare Doyle,*426 U.S. at 617-18, 96 S.Ct. 2240, *with Wainwright,*474 U.S. at 295, 106 S.Ct. 634. After all, that the defendant will not be penalized is implicit in the opening line of the *Miranda*warnings: “You have the right to remain silent....” *See Miranda v. Arizona,*384 U.S. 436, 444, 86 S.Ct. 1602, 16 L.Ed.2d 694 (1966). It would not be much of a “right” if its *use*penalizes the user.

C.

We now consider whether reference to a defendant’s post *-Miranda*invocation of his right to counsel during a *724pretrial competency hearing causes the same penalty at issue in *Wainwright*and *Doyle.*A review, of the nature of competency hearings demonstrates that the penalty contemplated in *Wainwright*and *Doyle*simply does not occur in the context of competency hearings.

1.

It has long been a principle of our law that one who becomes “mad” after committing an offense should not be tried for the offense “for how can he make his defense?” William Blackstone, 4 *Commentaries*24; *see also Drope v. Missouri,*420 U.S. 162, 171, 95 S.Ct. 896, 43 L.Ed.2d 103 (1975) (“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 a trial.”). The Supreme Court has held that failure “to protect a defendant’s right not to be tried or convicted while incompetent to stand trial deprives him of his due process right to a fair trial.” *Id.*at 172, 95 S.Ct. 896 (citing *Pate v. Robinson,*383 U.S. 375, 385, 86 S.Ct. 836, 15 L.Ed.2d 815 (1966)).

To protect against the improper trial of mentally incompetent defendants, California has established a competency hearing procedure to determine a defendant’s competency *prior to*a criminal trial. *See*Cal.Penal Code §§ 1367-69. The goal of the competency hearing is not to examine the defendant’s sanity *at the time of the commission of the offense*(the issue in Wainwright); rather, the goal is to determine whether “the defendant is unable to understand the nature of the criminal proceedings or to assist counsel in the conduct of a defense in a rational manner.” *Id.*§ 1367(a); *see also Godinez v. Moran,*509 U.S. 389, 401 n. 12, 113 S.Ct. 2680, 125 L.Ed.2d 321 (1993) (“The focus of a competency hearing is the defendant’s mental capacity; the question is whether he has the *ability*to understand the proceedings.”); *People v. Masterson,*8 Cal.4th 965, 971, 35 Cal.Rptr.2d 679, 884 P.2d 136 (1994) (“The *sole purpose*of a competency proceeding is to determine the defendant’s present mental competence, i.e., whether the defendant is able to understand the nature of the criminal proceedings and to assist counsel in a rational manner.” (emphasis added)). California law “presume[s] that the defendant is mentally competent unless it is proved by a preponderance of the evidence that the defendant is mentally incompetent.” Cal.Penal Code § 1369(f). The California Supreme Court explained that “[a]lthough it arises in the context of a criminal trial, a competency hearing is a special proceeding, governed generally by the rules applicable to civil proceedings.” *People v. Lawley,*27 Cal.4th 102, 131, 115 Cal.Rptr.2d 614, 38 P.3d 461 (2002).

The effect of being found competent in no way affects the determination of the defendant’s guilt; it merely removes a procedural barrier to the commencement of trial. *See Jackson v. Indiana,*406 U.S. 715, 739, 92 S.Ct. 1845, 32 L.Ed.2d 435 (1972) (“[C]riminal responsibility at the time of the alleged offenses, however, is a distinct issue from [one’s] competency to stand trial.”). Indeed, the Supreme Court has carefully distinguished a pretrial competency determination from a guilt/innocence determination: “In a competency hearing, the ‘emphasis is on [the defendant’s] capacity to consult with counsel and to comprehend the proceedings, and ... this is by no means the same test as those which determine criminal responsibility at the time of the crime.’ ” *Medina v. California,*505 U.S. 437, 448, 112 S.Ct. 2572, 120 L.Ed.2d 353 (1992), (alteration and omis*725sion in the original) (quoting *Pate v. Robinson,*383 U.S. 375, 388-89, 86 S.Ct. 836, 15 L.Ed.2d 815 (1966) (Harlan, J., dissenting)). Regarding California’s competency procedure, California state courts have explained:

> The purpose of [a competency hearing] is not to determine guilt or innocence. It has no relation to the plea of not guilty by reason of insanity. Rather, the sole purpose of [the competency hearing] is the humanitarian desire to assure that one who is mentally unable to defend himself not be tried upon a criminal charge.

*Tarantino v. Superior Court,*48 Cal. App.3d 465, 469, 122 Cal.Rptr. 61 (1975). The effect of being found incompetent is the “suspension of the criminal trial until such time, if any, that the defendant regains the capacity to participate in his defense and understand the proceedings against him.” *Medina,*505 U.S. at 448, 112 S.Ct. 2572; *see also Dusky v. United States,*362 U.S. 402, 402-03, 80 S.Ct. 788, 4 L.Ed.2d 824 (1960) (per curiam). The effect of being found competent is the continuation of criminal proceedings to the guilt phase of trial.10

2.

Not only are competency hearings entirely distinct in purpose from the guilt phase of trial, but competency hearings do not invoke the same concerns of self-incrimination — the right *Miranda*is designed to protect — that are relevant during the guilt and penalty phases of trial. The Fifth Amendment privilege against self-incrimination exists to prohibit the government from forcing the defendant to talk and then using the defendant’s own statements to satisfy its burden of establishing guilt. *See Oregon v. Elstad,*470 U.S. 298, 304-05, 105 S.Ct. 1285, 84 L.Ed.2d 222 (1985) (explaining that use of voluntary statements does not violate the Fifth Amendment); *Estelle v. Smith,*451 U.S. 454, 462, 101 S.Ct. 1866, 68 L.Ed.2d 359 (1981). These concerns have no place at a competency hearing.

In California, the court may order a competency hearing and *compel*a defendant to submit to psychiatric evaluation as part of the competency determination. CahPenal Code § 1369. Accordingly, California state courts have expressly held there is no Fifth Amendment right against self incrimination during competency hearing proceedings so long as statements *726made during a competency hearing are immune from later use by the prosecution to establish guilt. *Tarantino,*48 Cal. App.3d at 469-70, 122 Cal.Rptr. 61. Immunity for competency hearing statements “is necessary to ensure that an accused is not convicted by use of his own statements made at a court-compelled examination .... Hence, the rule protects both an accused’s privilege against self-incrimination and the public policy of not trying persons who are mentally incompetent.” *People v. Arcega,*32 Cal.3d 504, 522, 186 Cal.Rptr. 94, 651 P.2d 338 (1982).

This judicially-created immunity is buttressed by the Supreme Court’s holding in *Estelle,*451 U.S. 454, 101 S.Ct. 1866, 68 L.Ed.2d 359. There, in holding that the Fifth Amendment privilege against self-incrimination extends to psychiatric examinations that are later used in the penalty phase of trial,11 the Court declared that “[t]he essence” of the Fifth Amendment privilege against self-incrimination “is ‘the requirement that the State which proposes to convict and punish an individual produce the evidence against him by the independent labor of its officers, not by the simple, cruel expedient of forcing it from his own lips.’ ” *Id.*at 462, 101 S.Ct. 1866 (emphasis omitted) (quoting *Culombe v. Connecticut,*367 U.S. 568, 581-82, 81 S.Ct. 1860, 6 L.Ed.2d 1037 (1961)). Since neither conviction nor punishment are the result of a competency hearing, the rationale underlying *Estelle’s*holding simply does not extend to statements used solely at such a hearing.12

Unlike guilt or punishment, incompetency can rarely be determined without the participation of the person claimed to be incompetent. Furthermore, because under California law the *defendant*bears the burden to establish *incompetence*by a preponderance of the evidence, the use of a defendant’s own statements during a competency hearing in no way affects the government’s evi-dentiary burden. Cal.Penal Code § 1369(f). In short, a defendant seeking to establish incompetence can be compelled to talk: a defendant may be required to be a witness to his own competency, if not his own crime.13

*Miranda*exists to provide “procedural safeguards effective to secure the privilege against self-incrimination.” *Miranda v. Arizona,*384 U.S. 436, 444, 86 S.Ct. 1602, 16 L.Ed.2d 694 (1966). The privilege *727against self-incrimination, in turn, exists to protect the defendant from being forced to be a witness against himself. *Estelle,*451 U.S. at 462, 101 S.Ct. 1866; *see also United States v. Patane,*542 U.S. 630, 637, 124 S.Ct. 2620, 159 L.Ed.2d 667 (2004) (noting “that the core protection afforded by the Self-Incrimination Clause is a prohibition on compelling a criminal defendant to testify against himself at trial” in lieu of producing other evidence). We fail to see how *Wainwright*and *Doyle,*which hold that a defendant shall not be penalized for invoking *Miranda*rights, should apply to a hearing at which the Fifth Amendment privilege against self-incrimination is inapplicable. Here, reference to Nguyen’s post-arrest invocation at the competency hearing was not used to satisfy the prose-cutorial burden of proof of guilt; it was used, rather, to show cognition.

III.

On these bases, we hold that the California Court of Appeal’s decision not to apply *Wainwright*and *Doyle*to Nguyen’s competency hearing was not “contrary to” federal law. The court correctly explained that “the nature of the proceeding in this case distinguishes it from *Wainwright,”*and that “[a] mental competency hearing does not involve any penalty... ,”14 Absent a holding by the Supreme Court to apply the principles of *Wainwright*and *Doyle*to competency hearings, we are bound by the strictures of AEDPA to defer to the state court’s determination. *See Carey v. Musladin*, — U.S.-,- -, 127 S.Ct. 649, 652-54, 166 L.Ed.2d 482 (2006).15

AFFIRMED.

1

. Nguyen stood twice convicted, once in 1992 and once in 1993, of felony burglary offenses. CaLPenal Code §§ 459-60.

2

. Under California law,

> [a] person cannot be tried or adjudged to punishment while that person is mentally incompetent. A defendant is mentally incompetent for purposes of this chapter if, as a result of mental disorder or developmental disability, the defendant is unable to understand the nature of the criminal proceedings or to assist counsel in the conduct of a defense in a rational manner.

CaLPenal Code § 1367(a).

3

. In California, competency hearings are distinct from the criminal prosecution: "when an order for a hearing into the present mental competence of the defendant has been issued, all proceedings in the criminal prosecution shall be suspended until the question of the present mental competence of the defendant has been determined.” CaLPenal Code § 1368(c). If a jury has been impaneled to decide the guilt of the defendant, the jury is "retained on call” pending resolution of the defendant's competency unless such retention would cause "undue hardship.” *Id.*A separate jury may be impaneled to determine the sole issue of the defendant’s competency. *See id.*§§ 1368(c), 1369(e), (f); *People v. Turner,*34 Cal.4th 406, 424, 20 Cal.Rptr.3d 182, 99 P.3d 505 (2004). Defendant has the burden of proving by a preponderance of the evidence that he is mentally incompetent. *Id.*§ 1369(f).

Here, of course, the competency hearing preceded the guilt phase trial; the composition of the competency jury was totally different from that of the eventual guilt phase jury.

4

. There was neither an objection to this question nor a motion to strike the answer.

5

.California law does not allow the separate appeal of a competency determination: "A determination of mental competency is a non-appealable interlocutory ruling and may be reviewed only on an appeal from a final judgment in the underlying criminal proceeding.” 5 Witkin, *California Criminal Law, Criminal Trial*§ 716 (3d ed.); *see also People v. Mickle,*54 Cal.3d 140, 180, 284 Cal.Rptr. 511, 814 P.2d 290 (1991) ("We conclude that the verdict finding defendant competent is a nonap-pealable, interlocutory ruling. It may be reviewed on appeal only from a final judgment in the underlying criminal proceeding.”).

6

. The record does not contain any defense objection, much less "objections,” to the question in answer to which Deputy Macias stated Nguyen requested an attorney. *See supra*page 719-20. However, in view of the basis of our decision, the case does not turn on whether a claimed evidentiary error was properly preserved below or whether any error meets the standard for plain error.

7

. We note that Nguyen’s Notice of Appeal was timely under Fed. R.App. P. 4(a)(6) because Nguyen received no notice of the entry of Judgment.

8

. AEDPA provides in pertinent part:

> (d) An application for a writ of habeas corpus on behalf of a person in custody pursuant to the judgment of a State court shall not be granted with respect to any claim that was adjudicated on the merits in State court proceedings unless the adjudication of the claim—

> (1) resulted in a decision that was contrary to, or involved an unreasonable application of, clearly established Federal law, as determined by the Supreme Court of the United States; or

> (2) resulted in a decision that was based on unreasonable determination of the facts in light of the evidence presented in the State court proceeding.

28 U.S.C. § 2254(d).

9

. The “contrary to” clause is the correct clause for analysis in this case. We have explained that a state court decision is contrary to federal law if the court either " 'applies a rule that contradicts the governing law set forth’ by the Supreme Court or arrives at a different result in a case, that is 'materially indistinguishable from a [Supreme Court] decision.' ” *Luna v. Cambra,*306 F.3d 954, 960 (alteration in the original) (quoting *Penry v. Johnson,*532 U.S. 782, 792, 121 S.Ct. 1910, 150 L.Ed.2d 9 (2001), *as amended*311 F.3d 928 (9th Cir.2002)). The state court did not apply the holdings of *Wainwright*and *Doyle*to the facts of Nguyen's case; rather, it distinguished *Wainwright*and *Doyle*on the basis that errors in those cases occurred during the guilt phase of a trial, not during a hearing to determine competency to stand trial. The state court thus found *Wainwright*and *Doyle*inapplicable to a competency hearing. Whether Nguyen is entitled to habeas relief depends on whether this decision is contrary to federal law. That the district court applied the “unreasonable application” clause in its analysis is immaterial to our analysis. Our review of the district court’s decision is de novo, and we may “affirm on any ground supported by the record, even if it differs from the rationale of the district court.” *Pollard v. White,*119 F.3d 1430, 1433 (9th Cir.1997).

10

. We acknowledge that using a defendant’s *post-Miranda*invocation of the right to counsel to establish competency to stand trial may help to remove a procedural barrier to trial and eliminates the tactical advantage of indefinite pretrial delay, during which time witnesses die and evidence deteriorates. The removal of a procedural barrier to trial and the loss of a tactical advantage, however, do not raise the same constitutional concern at issue in *Wainwright.*One has a constitutional right not to have one's silence be used to prove guilt. No one has a constitutional right to stall trial until evidence is lost and witnesses expire.

Likewise, the use of a defendant's invocation of *Miranda*rights at a suppression or evidentiary hearing does not raise the same constitutional concern at issue in *Wainwright.*Thus, use of evidence procured in violation of *Miranda*warnings has never been barred in such non-jury, non-guilt phase proceedings. For example, in *United States v. Lemon,*550 F.2d 467, 473 (9th Cir. 1977), we held that although "[sjtatements taken in violation of Miranda may not be used to prove the prosecution's case at trial,” such statements "elicited prior to the giving of Miranda warnings may be used during a motion to suppress to show defendant’s consent to a search.” We relied on *Lemon*in *United States v. Patterson,*812 F.2d 1188, 1193 (9th Cir. 1987), *cert. denied,*485 U.S. 922, 108 S.Ct. 1093, 99 L.Ed.2d 255 (1988), where we held that statements taken in violation of *Miranda*may be used in an affidavit to establish probable cause for a search warrant.

11

. In *Estelle,*a psychiatrist spoke with the defendant during competency proceedings to determine whether he was competent to stand trial. *Estelle,*451 U.S. at 456-57, 101 S.Ct. 1866. Later, during the penalty phase of trial, the psychiatrist testified against the defendant — on the basis of their discussions during the competency hearing — to establish that the defendant posed great risk to society. *Id.*at 459-60, 101 S.Ct. 1866.

12

. In dicta, the Court expressed as much in *Estelle:*"Indeed, if the application of [the psychiatrist’s] findings had been confined to [a competency hearing], no Fifth Amendment issue would have arisen.” *Estelle,*451 U.S. at 465, 101 S.Ct. 1866.

13

. This conclusion is in line with previous holdings regarding the right against self-incrimination at analogous pretrial hearings. For example, in *United States v. Mitchell H.,*182 F.3d 1034, 1035-36 (9th Cir.1999), we held that the privilege against self-incrimination does not apply to a juvenile transfer hearing because the hearing is not a criminal hearing, and statements during the hearing, like statements made during a competency hearing, cannot be used at a later criminal trial. We noted that “a juvenile transfer hearing is a close cousin of a competency hearing” because both hearings " 'deal with whether a defendant should be exempted from criminal prosecution because he falls within a category of persons who, in the eyes of the law, are not viewed as fully responsible for their acts.’ ” *Id.*at 1035 n. 3 (quoting *United States v. A.R.,*38 F.3d 699, 703 (3d. Cir.1994)).

14

. Having determined that the state court’s decision was not contraiy to established federal law, we need not address Nguyen's contention that reference to his *post-Miranda*invocation of his right to counsel during the competency hearing was not harmless error under *Brecht v. Abrahamson,*507 U.S. 619, 113 S.Ct. 1710, 123 L.Ed.2d 353 (1993).

15

. We reject Nguyen's contention that *Medina v. California,*505 U.S. 437, 112 S.Ct. 2572, 120 L.Ed.2d 353 (1992), extended *Wainwright*to competency hearings. In *Medina,*the sole issue before the Court was whether the Due Process Clause permitted California to place the burden of establishing incompetence on the defendant. *Id.*at 439, 112 S.Ct. 2572. The Court held that California’s competency determination framework did not violate due process. *Id.*at 448-53, 112 S.Ct. 2572. Nothing in the decision suggests the principles of *Wainwright*and *Doyle*should apply in the context of competency hearings.