
697 N.W.2d 295 (2005)
13 Neb. App. 519
STATE of Nebraska, appellee,
v.
Peter J. ALBA, appellant.
No. A-04-1125.
Court of Appeals of Nebraska.
May 10, 2005.
*298 Casey J. Quinn, Omaha, for appellant.
Jon Bruning, Attorney General, and Susan J. Gustafson, for appellee.
INBODY, Chief Judge, and IRWIN and SIEVERS, Judges.
SIEVERS, Judge.

INTRODUCTION
Peter J. Alba appeals the sentencing order of the Douglas County District Court after his plea of nolo contendere to two counts of sexual assault of a child, first offense, for which he was sentenced to 5 to 10 years' imprisonment on count I and 10 to 15 years' imprisonment on count II, the sentences to run consecutively. The appeal centers on the fact that the State, defense counsel, and the judge treated the crimes in the plea bargain as Class II felonies when they in fact were lesser crimes, Class IV felonies. Alba asks that he be resentenced under the lesser penalties for Class IV felonies. The State argues that we should void the plea agreement, remand the cause, and essentially allow the prosecution to start over because the State did not get the benefit of its plea bargain. We hold that when there is a mistake of law in the plea agreement, the risk of such mistake falls on the State. Thus, the plea agreement must be upheld, and Alba is entitled to be resentenced according to the law applicable to Class IV felonies, which is the correct gradation of the crimes in the plea agreement.

FACTUAL AND PROCEDURAL BACKGROUND
On October 28, 2003, Alba was charged by information with two counts of second offense sexual assault of a child, Class IC felonies, pursuant to Neb.Rev.Stat. § 28-320.01(3) (Cum.Supp.1996). Count I alleged that "on or about the 1st day of January, 1997," Alba subjected B.A., "a person of less than fourteen years of age or younger, to sexual contact." Count II alleged that "on or about the 1st day of January, 1997," Alba subjected Z.A., "a person of less than fourteen years of age or younger, to sexual contact."
On August 5, 2004, pursuant to a plea agreement, the State amended the information to allege each count as a first offense, which the State and the judge said made each count a Class II felony. The amended information expressly categorizes the crimes as Class II felonies. At the plea hearing, the trial judge, without objection from defense counsel or the State, advised Alba about the crimes and their penalties as though the crimes were Class II felonies, telling Alba that the crimes each carried a maximum prison sentence of 50 years and a minimum prison sentence of 1 year. Alba entered a plea of nolo contendere and was advised by the judge that he was pleading no contest to two Class II felonies, each of which carried a sentence as described above. A factual basis was entered, Alba's pleas were accepted, and an order was entered on September 27, 2004, sentencing Alba to imprisonment for 5 to 10 years on count I *299 and for 10 to 15 years on count II, the sentences to be served consecutively. Alba appeals the sentences to this court.

ASSIGNMENTS OF ERROR
Alba asserts that the trial court erred by imposing an excessive sentence on each count.

STANDARD OF REVIEW
Whether an appellate court is reviewing a sentence for its leniency or its excessiveness, a sentence imposed by a district court that is within the statutorily prescribed limits will not be disturbed on appeal unless there appears to be an abuse of the trial court's discretion. State v. Hamik, 262 Neb. 761, 635 N.W.2d 123 (2001). A judicial abuse of discretion exists only when the reasons or rulings of a trial judge are clearly untenable, unfairly depriving a litigant of a substantial right and denying a just result in matters submitted for disposition. Id.

ANALYSIS

Statutory Penalty in Effect at Time of Crime Controls.
Under § 28-320.01, first-offense sexual assault of a child at the time of the crime was a Class IV felony, but the statute was later amended to change first-offense sexual assault of a child to a Class IIIA felony. See 1997 Neb. Laws, L.B. 364 (operative date July 1, 1998). Alba contends that because the crimes set forth in the information were alleged to have occurred on or about January 1, 1997, the version of § 28-320.01 classifying first-offense sexual assault as a Class IV felony controls here.
We agree that the penalty provisions of § 28-320.01 in effect at the time of the alleged crimes set forth in the amended information, which provisions made first-offense sexual assault of a child a Class IV felony, are controlling, rather than the legislative amendment operative July 1, 1998, which made the crimes Class IIIA felonies. See State v. Gray, 259 Neb. 897, 612 N.W.2d 507 (2000) (law which creates or enhances penalties that did not exist when offense was committed is unenforceable ex post facto law).

Effect of Mistake in Plea Agreement.
Alba contends that his sentences are illegal because they are not authorized for the crimes to which he pled no contest as part of the plea agreement. Alba's sentences were the result of a mistake in the proceedings by which the original charges were reduced from second-to first-offense sexual assault of a child, but the amended charges were wrongfully treated as Class II felonies and treated as such by the State, the trial judge, and defense counsel. While the punishment for a Class II felony is 1 to 50 years' imprisonment, no such sentence is authorized for a first-offense violation of § 28-320.01, which is what Alba pled to and was found guilty of. Thus, the sentences imposed were illegal because they were not authorized under § 28-320.01 and because they exceed the 5-year maximum sentence authorized at the time of Alba's crimes of first-offense sexual assault of a child. A sentence is illegal when it is not authorized by the judgment of conviction or when it is greater or less than the permissible statutory penalty for the crime. U.S. v. Greatwalker, 285 F.3d 727 (8th Cir.2002). See, also, State v. Lotter, 255 Neb. 456, 586 N.W.2d 591 (1998) (sentence imposed was invalid in that maximum period of incarceration specified exceeded that which was authorized by statute), cert. denied 526 U.S. 1162, 119 S.Ct. 2056, 144 L.Ed.2d 222 (1999); State v. Hedglin, 192 Neb. 545, *300 222 N.W.2d 829 (1974) (minimum portion of sentence was void as being in excess of minimum authorized by statute). Accordingly, we must vacate Alba's sentences.
However, because the sentences were the result of a plea agreement, we must determine whether such agreement must also be vacated, as the State contends, or whether the remedy is to order resentencing of Alba for the correct gradation of the crimes to which he pled. We note that Alba does not complain of any due process violation from the obvious mistake made by his defense counsel, the State, and the trial judge in classifying the crime as a Class II felony instead of a Class IV felony. While the trial judge was clearly remiss in his duty to correctly advise Alba about the applicable penalties, Alba does not assign such as error. See State v. Irish, 223 Neb. 814, 394 N.W.2d 879 (1986) (record must support finding that plea of guilty has been entered freely, voluntarily, intelligently, and understandingly, which includes ensuring that defendant understands range of penalties). Obviously, he could not have relied, to his prejudice, on an incorrect advisory stating a much more severe penalty than was lawful. Therefore, while the penalty advisory was plainly error, it was not prejudicial, and by asking to be resentenced under the correct statute, Alba has also waived such error.
In contrast, the State requests that we vacate the plea agreement in its entirety, because doing so would "return both parties to the status quo ante." Brief of appellee at 14. The State complains that it was prejudiced because when it entered into the agreement, "the statutory sentencing range applicable to a Class II felony was an essential element of the agreement between the parties." Id. at 15. The essence of the State's argument is that the State made the agreement because under it, Alba could still receive severe sentences, yet the victims and their families would be spared from testifying.
To support this argument, the State refers us to the sentencing hearing, during which the prosecutor commented:
[T]he reduction of the charge was done with no reflection on a reduction in sentence. It was done to prevent th[e] family from having to go through a trial.... [T]hat decision by the family was not done with a reduction in sentencing in mind. It was done solely to save the child and th[e] family from the ordeal of a trial, because we felt that even the reduced charge carried enough exposure... that the Court would have at its discretion enough time toenough exposure to make the appropriate ruling.

Plea Agreements as Contracts:

Parties' Reasonable Expectations.
In State v. Howe, 2 Neb.App. 766, 778, 514 N.W.2d 356, 365 (1994), we stated:
"`A plea bargain is a contract, the terms of which necessarily must be interpreted in light of the parties' reasonable expectations. The resolution of each case depends upon the essence of the particular agreement and the Government's conduct relating to its obligations in that case.'" United States v. Fields, 766 F.2d 1161, 1168 (7th Cir.1985).
Consistent with the view of plea agreements as contracts, the Nebraska Supreme Court has said that in dealing with a prosecutor's breach of a plea agreement, when the breach has been properly preserved for review, the defendant may be entitled to withdrawal of the plea or to specific performance. See State v. Birge, 263 Neb. 77, 638 N.W.2d 529 (2002). These remedies are obviously concepts from the law of contracts, but this case does not involve a prosecutor's breach of a plea agreement.
*301 Therefore, we turn to the parties' reasonable expectations in reaching their bargain, and the emphasis is properly on "reasonable." While the State's representative argued at sentencing that the plea agreement was based on avoidance of trial for the family rather than on reduction of sentence, we find that such position is inherently illogical. A reasonable prosecutor is bound to know that reduction in a charge via a plea agreement necessarily carries with it a reduction in the judge's sentencing discretion under the Nebraska sentencing scheme. Neb.Rev.Stat. § 28-105 (Cum.Supp.2004), which classifies felonies by punishment, reveals that beginning with the most serious and proceeding to each descending class of felony, each lower gradation carries a lesser possible sentenceeven if it is only in regard to the lower limit of the sentencing range. For example, a Class IC felony (as originally charged herein) carries a range of 5 to 50 years' imprisonment, whereas a Class II felony (two grades lower) carries a range of 1 to 50 years' imprisonment.
Accordingly, although the State suggested to the trial court, and now argues to this court, that the State's agreement to the lesser charges was not based on reduction of sentences, some measure of possible sentence reduction was inherent in the agreement, even when the mistaken classification is considered. It is well established that a judge is not bound to give a defendant the sentence recommended by a prosecutor under a plea agreement. See State v. Griger, 190 Neb. 405, 208 N.W.2d 672 (1973). It is equally true that absent an abuse of discretion, the trial court's sentences stand. Finally, in considering the State's "benefit of the bargain" argument, we remember that as a practical matter, the minimum portion of an indeterminate sentence is that which measures the severity of the sentence. See State v. King, 196 Neb. 821, 246 N.W.2d 477 (1976). Here, even under the State's mistaken belief that it was reducing the charge from a Class IC felony to a Class II felony, the lower limit of the sentencing range would be reduced from 5 years to 1 year, or by 80 percent. Thus, the State's argument that no reduction in sentence was contemplated as part of the plea bargain must fail because such was not a reasonable expectation, since the reduction in charge carries a reduction in the sentencing judge's discretion. In summary, our decision is not determined by the State's statements at sentencing when such statements are inherently flawed, at least for the purpose of creating a "reasonable expectation" at sentencing. Admittedly, if the crimes were truly Class II felonies, the judge would have retained discretion of up to 50 years' imprisonment on the upper limit of the sentence, but discretion on the lower limit would be substantially reduced, and as said, it is the lower limit of an indeterminate sentence which determines its severity.
The State's expectation that Alba would be subjected to two terms of 1 to 50 years' imprisonment after Alba pled no contest to two counts of first-offense sexual assault of a child is a fundamentally unreasonable expectation, because such a sentence is not a lawful sentence. Paradoxically, while Alba could hardly have expectations of a lesser sentence when everyone involved the judge, the State, and his own lawyer were talking about a sentence of 5 to 50 years' imprisonment, we think that due process requires that we attribute to Alba the minimum reasonable expectation for his sentencing: that it would be lawful.

What Is Remedy for Plea Agreement With Incorrect Gradation of Crimes in Agreement?
We begin the heart of our analysis by noting that there are a variety of permutations *302 of fact patterns with flawed plea agreements which involve unauthorized sentences as a result of someone's mistake. See Annot., 87 A.L.R.4th 384 (1991), and cases cited therein. While we cannot detail all such cases, we summarize by noting that different jurisdictions have taken different approaches to the problem but that outcomes are largely fact specific.
The State's position is that if we apply the contract theory of plea negotiations as stated in State v. Howe, 2 Neb.App. 766, 514 N.W.2d 356 (1994), then we must conclude that the State did not receive the benefit of its bargain with Alba and that we should remand the cause with directions that the plea agreement be set aside. The State relies heavily upon State v. Boley, 32 Kan.App.2d 1192, 95 P.3d 1022 (2004), a case where the defendant was originally charged with manufacture of methamphetamine or, in the alternative, attempted manufacture of methamphetamine and with conspiracy to manufacture methamphetamine. The prosecution agreed to dismiss all of the charges except the attempted manufacture of methamphetamine and to recommend a downward durational departure sentence of 48 months, which constituted a "severity level 1 penalty," in exchange for the defendant's plea. Id. at 1193, 95 P.3d at 1024. After the plea but before sentencing, the defendant objected to the imposition of the severity level 1 penalty and argued that his conviction should carry the less severe level 3 penalty. This claim was rejected by the trial court, but on appeal, the appellate court found that the defendant was in fact entitled to a drug severity level 3 penalty. The Kansas Court of Appeals said that therefore, the "primary issue ... concerns the State's ability to withdraw from the plea bargain after the case is remanded for resentencing." Id. at 1194, 95 P.3d at 1024. The Boley court found that the defendant and the State, in making their agreement, had relied upon the bases that the defendant would be convicted of a severity level 1 felony and that the State would recommend a downward departure sentence of 48 months. The Boley court found the agreement for the downward departure recommendation "meaningless," because the severity level 1 penalty carried a presumptive sentencing range of 138 to 204 months. Id. at 1194, 95 P.3d at 1025. The Boley court cited an earlier decision in State v. Boswell, 30 Kan.App.2d 9, 37 P.3d 40 (2001), where the Kansas Court of Appeals held that an unconstitutional upward durational departure sentencing recommendation did not implicate the defendant's due process rights, because such term of the plea agreement provided an inducement to the State, not the defendant. Consequently, the Boswell court found that the defendant's inducement to enter the plea remained unaffected by the declaration that the departure sentence was unconstitutional. Relying upon Jolly v. State, 392 So.2d 54 (Fla.App. 1981), the Boswell court held:
[W]hen a plea agreement includes an agreement to recommend to the court an illegal sentence, the sentencing court imposes the recommended but illegal sentence, and the illegal sentence impermissibly increases the defendant's term of imprisonment, the State may either allow the defendant to withdraw his or her guilty plea, or agree that the illegal portion of the sentence be vacated and the defendant be resentenced to the proper lesser term.
(Emphasis omitted.) 30 Kan.App.2d at 14, 37 P.3d at 44-45. However, Boley and Boswell are fundamentally distinguishable from the present case because no sentence recommendation was involved in the plea agreement in Alba's case.
In State v. Boley, 32 Kan.App.2d 1192, 95 P.3d 1022 (2004), the court also *303 relied heavily upon U.S. v. Bunner, 134 F.3d 1000 (10th Cir.1998), cert. denied 525 U.S. 830, 119 S.Ct. 81, 142 L.Ed.2d 64, where the defendant had agreed to plead guilty to an offense which the U.S. Supreme Court subsequently held was not criminalized by the pertinent statutes. The Bunner court reasoned that the defendant's remaining performance under the plea agreement held no value to the government and therefore frustrated the government's basis for entering into the plea agreement and that this provided the government an opportunity to escape its obligations under the agreement, if it so desired. In speaking about Bunner, the Boley court stated, "[T]he intervening change of law which frustrated the Government's intent in entering the plea agreement caused the agreement to become voidable." 32 Kan.App.2d at 1198, 95 P.3d at 1027. In the instant case, there is no intervening change of law by an appellate court which impacts the parties' agreement.
Applying Bunner, the Boley court referenced the fact that the parties agreed the State would recommend a downward durational departure sentence of 48 months, but stated that the defendant, by successfully challenging his severity level conviction under the ruling in State v. McAdam, 277 Kan. 136, 83 P.3d 161 (2004), would receive a new sentence of 17 to 19 months. The Boley court admitted that while the State had not lost its entire "bargained-for value," the significant reduction in sentence "clearly frustrates the State's intended purpose in seeking a plea to a conviction under [Kan. Stat. Ann. §] 65-4159(a). Consequently, the plea agreement should be deemed voidable at the discretion of the prosecutor." Boley, 32 Kan.App.2d at 1199, 95 P.3d at 1027. After reaching this result, the Boley court acknowledged that "[o]ther jurisdictions have taken a different approach." Id. The Boley court then discussed State ex rel. Gessler v. Mazzone, 212 W.Va. 368, 572 S.E.2d 891 (2002).
In Mazzone, supra, the West Virginia appellate court first said that the dismissal of some charges as well as the defendant's guilty pleas constituted two components of the plea agreement, but that they were inextricably intertwined. The Mazzone court then said when one component collapses, such as "the ability of the court to legally sentence ... as contemplated in the plea agreement, then the other countervailing component, i.e., the dismissal, must also collapse [because t]he `bargain' become[s] impossible, through mutual mistake regarding statutory realities." Id. at 374, 572 S.E.2d at 897. The West Virginia appellate court held:
Where a plea agreement cannot be discharged due to legal impossibility, the entire agreement must be set aside. The [defendant] cannot choose which portions are advantageous to him and implore this Court to apply only those certain portions. There is no equity in that result, no semblance of a bargain, and certainly no public policy which would support such a result.
Id. Accord State v. Boley, 32 Kan.App.2d 1192, 95 P.3d 1022 (2004). The facts of the case before us do not show impossibility of performance, given that the agreement was for a no contest plea in exchange for a reduction in the gravity of the offenses second offense to first offenseand that no particular sentence was part of the agreement. And, we bear in mind that even under a Class II felony (had it been lawful), Alba could still have received a sentence of 1 to 5 years' imprisonment, given the judge's sentencing range for Class II felonies and that such sentence would be the essential equivalent to the maximum sentence for a Class IV felony. In any event, the agreement with Alba did not include a specific term of imprisonment *304 or probation as did the agreement in Boley, supra. And, there was no impossibility of performance of the agreement with Alba as there was with the agreement in Mazzone, supra.
Nonetheless, despite its decision, the Boley court acknowledged that where there is a mistake of law in a plea agreement, the risk of the mistake may fall to the prosecutor, who is presumed to be in a better position to know the applicable law, citing U.S. v. Barron, 172 F.3d 1153 (9th Cir.1999), and Coy v. Fields, 200 Ariz. 442, 27 P.3d 799 (Ariz.App.2001). The ultimate holding of the Boley court was as follows:
Under the circumstances of this case, the State could not know our Supreme Court would rule that [Kan. Stat. Ann. §] 65-4159(a) and [Kan. Stat. Ann. §] 65-4161(a) proscribed identical conduct. As such, it is inequitable to apply such a presumption [that the State is in the best position to know the law] in this case.
In conclusion, where a defendant has successfully challenged a sentence for a conviction subject to a plea on the basis that the sentence impermissibly increases the defendant's term of imprisonment beyond that permitted by law and resentencing would effectively frustrate the State's purpose in entering the plea agreement, the State may, in its discretion, withdraw from the plea agreement or choose to perform under the plea agreement as modified.
32 Kan.App.2d at 1200, 95 P.3d at 1028.
Boley, supra, is a materially different case from the instant case, because what made the sentence impermissible in Boley was not a mistake of law by the parties to the plea agreement, but, rather, an unanticipated ruling by the Kansas Supreme Court. In the instant case, the factual pattern is far simpler, because the State, defense counsel, and the judge all treated the amended charges as higher grade felonies than they actually were. Moreover, there is no impossibility of performance here, and it is a relatively simple matter to resentence Alba for two Class IV felonies. Thus, we turn to those cases which we think are most on point, where there is a straightforward mistake of law in the plea agreement.
In Coy v. Fields, 200 Ariz. 442, 27 P.3d 799 (Ariz.App.2001), Frederick John Coy was originally charged with kidnapping and two counts of sexual abuse. He entered into a plea agreement with the State of Arizona, pleading guilty to one count of unlawful imprisonment, a Class VI felony. The agreement further provided, "`If probation is granted, [Coy] may be placed on lifetime probation pursuant to [a specified Arizona statute].'" Id. at 443, 27 P.3d at 800. The trial judge accepted the plea and imposed a term of probation of 15 years. Coy then challenged his sentence, asking to reduce the probation term to 3 years, because the maximum term of probation for a Class VI felony under Arizona law was 3 years. The State asserted that Coy should be bound by the terms of his plea agreementlifetime probationor, alternatively, that the State be allowed to withdraw from the plea agreement.
In Coy, supra, the Arizona Court of Appeals first found that the trial court had no jurisdiction to impose a probationary sentence not authorized by the legislature and that thus, the judge was obligated either to reduce the probationary term to 3 years or less or to set aside the sentencing, which the trial judge had done. The court then turned to the question of whether the State should be allowed to withdraw from the plea agreement. The court stated that the pivotal question was whether Coy had breached the agreement because he agreed to an extended probationary term when he accepted the agreement, *305 yet subsequently challenged the enforceability of that provision. The Arizona court rejected the argument that Coy had breached the agreement and said that Coy was not prohibited from alerting the trial court that it had imposed an illegal term of probation. The State of Arizona, similarly to the State of Nebraska in this case, argued that under contract principles, setting aside the plea agreement was appropriate because the prosecutor had dropped the sex-based charges in the indictment as a concession to allow Coy to keep his job. In exchange, Coy agreed to the extended probation which the State of Arizona felt was necessary for the public's protection. Thus, the State argued that the nullification of the lengthy probationary provision frustrated the purpose of the plea agreement and thus warranted its rescission.
In rejecting the State's argument, the Coy court relied principally on a Utah case, State v. Patience, 944 P.2d 381 (Utah App.1997), which we discuss separately later. In Coy, 200 Ariz. at 446, 27 P.3d at 803, the court held:
We, too, hold the state accountable for knowing Arizona law when it negotiates, drafts, and enters into plea agreements. We agree with the court in Patience that the state bears the risk when, as here, a sentencing or probation provision in one of its plea agreements proves to be illegal and unenforceable. Of course, had there been an allegation and finding below that [Coy] had negotiated or entered into the plea agreement in bad faith, never intending to comply with the terms of the agreement or knowing that a probationary term of more than three years was impossible, the state's withdrawal from the plea would have been appropriate. See [State v.] Taylor [, 196 Ariz. 549, 2 P.3d 108 (Ariz.App.1999)] (defendants must deal in good faith before they can attempt to claim benefits of contract law in plea agreement disputes). Because there was no valid ground on which the state was entitled to withdraw from the plea agreement, the respondent judge abused his discretion in setting the plea agreement aside.
We now turn to Patience, supra, where the defendant was charged with three counts of forgery and subsequently entered into a plea agreement with the State of Utah whereby she pled guilty to "three counts of attempted forgery, third degree felonies." 944 P.2d at 383. The trial court imposed consecutive prison terms for the three third degree felonies, but as in the instant case, the court, the prosecutor, and the defendant were apparently unaware that before the parties had negotiated and entered into their plea agreement, the Utah Legislature had reduced attempted forgery to a misdemeanor. As in the instant case, in Patience, the defendant appealed her sentence on the ground it was illegal and the State of Utah countered by seeking to rescind the plea agreement on the ground of mutual mistake and by asking that the original charges be reinstated. For analytical purposes, the facts in Patience, supra, and the facts in this case are identical. In refusing to rescind the plea agreement, the Patience court noted that the defendant had neither breached the agreement nor withdrawn or modified it, conditions which generally would have permitted the State to withdraw. The Patience court held that rescission was inappropriate even under a contract law analysis, citing 17A Am. Jur.2d Contracts § 215 (1991) for the general rule that a party may not rescind an agreement based on mutual mistake where that party bears the risk of mistake. In Patience, 944 P.2d at 388, the Utah court held:
In this case, we conclude the State bore the risk of the mistake as to the law in effect at the time the parties entered *306 into the plea agreement. The State is generally in the better position to know the correct law, given that the State has control over the charges in the information and final say over whether to accept a defendant's plea, and the State must be deemed to know the law it is enforcing. Indeed, it is the State's law, duly enacted by its legislative branch, that is in issue. The State must be charged with knowledge of its own legislative enactments and, in that sense, cannot be said to have been mistaken about the governing statute in effect when it agreed to the plea arrangement. Cf. Osborne v. State, 304 Md. 323, [339,] 499 A.2d 170, 178 (1985) ("`The State must be held to be aware of the common law and the statutes of Maryland ... and it should have bargained with [the defendant] accordingly. We will not allow the State to rescind this plea agreement merely because it made a bad bargain.'").
Placing the burden on the State to be aware of the current provisions of the Utah statute under which defendant was charged is consistent with the constitutional concerns involved in plea agreements, as discussed above. Further, we note that this is not a situation where the law was not clear on its face, or where the State was somehow induced into the mistake about the law. Under these circumstances, we refuse to relieve the State of what it now considers a bad bargain where the plea agreement was the result of uninduced mistake as to the current provisions of Utah statute.
The foregoing holding from the Utah court describes exactly the situation involved here. We cannot logically write any pronouncement except that when engaging in plea bargaining, the prosecutor is bound to know the classification of the felony (and its penalties) that he or she is agreeing will be the amended charge. Plea bargaining is a well-established and, by now, virtually indispensable reality of the prosecution of criminal offenses. We hold the prosecution to the standard of knowing the gradation of offenses involved in a plea agreement, because knowing such is a fundamental part of the prosecutor's duties and because it is only a reasonable expectation. The risk of a mistake of law concerning the gradation of offense must rest on the prosecution when the plea agreement is capable of being performed and when a reasonable expectation of the prosecution did not form the basis of the agreement, thus frustrating the upholding of the agreement.
Given that defense counsel and the judge were operating under the same mistake, Alba, as an individual, cannot by any stretch of the imagination be said to have induced the State to enter into this agreement. In fact, Alba is really the only person involved in the plea agreement, and the plea itself, who cannot be faulted for not knowing that first-offense sexual assault of a child is not a Class II felony. Obviously, the State now considers its plea bargain a "bad bargain," and it now seeks a "do-over" so that it can recharge Alba with the two counts of sexual assault of a child, second offense, carrying a penalty of 5 to 50 years' imprisonment per count. But, in exchange for Alba's plea, the State knowingly agreed to reduce the charges carrying such penalty to charges of first offense. At the time of the crime, the penalty for first-offense sexual assault of a child was a term of imprisonment for 0 to 5 years. See § 28-105 (Reissue 1995). And, the crimes the State agreed would be the charges to which Alba would plead two counts of first-offense sexual assault of a childwere indisputably Class IV felonies. The only range of penalties authorized by law for the offenses charged in the amended information as a result of the *307 plea bargain is 0 to 5 years' imprisonment, a $10,000 fine, or both. See id. The State is charged with knowing this. While the State was mistaken, it bears the risk of its own mistake. The State made the agreement with Alba that he would plead no contest to reduced charges, and a particular sentence was not part of the agreement. The State's expectations regarding sentencing were inherently unreasonable, as said earlier, and thus form no basis for rescission of the agreement. Alba is entitled to a lawful sentence based on the charges of which he and the State agreed that he would stand convicted.
We are fully aware that there are different approaches in different jurisdictions to what we can generically and broadly refer to as "plea bargain problems," and we have described some of those cases. Yet, the fact remains that the only authorities we have found completely on point are Coy v. Fields, 200 Ariz. 442, 27 P.3d 799 (Ariz.App.2001), and State v. Patience, 944 P.2d 381 (Utah App.1997). The approach of these two cases is rational and logical. Any other approach would reward careless prosecutorial work and impair the inviolability of plea agreements upon which the modern criminal justice system in all American jurisdictions depends so heavily. The victims in this case and the public may not have been well served. Nonetheless, we cannot write around the fact that prosecutors must be held to know the very simple and fundamental law essential to their dutiesthe classification of the felonies involved in the plea bargains they are about to strike. Thus, we place the risk of the mistake of law here on the State.
Ultimately, we merely enforce the only reasonable expectation that the parties could have, which is that a lawful sentence under § 28-320.01 would be imposed for the crimes charged as a result of the plea bargain. This places upon the State the burden of the mistake of law. The lawful sentence of imprisonment here is 0 to 5 years. When the State is culpable in creating an illegal sentence in an otherwise lawful plea agreement, we reject the proposition that the remedy is that the parties be returned to where they were before the plea agreement. Instead, fundamental fairness and the analogous contract principles require that we allow the defendant to retain the benefit of his plea bargain and be lawfully sentenced.

CONCLUSION
We vacate Alba's sentences and remand the cause to the trial court with directions to resentence Alba for two counts of sexual assault of a child, first offense, giving proper credit for time served.
SENTENCES VACATED, AND CAUSE REMANDED FOR RESENTENCING.
IRWIN, Judge, dissenting.
Although I agree that Alba's sentences must be set aside and the case remanded for further proceedings, I do not agree with the disposition proposed by the majority, and I therefore dissent. I do not agree that the appropriate remedy is to place the burden of the mutual mistake made by Alba, the State, and the trial court solely on the State and allow Alba to unilaterally benefit from the mutual mistake by being sentenced in a fashion nobody had contemplated or agreed to when entering the plea agreement. I believe the appropriate remedy is to withdraw the plea as invalid and allow the parties to negotiate an entirely new plea agreement.
It is important to emphasize that the majority opinion recognizes that the tenets of State v. Irish, 223 Neb. 814, 394 N.W.2d 879 (1986), were not complied with because Alba was not properly advised concerning *308 the potential range of penalties to which his plea would subject him. It is fundamental in the plea-taking process that the trial court must examine the defendant and determine that he understands the range of penalties for the crime with which he is charged. See id. As such, the failure of the district court in this case to properly advise Alba concerning the range of penalties necessitates that the plea be withdrawn entirely. This is also consistent with the State's requested resolution of this case.
The Nebraska Supreme Court has clearly held that the State may withdraw from a plea bargain agreement at any time prior to, but not after, the actual entry of the guilty plea by the defendant or other action by him constituting detrimental reliance upon the agreement. See, State v. Dillon, 224 Neb. 503, 398 N.W.2d 718 (1987); State ex rel. Fortner v. Urbom, 211 Neb. 309, 318 N.W.2d 286 (1982). Inasmuch as no plea has validly been entered or accepted, the law in Nebraska clearly indicates that the State has the lawful ability to withdraw the plea agreement for any reason or, indeed, without giving a reason at all. See State ex rel. Fortner v. Urbom, supra. It is only more apparent that the State should have that right in this case, where it is clear that both Alba and the State were operating under a mutual mistake of law when negotiating the plea agreement.
The effect of the majority opinion is to suggest that plea agreements are essentially only for the benefit of the defendant and that the defendant is the only one who can assert prejudice from a mutual mistake in the plea process. There is little doubt that on this exact same fact pattern, the defendant would be entitled to withdraw his plea because of the failure to comply with State v. Irish, supra. The basis for allowing such a withdrawal would simply be that the plea was not valid because the tenets of State v. Irish had not been complied with. This is no less true where everyone, the court included, was mistaken concerning the law and the offense gradation that was central to the plea agreement and its negotiation. It is notable that the majority cites to no authority for the proposition that although "the penalty advisory was plainly error," the error can simply be overlooked because the defendant received the benefit of a mutual mistake that he was part of creating. The majority concludes that Alba has "waived" any such error. However, the majority offers no explanation for why this error should simply be overlooked on the one hand and why on the other hand, "due process requires" that we attribute to Alba the expectation that his sentence would be within a range not contemplated by anyone involved in the plea process, even though Alba "does not complain of any due process violation" from the mutual mistake.
The primary authority that is relied upon by the majority for allowing the defendant to benefit from this mistake is distinguishable. In State v. Patience, 944 P.2d 381 (Utah App.1997), the court recognized that the prosecutor is usually allowed to unilaterally rescind a plea agreement only where the defendant has breached the agreement. However, the authority relied on by the Utah court in reaching that conclusion was a case where the plea had lawfully been accepted and the State subsequently failed to comply with provisions of the agreement, not a case where the plea itself was not valid. See State v. Copeland, 765 P.2d 1266 (Utah 1988). A careful review of State v. Patience indicates that the Utah court's decision to order a new sentence, rather than to find the plea itself was invalid, was motivated primarily because the factual circumstances demonstrated that the legislature *309 had changed the gradation of the offense after the information was filed and that by law, the defendant was entitled to the benefit of that change in legislation. Such is not the situation in the present case where, rather than being a legislative change, the error in the plea agreement was simply a mutual mistake by everyone involved concerning the proper gradation of the offense.
In Coy v. Fields, 200 Ariz. 442, 27 P.3d 799 (Ariz.App.2001), the court similarly ordered that a new sentence be imposed and remanded the case for a new sentence. However, the Arizona court noted that the sentencing court would be free to impose a harsher sentence and deny probation entirely. Although Coy v. Fields is similar to the present case in that the mutual mistake concerned the possible penalty which might be imposed, the Arizona case is also significantly different from the present case because in the present case, everyone involved was mistaken as to the entire range of penalties which might be imposed, whereas in Coy v. Fields, the mistake was merely concerning part of the potential sentence, if probation was actually imposed. And even to the extent Coy v. Fields supports the majority's position that the prosecutor bears some risk when everyone involved is equally mistaken during the plea negotiations, the result in Coy v. Fields was that the prosecutor was still able to receive the majority of the bargain negotiated and, in fact, the Arizona court even recognized that the new sentence to be imposed might be more harsh than what was initially imposed. The present case is far different, where the majority proposes to remove the State's negotiated range of sentences from two consecutive terms of 1 to 50 years' imprisonment and instead allow the defendant to choose a range of sentences of 0 to 5 years' imprisonment.
Moreover, I disagree with the notion that the State should be the party held solely responsible for the mistake in this case. Nobody involved with this case has disputed, and the majority recognizes, that everyoneincluding Alba (through his counsel), the State, and the trial courtwas mistaken concerning the proper gradation of the offense. Moreover, everyone agrees that the parties operated under this mistaken belief during the entire plea negotiation.
There is nothing in the record of this case to support the majority's speculation that the potential range of sentences which would be available to the sentencing court was not an important, or even crucial, factor in the State's willingness to enter a plea agreement and reduce the charges. The majority, while arguing that the minimum portion of the sentencing range would have been reduced from 5 years' imprisonment if the crimes had been prosecuted as the originally charged Class IC felonies to 1 year's imprisonment if the crimes were actually Class II felonies as the parties believed, then dismisses the fact that the maximum possible sentence under both gradations would have been the same50 years' imprisonment. Although it is often repeated in Nebraska case law that the minimum portion of an indeterminate sentence is the measure of the sentence's severity, the issue in this case is not the severity of a sentence imposed, but, rather, the importance of the possible sentencing range in persuading the State to reduce charges in the first place. The State's position in this regard is far from "inherently illogical," as the majority asserts, and is in fact entirely understandable and reasonable.
It has long been the law in Nebraska that "a person charged with the commission of a crime who has reached the age of accountability is conclusively presumed to *310 know the law of the land, including both common law and statutory law." Satterfield v. State, 172 Neb. 275, 280, 109 N.W.2d 415, 418-19 (1961). Inasmuch as it is axiomatic that ignorance is no excuse concerning the state of law, I cannot agree with the majority's assertion that Alba is "really the only person involved in the plea agreement, and the plea itself, who cannot be faulted for not knowing" the proper gradation of the offense. There is simply no support for the notion that a criminal defendant, especially one represented by counsel, is somehow not accountable for knowing the law when negotiating a plea agreement.
A review of the majority opinion makes it clear that there is a split of authority in other jurisdictions concerning the proper remedy for a situation such as the present one. Although the majority goes to great lengths to discuss and distinguish cases which would allow the State to rescind the plea agreement, there is no clear indication why the factual distinction that some of those cases involved specific recommendations for a sentence rather than a negotiated range of sentences like in the present case is a significant legal distinction. Further, the cases which support the notion that the State should not be allowed to rescind the agreement are just as "technically" distinguishable, as noted above in this dissent. The bottom line is that a reading of cases from other jurisdictions handling this problem suggests that the factual details brought out in the majority opinion and in this dissent were not the motivating factors in the cases' resolutions. Rather, the cases indicate a difference of opinion about whether to declare the plea itself invalid or to merely hold that the prosecutor made a bad bargain and should be accountable for it.
In the present case, the binding law of Nebraska dictates that Alba was never properly advised prior to acceptance of his plea. As such, the plea must be declared invalid and must be withdrawn. The binding law of Nebraska further holds that the State may unilaterally withdraw a plea offer at any time before the plea has been validly accepted, even for no reason whatsoever. As such, I would follow the guidance of our Supreme Court and apply it to the facts of this case to conclude that the case should be remanded and the plea be withdrawn. Both parties should be equally free to determine their own course of conduct at that stage.
