
613 N.W.2d 215 (2000)
STATE of Iowa, Appellee,
v.
Dennis Allen WOODY, Appellant.
No. 99-0301.
Supreme Court of Iowa.
July 6, 2000.
*216 Maria Ruhtenberg of Ruhtenberg Law Office, Des Moines, for appellant.
Thomas J. Miller, Attorney General, Jean C. Pettinger, Assistant Attorney General, Steven Johnson, County Attorney, and James W. Cleverley, Jr., Assistant County Attorney, for appellee.
Considered en banc.
LAVORATO, Justice.
Dennis Allen Woody appeals from his sentence as an habitual offender. He contends his trial counsel was ineffective because counsel failed to object to the use of the habitual-offender-sentencing statute. We vacate the sentence and remand for resentencing.
On July 10, 1998, the State filed a trial information, charging Woody with robbery in the first degree, a class B felony that carries a twenty-five-year prison term. *217 See Iowa Code §§ 711.1, .2, 902.9(1) (1995). The offense allegedly occurred on September 16, 1995. Later, the State amended the trial information by adding another count, alleging that Woody was an habitual offender. Woody and the State thereafter entered into a plea agreement whereby the State agreed to drop the original charge to second-degree robbery in return for his admitting to being an habitual offender. (Second-degree robbery is a class C felony and carries a ten-year prison term. See Iowa Code §§ 711.3, 902.9(3). The habitual offender enhancement provision carries a fifteen-year prison term, with a requirement that the defendant serve a minimum of three years. See Iowa Code §§ 902.8, 902.9(2).)
Woody pled guilty to the second-degree robbery charge and admitted that he had been convicted of a felony on two previous occasions. The district court sentenced him to an indeterminate term of fifteen years under Iowa Code sections 902.8 and 902.9(2).
On appeal, Woody contends the imposition of the habitual-offender sentence is illegal and that his trial counsel was ineffective for not objecting to it. He asks that we vacate the sentence and remand for sentencing on the second-degree robbery charge.
The State concedes that an enhanced sentence under Iowa Code sections 902.8 and 902.9(2) was not appropriate. The State, however, disagrees on what the appropriate remedy should be. The State believes we should vacate the sentence and allow Woody to withdraw his guilty plea. This remedy, the State points out, would put both parties in the positions they were in before Woody entered his plea. The State argues that it should then be allowed to reinstate the original charge because it was reduced in contemplation of Woody's admission to being an habitual offender. In the alternative, the State suggests we preserve Woody's ineffective-assistance-of-counsel claim for a possible postconviction relief action.
For reasons that follow, we agree with the remedy that Woody proposes.
When the State alleges that a defendant is an habitual offender, the State is not charging a separate offense. State v. Brady, 442 N.W.2d 57, 58 (Iowa 1989). This is because habitual-offender statutes do not charge a separate offense; they only provide for enhanced punishment on the current offense. Id. The accused therefore does not enter a plea of guilty to an habitual offender "charge." Id. Rather, the accused merely admits prior convictions for habitual offender purposes. Id.
What we have here, therefore, is an illegal sentence if the habitual-offender statutes do not apply. An illegal sentence is one that is not permitted by statute. State v. Hess, 533 N.W.2d 525, 527 (Iowa 1995). An illegal sentence is void and "not subject to the usual concepts of waiver, whether from a failure to seek review or other omissions of error preservation." State v. Ohnmacht, 342 N.W.2d 838, 842, 843 (Iowa 1983). Because an illegal sentence is void, it can be corrected at any time. See Iowa R.Crim. P. 23(5)(a) ("The court may correct an illegal sentence at any time."). We therefore need not resort to an analysis of Woody's ineffective-assistance-of-council claim to reach the issue but may proceed directly to the merits.
Iowa Code section 902.8 defines an habitual offender as
any person convicted of a class "C" or a class "D" felony, who has twice before been convicted of any felony in a court of this or any other state, or of the United States. An offense is a felony if, by the law under which the person is convicted, it is so classified at the time of the person's conviction. A person sentenced as an habitual offender shall not be eligible for parole until the person has served the minimum sentence of confinement of three years.
Iowa Code § 902.8. Iowa Code section 902.9(2) provides that an habitual offender *218 shall be confined for no more than fifteen years.
As both parties point out, section 902.8 is a recidivist statute designed "to punish violators who have not responded to the restraining influence of conviction and punishment." Hajek v. Iowa State Bd. of Parole, 414 N.W.2d 122, 123 (Iowa 1987). For this reason, such statutes apply only when the previous convictions precede the commission of the current offense. State v. Hollins, 310 N.W.2d 216, 217-18 (Iowa 1981) (interpreting Iowa Code section 902.8); State v. Conley, 222 N.W.2d 501, 503 (Iowa 1974) (holding under predecessor statute that the first conviction and imposition of sentence must precede the second offense, and that both of the prior convictions and impositions of sentences must precede the third conviction).
The proper sequence does not exist here. The State's allegation of habitual offender was based on convictions that occurred on February 9, 1981, and July 8, 1996. The second of those convictions occurred after September 16, 1995the date of the offense at issue here. The enhanced sentence was clearly not appropriate under sections 902.8 and 902.9(2) and is therefore void.
Neither party may rely on a plea agreement to uphold an illegal sentence. See Ohnmacht, 342 N.W.2d at 843; State v. Howell, 290 N.W.2d 355, 357-58 (Iowa 1980). If neither party may rely on the plea agreement, what remedy is appropriate here? Do we allow the State to reinstate the original charge or do we remand for sentencing on the reduced charge?
In State v. Hack, we faced a seemingly analogous situation. There we said the State could reinstate the charge because there was no factual basis for the plea of guilty to the offense charged. 545 N.W.2d 262, 263 (Iowa 1996). We allowed the reinstatement because the reduced charge was made in contemplation of a valid plea. Id.
Here, Woody did not plead to an habitual offender status because he could not. Rather, he pled guilty to robbery in the second degree and admitted the previous convictions. The plea was valid; only the sentence was illegal. In these circumstances, we think it is therefore appropriate to vacate the illegal sentence and remand for a correct sentence for robbery in the second degree.
There is a second good reason for this result. The State added the habitual-offender count, apparently to convince Woody to plead guilty. While we acknowledge the State had prosecutorial discretion to add the habitual-offender count, we think the State should bear the consequences of a decision that was based on the State's wrong assumption that the habitual-offender statute applied. In this case the consequences are that the State is "stuck" with the second-degree robbery conviction and may not reinstate the first-degree robbery charge.
SENTENCE VACATED; REMANDED FOR RESENTENCING.
All justices concur except NEUMAN, J., who takes no part.
