dissenting:
Were I simply to disagree with the weight to be given the evidence, or the conclusions drawn therefrom, I would not further encumber the Federal Reports by writing a dissent. It is because I see this case as being controlled by 28 U.S.C. § 2254(d)(1), whereas the majority apply section 2254(d)(2), that I respectfully dissent. When judges’ criteria pass each other without acknowledgment, like ships on a dark night, at least one should blow a horn.
Next, were the relevant legal issues whether Buckley “understood” or “knew” or “believed” he was pleading to a “15 years to life” sentence rather than a “15 years maximum” sentence, I would agree with the majority. There is sufficient evidence in the record made before the Ven-tura County Superior Court on the habeas hearing so that its finding that Buckley “well knew” he was pleading to “15 years to life” was not “unreasonable.” 28 U.S.C. § 2254(d)(2).1
But the proper focus of enquiry is not on section 2254(d)(2), but on section 2254(d)(1).2 At the time of the state habe-as proceeding, clearly established Federal law, as determined by the Supreme Court, made the interpretation and construction of a plea agreement a matter of state law. Ricketts v. Adamson, 483 U.S. 1, 5 n. 3, 107 S.Ct. 2680, 97 L.Ed.2d 1 (1987) (holding that “the construction of the plea agreement and the concomitant obligations flowing therefrom are, within broad bounds of reasonableness, matters of state law”). Under California law, plea agreements are governed by the rules of contract law. People v. Toscano, 124 Cal.*1162App.4th 340, 20 Cal.Rptr.3d 923, 926 (2004) (“a plea agreement is interpreted according to the same rules as other contracts”).
When the sentencing judge failed either to sentence Buckley according to the parties’ intent as objectively manifested in the agreement or to give Buckley an opportunity to withdraw his plea, the sentence imposed violated Buckley’s constitutional rights because it rendered his plea involuntary. The breach of a plea agreement by failing to properly advise a criminal defendant of his potential sentence is a violation of due process. Santobello v. New York, 404 U.S. 257, 262, 92 S.Ct. 495, 30 L.Ed.2d 427 (1971). Where a defendant is misled as to the consequences of his plea, it renders the plea involuntary. Williams v. Taylor, 529 U.S. 420, 431-33, 437-38, 120 S.Ct. 1479, 146 L.Ed.2d 435 (2000).
By looking at the subjective understanding of one of the parties to interpret the plea agreement, rather than looking at the objective manifestation of the parties’ intent as California law requires, the state court based its decision on irrelevant evidence and reached an irrelevant determination of fact. What a party to a contract “knew or did not know” is irrelevant where, as here, there are no claims of mistake, misrepresentation or fraud.
Rather, the proper analysis under California law is: (1) What were the terms of the plea bargain at the time the contract was formed? (2) Was there a valid modification of those terms? (3) Did the trial judge either (a) sentence the defendant in accordance with the terms of the plea bargain, or (b) advise the defendant that the judge would not do so and give the defendant an opportunity to withdraw his guilty plea?
When analyzed according to the applicable California contract law, the evidence shows that a contract was formed that specified a determinate prison term of 15 years with the possibility of life parole. Any attempted modification of that contract to change the prison term to “15 to life” was invalid for lack of new consideration.3 However, Buckley was not sentenced according to the agreed upon terms in the plea bargain, nor was he given an opportunity to withdraw his guilty plea. Accordingly, I would affirm the district court’s grant of habeas corpus, albeit not on the rationale used by the district court.
I
We review the district court’s decision to grant a 28 U.S.C. § 2254 habeas petition de novo as we do issues of law, including the proper application of the law to the facts. Nunes v. Mueller, 350 F.3d 1045, 1051 (9th Cir.2003). We review findings of fact made by the district court for clear error. Id. “We may affirm the district court’s decision on any ground supported by the record, even if it differs from the district court’s rationale.” Id.
II
Under both federal and California law, “[p]lea agreements are contractual in nature and are measured by contract law standards.” United States v. De la Fuente, 8 F.3d 1333, 1337 (9th Cir.1993) (citation omitted). See also People v. Toscano, 20 Cal.Rptr.3d at 926 (following Ninth Circuit law) (“a plea agreement is interpreted according to the same rules as other contracts”); People v. Knox, 123 Cal.App.4th 1453, 20 Cal.Rptr.3d 877, 880 (2004) (in construing the terms of a plea agreement, courts should employ contract *1163law standards and “should first look to the specific language of the agreement”) (citation omitted). Federal law requires that the plea bargain agreement in this case be analyzed in terms of California contract law. De la Fuente, 8 F.3d at 1337; see also, Ricketts, 483 U.S. at 5 n. 3.
The subjective understanding of one of the parties, no matter how accurately delved, is irrelevant to the formation of a contract, unless a mistake is alleged. 1 WITKIN SUM. OF CAL. LAW § 365 (9th ed.1990). Rather, where ambiguities as to the parties’ objectively manifested intent exist, California law is clear: the California Civil Code provisions for interpretation of contract ambiguities must be followed and must be followed in the order provided in the Civil Code. Bank of the West v. Superior Court, 2 Cal.4th 1254, 10 Cal.Rptr.2d 538, 833 P.2d 545, 551-52 (1992).
A. Plain Meaning
Under California contract law, one first looks at the plain meaning of the agreement. CAL. CIV. CODE § 1644 (“The words of a contract are to be understood in their ordinary and popular sense, rather than according to their strict legal meaning.”). Here, the written contract4 has two conflicting terms in it. In one paragraph, it states: “I could be sentenced to the state prison for a maximum possible term of 15 years(s).... After I have served my prison term, I may be subject to a maximum parole period of Life.” These paragraphs were initialed by Buckley. But another paragraph states: “At the time of sentencing the people will move the court to declare the murder to be murder in the second degree, with a maximum term of 15 years to life.” This paragraph was handwritten, unlike all other portions of the Felony Disposition Statement, which were typewritten. It was initialed only by the prosecution, not by Buckley.5
Buckley submitted a declaration to the state court stating that at the time he accepted the offer by signing the plea agreement, this latter paragraph stating he could be sentenced to “15 years to life” was not in the plea agreement. However, his and his counsel’s signatures appear at the end of the document, after the handwritten paragraph Buckley did not initial. And the prosecutor testified at the district court hearing, that it was his usual custom and practice to fill out all portions of the plea agreement before sending it to the *1164defense attorney, although he had no independent recollection of this plea agreement. If one were to assume that the prosecutor followed his usual practice in this case, a trier of fact could reasonably find there are directly conflicting provisions in the plea agreement. Thus, an ambiguity remains in the written contract.
B. Reasonable Expectation of Promisee
When an ambiguity remains in the wording of the contract after application of the plain meaning rule in section 1644, under Bank of the West, supra, the next step is to go to California Civil Code section 1649, which states: “If the terms of a promise are in any respect ambiguous or uncertain, it must be interpreted in the sense in which the promisor[here, the prosecutor] believed, at the time of making it, that the promisee [here, Buckley] understood it.” Now the evidence from the colloquy becomes relevant. At the change of plea hearing on January 4, 1988, the prosecutor, reading from the plea agreement, asked Buckley if he understood that he was to be sentenced to “a maximum possible term of 15 years” with the possibility of parole for life. Buckley responded: ‘Tes.” Shortly thereafter, the prosecutor said: “Now as I stated before [sic: the prosecutor had stated no such thing] and it’s also contained in this Felony Disposition form, that at the time of sentencing the people will ask the Court to declare the murder to be murder in the second degree with a maximum term of 15 years to life.” 6 Here again, the terms conflicted.
The prosecutor then asked Buckley if he agreed to testify as a witness for the state against two other defendants and Buckley responded: ‘Tes.” Buckley’s final answer in this exchange cannot reasonably be interpreted to mean that he was agreeing to a sentence of 15 years to life because he was never directly asked that question.7 Hence, the ambiguity still remains.
C. Contra Proferentem (Against the Drafter)
If the ambiguity is not resolved by the analysis set forth in sections 1644 and 1649, then Bank of the West tells us one must look to California Civil Code section 1654, which states: “In cases of uncertainty not removed by the preceding rules, the language of a contract should be interpreted most strongly against the party who caused the uncertainty to exist.” See also Bank of the West, 10 Cal.Rptr.2d 538, 833 P.2d at 551-52; Toscano, 20 Cal.Rptr.3d at 926 (“ambiguities are construed in favor of the defendant”). Here, finally, there is no ambiguity.
It is undisputed that the prosecutor drafted both the December 15, 1987 letter and the Felony Disposition Statement comprising the plea agreement. Accordingly, under section 1654, the plea agree*1165ment must be construed in Buckley’s favor as providing for a determinate sentence of 15 years maximum, with life parole.
By failing to analyze the plea agreement under California contract law, the state superior court failed to apply clearly established federal law as set forth by the Supreme Court. 28 U.S.C. § 2254(d)(1); Ricketts v. Adamson, 483 U.S. at 5 n. 3, 107 S.Ct. 2680. “[W]hen a plea rests in any significant degree on a promise or agreement of the prosecutor, so that it can be said to be part of the inducement or consideration, such promise must be fulfilled.” Santobello v. New York, 404 U.S. 257, 262, 92 S.Ct. 495, 30 L.Ed.2d 427 (1971).8
Here, because the plea agreement is ambiguous, it must be construed in favor of Buckley and against the prosecution. Therefore, even on the state court record alone, Buckley’s interpretation must prevail, and his sentence is a determinate sentence of 15 years, with the possibility of life parole.
In support of his interpretation, Buckley’s declaration submitted with his habeas petition showed that he thought the terms “15 years with a parole period of life” and “15 years to life” meant the same thing since the prosecutor himself used the terms interchangeably. The district court found Buckley’s testimony credible because he had not initialed the handwritten paragraph and the prosecutor did not have a clear memory of the events.
Although superfluous under our analysis because neither mistake nor modification are properly before us, the district court found Buckley’s belief that his maximum possible sentence was a determinate term of fifteen years was reasonable under the circumstances. The district court also found that Buckley had no reason to suspect that the prosecutor had attempted to change the terms of the plea agreement until a probation officer finally informed Buckley that the term “15 to life” meant he could serve a life sentence in prison. This finding is not clearly erroneous. See Nunes, 350 F.3d at 1052.
Once the prosecutor realized he had made a mistake, he had several opportunities to remedy it. Upon realizing that he had said “a maximum possible term of 15 years” when he meant to say “15 to life,” the prosecutor could have corrected his mistake and made certain that Buckley understood the difference before Buckley’s guilty plea was accepted and before Buck*1166ley testified, at some risk to his life, at the trials of Fauber and Caldwell. Having failed to correct his mistake in time, and having taken advantage of Buckley’s reliance on the original terms of the contract by obtaining the benefit of Buckley’s testimony at the other trials, the state is now estopped from arguing that the plea agreement should not be enforced. See People v. Collins, 45 Cal.App.4th 849, 864-865, 53 Cal.Rptr.2d 367 (1996). When a guilty plea is entered in exchange for specified benefits, both parties must abide by the terms of the agreement. Id. at 862-63, 53 Cal.Rptr.2d 367; Santobello v. New York, 404 U.S. at 262, 92 S.Ct. 495 (1971).
Ill
The constitutional violation occurred when the sentencing judge failed to either sentence Buckley in accordance with the terms of his plea agreement, or give Buckley an opportunity to withdraw his plea. The judge was not free simply to alter the terms of the plea agreement, even unwittingly.
At the March 1, 1988 sentencing hearing, the trial judge said he intended to follow the recommendation in the plea bargain. The prosecutor stated for the record that Buckley had complied with all the terms of the plea agreement: “He has been a cooperative witness in all of the phases of the Fauber trial and he has testified at the preliminary hearing in the case against Christopher Caldwell.” After a discussion about Buckley’s concerns for his safety, the possible options for where to house him, and the nature of the crime, the court sentenced Buckley to “15 years to life” with “a parole term for the rest of your natural life once you would be released from the state prison facility.” No objection was made to the sentence as imposed. Although the sentencing judge indicated an- intent to sentence Buckley in accordance with the plea agreement, Buckley’s sentence of fifteen years to life does not correctly reflect the terms of the plea agreement.
California law gives the defendant the ability to opt out of the plea bargain if the court does not approve of the recommended sentence. See CAL. PENAL CODE § 1192.5; Brown v. Poole, 337 F.3d 1155, 1159 (9th Cir.2003). This does not render the terms of the plea bargain any less enforceable. Brown, 337 F.3d at 1160-61.
When accepting a guilty plea the trial court must assure that the defendant understands the consequences of his plea. See CAL. PENAL CODE § 1192.5.9 Prior to sentencing, the judge should have made certain that Buckley either agreed to the indeterminate term, or given Buckley the opportunity to withdraw his guilty plea. The judge should have clarified the terms of the plea agreement when the prosecutor first stated that Buckley could be sentenced to a “maximum possible term of 15 years,” with parole for life, and later said Buckley could be sentenced to a “maximum term of 15 years to life.” See Brown *1167v. Poole, 337 F.3d at 1161 (holding that a prisoner was entitled to specifically enforce an oral plea agreement for seven and a half years, even though she would not ordinarily be eligible for parole for ten years under the law). Even though no one appeared to notice this switch in the terms of the contract, “[t]hat the breach of agreement was inadvertent does not lessen its impact.” Santobello, 404 U.S. at 262, 92 S.Ct. 495.
The failure properly to advise a criminal defendant of his potential sentence is a violation of due process which renders his plea involuntary. Williams, 529 U.S. at 431-33, 437-38, 120 S.Ct. 1479; Santobello, 404 U.S. at 262, 92 S.Ct. 495.
rv
Finally, the state argues that even if this court finds that the plea agreement was breached, the appropriate remedy is to remand the case back to state court so that Buckley can change his plea to not guilty and stand trial for the offense. Although such a remedy might commend itself where a similar error is discovered early in the proceedings, Buckley has already testified for the state in the Fauber and Caldwell trials. He has nothing with which to bargain for a new plea. Most importantly, he has already served more than 15 years. Accordingly, the only remedy that would give Buckley the benefit of his bargain is specific performance. See Brown, 337 F.3d at 1161-62 (where Brown had already served the agreed upon sentence, “Brown has met the terms of the agreed-upon bargain, and paid in a coin that the state cannot refund. Rescission of the contract is impossible under such circumstances; Brown cannot conceivably be returned to the status quo ante. That leaves specific performance as the only viable remedy.”). Accordingly, I dissent, and would affirm the grant of habeas, to allow Buckley to remain at liberty.
. Similarly irrelevant is whether the district court should have held an evidentiary hearing. I quite agree with the majority: it was not necessary to develop the construction of the plea agreement.
. Under 28 U.S.C. § 2254(d)(1), a habeas petition should be granted where the state court opinion “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.” Throughout the majority opinion there is no analysis of whether the state court decision violated clearly established federal law so as to fall within 28 U.S.C. § 2254(d)(1).
. The phrase "15 to life" means an indeterminate prison term for a minimum of 15 years to a maximum of life, subject to an early release at the discretion of The Board of Prison Terms, California's parole board.
. The plea offer letter dated December 15, 1987, together with the Felony Disposition Statement, constituted an offer which required acceptance in a form certain: Buckley was to initial certain required paragraphs, sign and date the offer. Once an offer is accepted in the form required, a contract exists. See Palo Alto Town & Country Village, Inc. v. BBTC Co., 11 Cal.3d 494, 113 Cal.Rptr. 705, 521 P.2d 1097, 1098-99 (1974). True it is that the plea agreement is not effective as a basis for sentencing unless and until accepted by the sentencing judge. Toscano, 20 Cal.Rptr.3d at 926; People v. Rhoden, 75 Cal. App.4th 1346, 1354, 89 Cal.Rptr.2d 819 (1999). But once the terms of the contract are ascertained by rules of contract interpretation, and the plea agreement and plea are accepted by the sentencing judge, the sentence must be based on that agreement, regardless the prosecutor's wish to change the terms of the agreement. Toscano, 20 Cal.Rptr.3d at 927. In addition, the verbal exchange on January 4, 1988, could not have constituted a modification to the agreement already formed on December 17, 1987, because the prosecutor did not offer, nor did Buckley bargain for or accept, any new consideration. See CAL. CIV. CODE § 1698.
. The majority asserts that this paragraph was added to the Felony Disposition Statement before Buckley pleaded guilty. All the record shows is that this paragraph was added at some point in time — but when it was added is unknown. What we do know is that neither Buckley nor his attorney initialed the paragraph, and Buckley agreed only that he had read each paragraph he initialed, not this added paragraph.
. This exchange between the prosecutor and Buckley reminds one of another famous exchange:
"When I use a word," Humpty Dumpty said, in rather a scornful tone, "it means just what I choose it to mean — neither more nor less.”
"The question is," said Alice, "whether you can make words mean so many different things.”
"The question is,” said Humpty Dumpty, "which is to be master — that's all.”
Lewis Carroll, Through the Looking Glass and What Alice Pound There, in THE ANNOTATED ALICE: THE DEFINITIVE EDITION 213 (Martin Gardner ed., Norton Publishers) (2000).
. From the exchange between the prosecutor and Buckley, it is clear that Buckley agreed to cooperate in the trials of two other defendants. The prosecutor’s representations and his voir dire of Buckley in the presence of the court were not for the purpose of forming a contract, but to assure the court Buckley understood the terms of the agreement as required under California law. CAL. PENAL CODE § 1192.5.
. Another, but not essential, way of looking at this is based on Taylor v. Maddox, 366 F.3d 992, 1001 (9th Cir.2004). Once the superior court focused on what Buckley “understood, knew or believed” (his subjective knowledge) rather than the objective manifestation of the parties’ intent as documented in their written offer and acceptance, the superior court's fact-finding process was not only wrong, it was unreasonable. 28 U.S.C. § 2254(d)(2). Taylor v. Maddox did not limit our review of the state court's fact-finding process to whether the state court needed to hold a hearing. The state court's fact-finding process is also unreasonable under 28 U.S.C. § 2254(d)(2):
where the state court does make factual findings, but does so under a misapprehension as to the correct legal standard. See, e.g., Caliendo v. Warden, 365 F.3d 691, 697-98 (9th Cir.2004); Fernandez v. Foe, 286 F.3d 1073, 1077 (9th Cir.2002); Wade v. Terhune, 202 F.3d 1190, 1197 (9th Cir.2000). Obviously, where the state court's legal error infects the fact-finding process, the resulting factual determination will be unreasonable and no presumption of correctness [under 28 U.S.C. § 2254(e)(1)] can attach to it.
Taylor, 366 F.3d at 1001. That is exactly what happened here. The state court — and the majority — seek to interpret the terms of the plea agreement by one party’s subjective understanding, rather than the objective manifestation of the parties' intent. Accordingly, the state court's construction of the plea agreement is not entitled to the special deference under 28 U.S.C. § 2254(e)(1) that the majority opinion gives to it.
. "Where the plea is accepted by the prosecuting attorney in open court and is approved by the court, the defendant, except as otherwise provided in this section, cannot be sentenced on the plea to a punishment more severe than that specified in the plea and the court may not proceed as to the plea other than as specified in the plea. If the court approves the plea, it shall inform the defendant prior to the making of the plea that (1) its approval is not binding, (2) it may, at the time set for hearing on the application for probation or pronouncement of judgment, withdraw its approval in the light of further consideration of the matter, and (3) in that case, the defendant shall be permitted to withdraw his or her plea if he or she desires to do so. The court shall also cause an inquiiy to be made of the defendant to satisfy itself that the plea is freely and voluntarily made, and that there is a factual basis for the plea.” CAL. PENAL CODE § 1192.5.