Petitioner Gregory Caliendo appeals the district court’s denial of his petition for writ of habeas corpus. He contends that the California Court of Appeal’s decision upholding his conviction was contrary to Supreme Court precedent because the court did not presume prejudice from an incident of juror misconduct. A detective who provided testimony that was crucial to the prosecution’s case had a twenty-minute conversation, unrelated to the trial, with three jurors in the hallway during a break in deliberations. Caliendo also claims his sentence amounted to cruel and unusual punishment under the Eighth Amendment.
We exercise jurisdiction under 28 U.S.C. § 2253 and 28 U.S.C. § 1291. On the juror misconduct question, we hold that the state appellate court’s decision was contrary to Mattox v. United States, 146 U.S. 140, 13 S.Ct. 50, 36 L.Ed. 917 (1892), in that the court did not apply a rebuttable presumption of prejudice, but we nevertheless affirm the district court’s denial of the habeas petition because the government successfully rebutted the Mattox presumption. In addition, we affirm the district court’s denial of relief on the Eighth Amendment question.
I. FACTS
After a Los Angeles County Superior Court jury convicted him of second-degree auto burglary in violation of California Penal Code section 459, Caliendo was sentenced to a state prison term of twenty-five years to life in accordance with California’s three strikes law. His conviction resulted from a second trial; the jury in Caliendo’s first trial hung 7-5 in favor of acquittal.
The central issue at both trials was whether Caliendo broke into a locked parked car — an essential element of auto burglary — or whether the car had previously been broken into when he entered it. Caliendo was arrested at 12:30 a.m. on July 22, 1995. Two sheriffs deputies noticed someone sitting in the passenger seat of a GMC Suburban in a park and ride lot. Moments later, the deputies shined a spotlight on the car, approached it on foot, and illuminated the interior with their flashlights. They reported seeing Caliendo lying on his side with his head under the driver’s side dashboard and a screwdriver in his right hand. A window on the passenger side was broken. The front and back doors on the passenger side were unlocked. After Caliendo stepped out of the vehicle, the deputies found the screwdriver and a large rock on the floor. The vehicle had been parked there for two days. When the owner was shown his car in the impound lot, he said that the rear right speaker had been unscrewed and that the car’s sun visors and light bar were missing, along with an overnight bag containing clothes and about $30. Caliendo possessed none of these items when he was taken into custody directly from the car. He told the two deputies that he did not break into the car but that it was unlocked and he crawled inside it to go to sleep.1
The only evidence that Caliendo broke into the car was supplied by a police detective, John Mundell, who testified that Cal-iendo confessed this to him two days after the arrest, on July 24, 1995. According to Mundell, Caliendo said that following an argument his wife dropped him off at the *1149intersection near the park and ride lot between 11 p.m. and midnight on the night of his arrest. Mundell testified that Cal-iendo said he got cold and needed a place to sleep, so he broke the Suburban’s window by smashing it three times with a large rock, unlocked the door, crawled inside, and went to sleep. Caliendo denied having a screwdriver in his hand when the deputies found him.
Mundell was overheard talking to three jurors in the hallway outside the courtroom for approximately twenty minutes while they waited to enter the courtroom after a lunch recess during deliberations in Caliendo’s second trial.
The trial judge immediately conducted an evidentiary hearing. Mundell and the jurors testified that they did not discuss anything related to the trial. The topics of conversation included baseball, eating, a juror’s neighbor, Mundell’s exercise habits and equipment, and his heavy police workload:
“THE COURT: Mr. 005, what were you talking about?
JUROR NO. 5: We talked about the amount of paperwork on Detective Mun-dell’s desk top and his exercise regime and the fact that he doesn’t have a television in his house where he works out. THE COURT: Mr. 004, what were you talking about?
JUROR NO. 4: We talked about eating, and he has to pay so much money to eat here all the time, and that he’s doing a good job as an officer; in other words, I wouldn’t want to be in his possession [sic] to be a cop or officer. I was talking about baseball. I was talking about my neighbor. That’s it. Just surface talk.
THE COURT: Ms. 022, what were you talking about?
JUROR NO. 9: I asked him how long he thought it would be before we would get back into court to start deliberating.”
At the evidentiary hearing, the judge questioned all the jurors one by one as to whether the conversation would influence their judgment or cause them to regard Mundell’s testimony any differently. All the jurors testified that encounter would not affect their deliberations.
The judge denied the defendant’s subsequent motion for a mistrial as follows:
“THE COURT: [The jurors] have all indicated ... that the conversation that they had with Detective Mundell will not influence their judgment in this case as to Mr. Caliendo. I will accept their representations. I accept everybody’s representation. I’ve heard no indication whatsoever that anything about the facts of the case or any of the parties in this case were discussed whatsoever. I know what you’re saying. It’s a very unfortunate situation. It should not have happened but it did happen. Detective Mundell should know better. He certainly should have known better.
“But I will accept the jurors at their word that they will not let whatever conversation they had with Detective Mundell influence their judgment in the case as to whether or not Mr. Caliendo, based upon the evidence that has been introduced here in court, is either guilty or not guilty of these charges. So the motion for a mistrial will be denied.”
The jury began deliberating shortly before the noon recess on Thursday, August 8, 1996. During deliberations the jurors sent out a note requesting that portions of Mundell’s testimony be reread. On Monday, August 12, they returned with a guilty verdict.
Caliendo appealed. The California Court of Appeal observed that the conversation with Mundell was “improper and fraught with the danger of improper influence and communication of extraneous information.” Nevertheless, the court re*1150jected Caliendo’s juror misconduct claim on the grounds that he had not established actual prejudice on the facts. The California Supreme Court denied review.
Caliendo then filed a petition for writ of habeas corpus. The district court, adopting the report and recommendation of the Magistrate Judge, denied the petition on its merits with prejudice. The report and recommendation emphasized that the improper conversation was an “isolated incident” and did not concern the trial. The district court, however, granted a certificate of appealability with respect to the question whether prejudice should be presumed where three jurors had an improper twenty-minute conversation, factually unrelated to the trial, with a key prosecution witness.
II. STANDARD OF REVIEW
We review de novo a district court’s decision to deny a habeas petition. See Alcala v. Woodford, 334 F.3d 862, 868 (9th Cir.2003). We also review de novo allegations of juror misconduct and prejudicial impact in habeas cases. See Rodriguez v. Marshall, 125 F.3d 739, 744 (9th Cir.1997); Thompson v. Borg, 74 F.3d 1571, 1573 (9th Cir.1996). We presume state court findings of fact to be correct unless the petitioner rebuts them with clear and convincing evidence. See 28 U.S.C. § 2254(e)(1).
Under the Antiterrorism and Effective Death Penalty Act of 1996 (“AEDPA”), 28 U.S.C. § 2254(d), a petitioner for writ of habeas corpus must demonstrate that the state court’s adjudication on the merits 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 was “based on an unreasonable determination of the facts in light of the evidence presented.” The state court’s decision is “contrary to” clearly established federal law if the state court “applies a rule that contradicts the governing law set forth in [Supreme Court] cases” or if it “confronts a set of facts that are materially indistinguishable from a decision of this Court and nevertheless arrives at a result different from our precedent.” Early v. Packer, 537 U.S. 3, 123 S.Ct. 362, 365, 154 L.Ed.2d 263 (2002) (quoting Williams v. Taylor, 529 U.S. 362, 405-06, 120 S.Ct. 1495, 146 L.Ed.2d 389 (2000)). The state court’s decision involves an “unreasonable application of’ clearly established federal law if the state court identifies the correct governing legal principle from the decisions of the Supreme Court, but unreasonably applies that principle to the facts of the ease. See Williams, 529 U.S. at 407-08, 120 S.Ct. 1495.
III. DISCUSSION
A. Juror misconduct claim
Petitioner Caliendo argues that the California Court of Appeal’s decision was contrary to clearly established Supreme Court law because the court did not presume prejudice in evaluating the impact of the conversation between Detective Mundell and the three jurors. We agree that the state court’s analysis was framed erroneously, but we uphold the denial of Calien-do’s habeas petition on the basis of the trial court’s findings and our analysis of the record.
More than a century ago, in Mattox v. United States, 146 U.S. 140, 142, 13 S.Ct. 50, 36 L.Ed. 917 (1892), the Supreme Court overturned a murder conviction on Sixth Amendment grounds in part because the bailiff had told the jury during deliberations that “this is the third fellow [the defendant] has killed.” The Mattox Court announced that “private communications, possibly prejudicial, between jurors and third persons, or witnesses, or the officer *1151in charge, are absolutely forbidden, and invalidate the verdict, at least unless their harmlessness is made to appear.” Id. at 150,13 S.Ct. 50.
In Remmer v. United States, 347 U.S. 227, 228, 74 S.Ct. 450, 98 L.Ed. 654 (1954), the Supreme Court reversed a conviction under Mattox when it was shown that during the trial someone had told the jury foreman that he could profit by acquitting the defendant. The Court in Remmer held that Mattox’s “presumption is not conclusive, but the burden rests heavily upon the Government to establish, after notice to and hearing of the defendant, that such contact with the juror was harmless to the defendant.” Id. at 229, 74 S.Ct. 450.2
Lower federal courts have held that Mattox established the bright-line rule that any unauthorized communication between a juror and a, witness or interested party is presumptively prejudicial, but that the government may overcome the presumption with a strong contrary showing. See United States v. O’Brien, 972 F.2d 12, 13-15 (1st Cir.1992) (upholding a guilty verdict but applying the Mattox presumption where a police officer who was a potential prosecution witness, but who did not testify, spoke with three jurors during a recess about matters unrelated to the case); United States v. Williams, 822 F.2d 1174, 1188 (D.C.Cir.1987) (upholding a guilty verdict but stating that the Mattox presumption is “operable even if the communication at issue consisted only of ‘banter’ not clearly directed at influencing the jury’s verdict”); United States v. Armstrong, 654 F.2d 1328, 1331-33 (9th Cir.1981) (upholding guilty verdicts but applying the Mattox presumption where a juror’s husband had taken two obscene phone calls at home from an unidentified third party who said, “Tell your wife to stop hassling my brother-in-law at court”); United States v. Betner, 489 F.2d 116, 117-19 (5th Cir.1974) (ordering a new trial under Mattox because the prosecutor conversed with the jury panel during a recess and the trial court failed to conduct an adequate hearing).
Lower courts have explained that the Mattox rule safeguards defendants’ Sixth Amendment rights to a fair trial and to confront and cross-examine witnesses. See Agnew v. Leibach, 250 F.3d 1123, 1133 (7th Cir.2001) (because of improper contact, the jury “had the opportunity to develop confidence in [the witness’s] word in ways that were not subject to cross-examination or the right of confrontation”); Rinker v. County of Napa, 724 F.2d 1352, 1354(9th Cir.1983) (applying the Mattox rule to a civil action and recognizing that the “harm inherent in deliberate contact or communication can take the form of subtly creating juror empathy with the party and reflecting poorly on the jury system”); United States v. Harry Barfield Co., 359 F.2d 120, 124(5th Cir.1966) (declaring that “[o]ur system of trial by jury presupposes that the jurors be accorded a virtual vacuum wherein they are exposed only to those matters which the presiding judge deems proper for their consideration”).
In cases where improper contact with jurors has been de minimis, courts have departed from Mattox and placed the bur*1152den on the defendant to establish actual prejudice. These eases demonstrate that if the contact does not raise even a risk of influencing the verdict, the Mattox presumption does not come into effect. See United States v. Day, 830 F.2d 1099, 1103 (10th Cir.1987) (stating that “[a] defendant must offer sufficient evidence to trigger the presumption of prejudice”); see, e.g., Lee v. Marshall, 42 F.3d 1296 (9th Cir.1994) (two police officers, one of them the investigating officer in the case, entered the jury room during deliberations without the court’s permission to set up a VCR to replay a witness’s testimony); Johnson v. Wainwright, 778 F.2d 623 (11th Cir.1985) (sheriff had a dual role as bailiff and assistant to the prosecution); Helmick v. Cupp, 437 F.2d 321 (9th Cir.1971) (three arresting sheriffs deputies, one of them a prosecution witness, drove the jurors to the scene of the crime after being designated by the trial court as bailiffs for that purpose).
This line of cases, however, applies only to juror misconduct which is de minimis, as opposed to misconduct which creates the potential for prejudice. The Mattox presumption applies when an unauthorized communication with a juror is possibly prejudicial in light of the totality of the circumstances.3
The California Court of Appeal did not identify or apply the clearly established Mattox rule. The court relied on the California Supreme Court’s decision in People v. Cobb, 45 Cal.2d 158, 287 P.2d 752 (1955), to hold that no presumption of prejudice applied in Caliendo’s case because the improper conversation did not directly relate to the trial. Instead of requiring the government to clearly establish that no prejudice resulted from the incident, the court placed the burden on the defendant to prove prejudice. In an unpublished opinion, the court found that he had not done so. “The record as a whole discloses no reasonable probability of actual harm to appellant,” the Court of Appeal concluded. “No topic discussed by Mundell and Jurors 4 or 5 had any tendency to reflect upon or bolster Mundell’s credibility, and every juror said that he or she would not be influenced by the conversation between Mun-dell and members of the jury.”
The state court’s failure to presume prejudice on this record was contrary to Mattox. The Mattox Court spoke in categorical terms, mandating that “possibly prejudicial” out-of-court communications between jurors and outside parties “invalidate the verdict, at least unless their harmlessness is made to appear.” Mattox, 146 U.S. at 150, 13 S.Ct. 50. Nothing in Mattox suggests that for the rebuttable presumption of prejudice to attach, the substance of the improper contact must relate to the trial. Rather, as we have previously noted, “[i]n questions about jury incidents, we are ultimately not so concerned with their nature as with the prejudice they may have worked on the fairness of the defendant’s trial.” Armstrong, 654 F.2d at 1332.
Whether an unauthorized communication between a juror and a third party concerned the case is but one factor in determining whether the communication raised a risk of tainting the verdict. Other factors may include the length and nature of the contact, the identity and role at trial of the parties involved, evidence of actual *1153impact on the juror, and the possibility of eliminating prejudice through a limiting instruction. In weighing these factors we accord some deference to the findings of the trial judge, who is in the best position to determine whether possibly prejudicial misconduct took place and, if so, whether the government clearly established harmlessness.4
This improper contact was possibly prejudicial because Mundell was a critical prosecution witness and his interaction with multiple jurors lasted for 20 minutes. Although the conversation did not directly concern the trial, the misconduct — like the juror misconduct in Harry Barfield — went beyond “a mere inadvertent or accidental contact involving only an exchange of greeting in order to avoid an appearance of discourtesy.” Harry Barfield, 359 F.2d at 124; see also Day, 830 F.2d at 1104(a juror and a federal agent who sat at the prosecutor’s table exchanged a “casual, time-of-the-day greeting” in the men’s room). Mundell’s recollection of Calien-do’s confession was the only evidence that Caliendo broke into the car, and the case was close enough that Caliendo’s first jury hung. The Magistrate Judge’s report recognized that the improper contact between Mundell and the jurors created the “potential for prejudice.” Thus, because the misconduct raised a risk of prejudice, the California Court of Appeal’s failure to apply a rebuttable presumption of prejudice was contrary to the governing law set forth by the Supreme Court in Mattox.
While the state appellate court determined that no prejudice resulted from the incident, we may not simply defer to this finding. AEDPA’s presumption of correctness does not apply to state court findings arrived at through the use of erroneous legal standards. See Fernandez v. Roe, 286 F.3d 1073, 1077 (9th Cir.2002); Wade v. Terhune, 202 F.3d 1190, 1197 (9th Cir.2000). The state appellate court employed an incorrect standard when it placed the burden of proof on the defendant instead of the government. We therefore review de novo the correct question of whether the government met its heavy burden of proof under Mattox and Remmer. See Thompson, 74 F.3d at 1573.
We hold that the government rebutted the Mattox presumption by making a strong contrary showing that the contact between Mundell and the three jurors was harmless. “[T]he innocuous nature of a contact will have great bearing on the question whether prejudice has actually occurred.” Williams, 822 F.2d at 1188 n. 147. Although the detective’s credibility was a key issue, ultimately, as the California Court of Appeal observed, “[n]o topic discussed by Mundell and Jurors 4 or 5 had any tendency to reflect upon or bolster Mundell’s credibility.” The trial judge, who is best equipped to evaluate matters of prejudice, conducted an eviden-tiary hearing consistent with Remmer, 347 U.S. at 229-30, 74 S.Ct. 450, and denied the defendant’s motion for a mistrial with a finding that the jurors would not be influenced by the improper conversation. We accord considerable deference to this *1154finding. See Armstrong, 654 F.2d at 1332. Four important facts supported the trial court’s ruling: (1) the contact between Mundell and the jurors was a one-time encounter; (2) nothing related to the facts of the case or the parties involved was discussed; (3) the judge admonished the jurors not to allow the encounter to influence their judgment; and (4) all the jurors said that their judgment would not be influenced by the encounter. Significantly, the jury did not rush to judgment but deliberated for two and one-half days.
We are satisfied that the government clearly established lack of prejudice. Consequently, we affirm the district court’s denial of relief.
B. Eighth Amendment claim
Caliendo also argues that his sentence of twenty-five years to life constitutes cruel and unusual punishment under the Eighth Amendment. This argument is foreclosed by the Supreme Court’s decision in Lockyer v. Andrade, 538 U.S. 63, 123 S.Ct. 1166, 155 L.Ed.2d 144 (2003).
AFFIRMED.