The Lane County Grand Jury indicted defendant on four counts. The state and defendant plea bargained and agreed that defendant would enter guilty pleas to reduced charges. The court accepted defendant’s plea petition and the matter was scheduled for sentencing. A dispute arose at sentencing that the parties could not resolve. The trial court, over defendant’s objection, set aside defendant’s guilty pleas pursuant to ORS 135.365 and set the case for trial. Thereafter, defendant was convicted by a jury of the four counts in the indictment: one count of first-degree robbery, ORS 164.415; two counts of second-degree theft, ORS 164.045; and one count of unauthorized use of a vehicle, ORS 164.135. On appeal, defendant contends, among other assignments of error, that the trial court erred in setting aside his guilty pleas over his objection. We agree with that contention and therefore vacate defendant’s convictions and remand the case for reinstatement of his guilty pleas and for sentencing in accordance with his plea agreement.
The facts are primarily procedural and undisputed. On December 1, 2005, the state filed an amended information charging defendant with various crimes. That same day, the state filed an allegation of aggravating circumstances justifying a departure sentence. The indictment alleging the current counts was filed on December 5, 2005. The state and defendant entered into plea negotiations facilitated by the trial court, and the parties agreed to the terms contained in a plea petition. The plea petition states, in part:
“The state agrees to accept the plea to Robbery in the Third Degree in lieu of Robbery in the First Degree. The state agrees to recommend that the misdemeanor sentences run concurrent with each other and concurrent with the felony sentences. The state is free to seek departure sentences that total no more than 50 months prison on the felony offenses. The defense is free to seek presumptive sentences and all concurrent sentences which would result in as little as 13 months prison.”
On December 13, 2005, in accordance with the plea petition, defendant pleaded guilty to third-degree robbery in lieu of first-degree robbery, as well as to the other charges contained *323in the indictment. The trial court accepted the plea and scheduled the case for sentencing.
Before sentencing, however, a dispute arose as to how the state would prove the enhancement fact (that defendant was on post-prison supervision at the time of the offense) to support a departure sentence. At a subsequent hearing, the trial court presented defendant with three choices regarding proof of the enhancement fact: trial to the court, a jury trial, or admission by defendant. Defendant refused to admit the enhancement fact and opted instead for a bench trial, waiving in writing his right to a jury.
The next day, when the matter came before the court for trial of the enhancement fact, defendant made an objection. He contended that the state had not filed a timely notice of its intent to seek a departure sentence on that enhancement fact within a reasonable time after the accusatory instrument was filed. See ORS 136.765 (providing that, in order to rely on an enhancement fact to increase a sentence, “the state shall notify the defendant of its intention to rely on the enhancement fact by: (1) Pleading the enhancement fact in the accusatory instrument; or (2) Within a reasonable time after filing the accusatory instrument, providing written notice to the defendant of the enhancement fact and the state’s intention to rely on it”). The state offered three responses: first, that defendant had, in fact, received written notice of the state’s intent, albeit before the indictment was filed; second, that defendant’s objection was untimely because he had already waived a jury with regard to proof of the enhancement fact; and third, that, “by the plea negotiations as well, [defendant was] precluded from raising that kind of issue at this point in time.”1
The court then inquired of defense counsel as to whether the possibility of a procedural objection was ever mentioned during the plea negotiations. Defense counsel *324stated that the matter was not discussed at all. The court then turned to the merits of the statutory construction question posed by the parties: whether the state’s earlier notice of an enhancement fact complied with ORS 136.765. In that regard, the court explained that it agreed with the state’s position that the notice was timely — that the statute had, in fact, “been complied with.” Nonetheless, the court explained,
“I don’t mean that to dismiss [defense counsel’s] argument. It’s actually a creative and a good argument * * *. And it would concern me enough that I would be, if the State wanted to say that with that argument out there hanging on appeal, that the circumstances of the negotiations weren’t acceptable to it anymore, and it just wanted to start back to square one, I would be willing to say let him withdraw his appeal and start back to square one, and let’s have a trial and see what happens. But I’m prepared to rule denying that, and I’ll give the State its choice as to what it wants to do at this point.”
The prosecutor accepted the court’s invitation to go back to “square one”:
“[PROSECUTOR]: * * * I was willing to stand by the negotiations at that point in time [when defendant was unwilling to admit the enhancement fact]. At this juncture, now where we’re taking this even a step further and basically having agreement where we can seek the departure sentence, but then now moving from procedural grounds to take away the mechanism that gets there, I think that that’s clearly contrary to what was contemplated by the parties in this particular negotiations, and unless defense counsel’s willing to withdraw the plea, I think that this matter should just be reset on the trial docket.
“THE COURT: You’re moving that the plea of guilty be withdrawn, right?
“[PROSECUTOR]: Your Honor had various options here—
“THE COURT: Well, tell me what you’re choosing.
“THE COURT: Yeah. Moving that the plea of guilty be withdrawn, and it be set on the trial docket.
[PROSECUTOR]: Yes. If they are still — yes. * * *.”
*325The court then addressed defendant’s counsel:
“THE COURT: He says that your objection to an enhanced — your legal objection to enhanced sentencing is not consistent with the negotiations. He’s moving that there’s not a meeting of the minds in terms of the plea, and he’s moving to ask that your plea of guilty be withdrawn and you be permitted to go to trial on the whole thing. That’s what he’s asking to do.
“[DEFENSE COUNSEL]: And so — well, so he’s saying for me to withdraw my objection—
“THE COURT: He hasn’t said any such thing. He’s moved to have your plea of guilty withdrawn and I think you should have a position to talk to your client about it and also to make any objections you want to make to that procedure.”
At that point, the prosecutor interjected that he was moving to withdraw the plea only if defendant did not withdraw the procedural objection to the departure sentences. The court then recessed so that defendant could consult with his counsel.
When the hearing resumed, defendant refused to withdraw his objection or his guilty pleas. Defense counsel explained that, as part of the plea, defendant “wasn’t giving up any legal objections that he might make at any point during the sentencing hearing which was contemplated by the settlement agreement.” Rather, defendant was “prepared to go forward with the sentencing hearing, and just in accordance with the agreement that he entered into that the court * * * approved and agreed to be bound by.” The prosecutor, in response, asked that the matter be put back on the court’s trial docket.
The court granted the state’s motion that the pleas be withdrawn, ruling as follows:
“THE COURT: All right. I refer all counsel — I treat this as a motion by the State pursuant to ORS 135.365, and any other statutes that might be applicable to cause the defendant to withdraw his plea. The statute provides as follows: The Court may at any time before judgment, upon a plea of guilty or no contest, permit it to be withdrawn and a plea of not guilty substituted therefor.
*326“Now, ordinarily the word ‘withdrawn’ would only be used in connection with the person that entered it, but I don’t think that’s the meaning of it. It doesn’t say that that’s a right that is limited solely to the defendant.
“Ordinarily equal protection of the law would mean that both parties have a right to do that. Here, it appears to the State and to the Court that the defendant is proceeding in a manner which is not consistent either with the plea agreement or, quite frankly, the interests of justice. And accordingly, the plea of guilty previously entered will be withdrawn. A plea of not guilty is entered on behalf of defendant. And again, I believe the Court has that right. The matter will be set for trial, and I’ll set it at the date and time suggested * *
Before the hearing concluded, defense counsel asked for an opportunity to object and reiterated defendant’s position: “[W]e do object to the Court’s rulings, and — because the deal was made and don’t believe — we object to the Court withdrawing his pleas of guilty. That would be something only [defendant] could do, himself, as we understand the law.” The court noted defendant’s objection but ultimately adhered to its ruling that “the plea of guilty previously entered will be withdrawn.”
Following the hearing, defendant moved for specific performance of his plea agreement, asked the court to vacate the order setting aside his guilty pleas, and moved to dismiss the charges against him on the ground that former jeopardy had attached as a result of his earlier pleas. The court denied those motions and defendant proceeded to trial on all four counts in the indictment. A jury convicted defendant on each count. Defendant was then sentenced to 90 months’ incarceration, plus three years of post-prison supervision on the first-degree robbery conviction, along with shorter sentences to be served concurrently with the first-degree robbery sentence on each of the remaining charges — a period of incarceration in excess of the 50-month maximum contemplated in the original plea agreement. This appeal followed.
On appeal, defendant assigns error to four trial court rulings: the setting aside of his guilty pleas; the denial of his motion to vacate the order setting aside his guilty pleas; the *327denial of his motion for specific performance on the negotiated plea petition; and the denial of his motion to dismiss due to former jeopardy under ORS 131.505 to 131.535 and Article I, section 12, of the Oregon Constitution.2 Because we agree with defendant’s contention that the trial court erred in setting aside his guilty pleas, our analysis begins and ends with defendant’s first assignment of error.
Defendant’s first assignment, once again, is that the trial court erred when it set aside his guilty pleas on the state’s motion. He reprises the objection he made below— that only defendant himself could withdraw the pleas — and argues that the trial court misconstrued ORS 135.365. That statute, which the trial court recited and relied upon, provides that “[t]he court may at any time before judgment, upon a plea of guilty or no contest, permit it to be withdrawn and a plea of not guilty substituted therefor.”3 ORS 135.365. In defendant’s view, that statute provides no authority for the trial court to set aside a guilty plea over a defendant’s objection.
The initial question before us is one of statutory construction, which we analyze by first examining the text of ORS 135.365 in context, along with any helpful legislative history offered by the parties. State v. Gaines, 346 Or 160, 171-72, 206 P3d 1042 (2009). If the meaning of the statute is unclear after that first step, we proceed to other interpretive aids. Id. In this case, neither party has offered any relevant legislative history, and we conclude that the text of ORS 135.365, when read in context with related statutes regarding guilty pleas, unambiguously refers to a defendant’s withdrawal of a plea.
*328On its face, ORS 135.365 purports to grant trial courts the authority to “permit” a guilty plea to be withdrawn. That phrasing, of course, suggests that someone other than the court is actually “withdrawing” the plea. And that makes sense, considering that the defendant, not the court, is the one who enters the plea of guilty in the first place. See ORS 135.335 (identifying the types of pleas that can be entered by a defendant); ORS 135.355 (describing the entry of the defendant’s plea in the court’s register); ORS 135.360 (explaining ways in which a court can “accept” pleas). Naturally, then, the defendant — and only the defendant — would be the one who would later seek to “withdraw” the guilty plea.
That understanding is confirmed by other statutes. ORS 135.390(4)(b), for example, provides, “If the court determines that the agreed disposition recommendation is inappropriate in a particular case, the court shall so advise the parties and allow the defendant an opportunity to withdraw the plea.” (Emphasis added.) Similarly, ORS 135.432(3) provides, in the context of plea negotiations:
“If the trial judge concurs [with the negotiations], but later decides that the final disposition of the case should not include the sentence concessions contemplated by the plea agreement, the trial court shall so advise the defendant and allow the defendant a reasonable time in which to either affirm or withdraw a plea of guilty or no contest.”
(Emphasis added.) Read in context with ORS 135.390 and ORS 135.432, the phrase “permit [the plea] to be withdrawn” governs the circumstance in which a defendant seeks to withdraw a previous plea of guilty or no contest; the statute does not provide any authority for the state, or the court on its own motion, to “permit [a plea] to be withdrawn” over a defendant’s objection. The trial court erred in concluding otherwise.
The state contends, alternatively, that the trial court was authorized to set aside the guilty pleas under ORS 135.395. That statute provides that, “[a]fter accepting a plea of guilty * * *, the court shall not enter a judgment without making such inquiry as may satisfy the court that there is a factual basis for the plea.” According to the state, “there was *329an insufficient factual basis for the plea because the plea was based upon an unenforceable plea agreement.” Nothing in the text of ORS 135.395 suggests that the “factual basis for the plea” encompasses facts surrounding the plea process itself. Rather, as the legislative history makes clear, the “factual basis for the plea” refers to facts concerning the defendant’s guilt — i.e., facts regarding whether the defendant committed the crime to which the defendant is pleading. See Commentary to Criminal Law Revision Commission Proposed Oregon Criminal Procedure Code, Final Draft and Report § 262, 157 (Nov 1972) (explaining that the “inquiry ensures that the defendant actually committed a crime at least as serious as the one to which he is willing to plead”). ORS 135.395 does not authorize a trial court to set aside a guilty plea on grounds related only to the plea negotiations themselves.
As another alternative basis for affirmance, the state submits that the trial court nonetheless possessed the inherent authority to set aside a guilty plea that had been “improperly entered.” That is, despite the trial court’s professed reliance on statutory authority to “withdraw” the pleas, the state nevertheless characterizes the ruling as an exercise of the court’s inherent authority. In its brief, the state argues, “Here, the court’s order accepting defendant’s guilty pleas was improper because the pleas were the result of an unenforceable agreement, and setting aside the pleas a few days later was merely an exercise of the court’s inherent authority to correct its own action.”
The problem with the state’s characterization is that the court did not purport to exercise any inherent authority to vacate or reconsider a previous order. The court, when presented with defendant’s procedural objection to the imposition of departure sentences, first entertained that objection on the merits. The court explained that it was prepared to rule in the state’s favor — i.e., rule that defendant had received adequate notice of the proposed enhancement factor under ORS 136.765. However, the court expressed some uncertainty about the correctness of that ruling and, at that point, solicited the state’s motion to withdraw the plea. The *330state was given a choice: The court would overrule the objection and proceed with sentencing according to the plea agreement or the court would “cause the defendant to withdraw his plea.” When the state opted for the latter, the court relied exclusively on statutory authority to grant the state’s motion to set aside defendant’s pleas.
Thus, the record does not demonstrate that the court exercised any inherent authority to “correct” its previous acceptance of the pleas. Rather, the court invited the state to move to have the pleas withdrawn, if the state wanted to proceed in that way. Had the court believed that its previous order had been erroneous — i.e., that the pleas should not have been accepted in the first place — it would not have given the state the option to proceed with sentencing on improperly accepted pleas. The court, instead, offered the state a statutory right to have the pleas withdrawn — a right that, as discussed above, does not exist.
Finally, the state contends that defendant “waived his right to the remedy he seeks on appeal.” Specifically, the state contends that,
“[a]fter setting aside defendant’s guilty pleas, the trial court repeatedly gave defendant the opportunity to reinstate his pleas. Each time, defendant refused, presumably because he believed he could try his luck at trial with the security that double jeopardy would bar the state from enforcing the conviction. Having lost the gamble, defendant now seeks reinstatement of his pleas.”
The state further contends that “[t]he court offered defendant the complete relief he now seeks, and he chose not to accept the offered relief as a tactical matter.” We are not persuaded that defendant voluntarily relinquished his right to be sentenced according to his original plea agreement. Indeed, defendant consistently maintained that he did not want his pleas withdrawn and that he would not reenter his guilty pleas.
Defendant certainly was given opportunities to reenter his pleas, but not under the original plea agreement. Rather, he was given the option of accepting a plea agreement based on terms that were acceptable to the state and *331the trial court — that is, under an agreement whereby defendant waived his objections to departure sentences. The court explained,
“Well, [defendant], let me just summarize for you. [The judge who participated in the plea negotiations] was willing to be bound to a 13 to 50 month range without any legal arguments about why the State could or couldn’t ask for 50 months. If your counsel interposes those objections, then that isn’t going to work. No judge is bound to that anymore.
“Now, [the judge who participated in the plea negotiations] was bound but didn’t want to sentence because he’d been involved in the sentencing negotiations. I had originally agreed to sentence pursuant to his bound deal but I am not going to sentence pursuant to his bound deal unless it is pursuant to his agreement of what the bound deal was. In other words, I’ll be bound to what [he] agreed that he would be bound to but that seems to be different than what you and [your attorney] thought the agreement was.
“So here’s the dilemma that the Court’s in now. This case is set for trial tomorrow. [The prosecutor] has a whole bunch of witnesses coming in. We’ve got jurors coming in. We need to know what we’re doing tomorrow. And there really are probably only two choices if the defendant wants to reinstate his guilty plea, wants to plead guilty again, based upon that understanding.”
Defendant responded, “I’m not, your Honor.”4
Whether defendant’s understanding of his original agreement was correct or not, he had the right to insist that he be sentenced according to the terms of the initial plea agreement and to retain his right to challenge on appeal the *332court’s rulings regarding that agreement. Ironically, it was defendant’s insistence on that right — not a waiver of it — that resulted in him being tried and ultimately sentenced beyond the terms contemplated in his original plea agreement. Accordingly, we reject the state’s contention that defendant waived his ability to challenge on appeal the trial court’s error in setting aside his guilty pleas.5
Thus, we conclude that the trial court erred in setting aside defendant’s guilty pleas over his objection. The remaining question is what to do about that error. As explained above, after defendant’s pleas were withdrawn, he was tried on various offenses, convicted of those offenses, and received departure sentences exceeding the sentences contemplated by the plea agreement. In light of our conclusion that defendant’s pleas should not have been set aside, those subsequent convictions and sentences must be vacated. On remand, the trial court should reinstate defendant’s guilty pleas and sentence defendant in accordance with his plea agreement.
Reversed and remanded with instructions to vacate judgments and reinstate guilty pleas, and for resentencing.
The prosecutor initially took the position that nothing in the plea agreement specifically precluded the objection; rather, he clarified that he was making “a general argument that it was not consistent with the plea negotiations.” Later, though, the prosecutor contended that defendant’s objection was inconsistent with the provision of the plea agreement that provides that the state is “free to seek” departure sentences.
Defendant appeared before a number of different trial court judges over the course of the proceedings below. The ruling setting aside defendant’s guilty pleas was made by the Honorable Ted Carp, and the Honorable Jack A. Billings presided at the subsequent jury trial.
The trial court explained that it was “treat[ing] this as a motion by the State pursuant to ORS 135.365, and any other statutes that might be applicable to cause the defendant to withdraw his plea.” As later discussed, 232 Or App at 328-29, the state now cites ORS 135.395 as an alternative statutory basis for the court’s actions.
As the dissent correctly points out, defendant’s counsel at one point indicated that defendant was prepared to withdraw his procedural objection based on inadequate statutory notice of the enhancement factors. However, the record is not clear as to whether defendant nonetheless intended to assert other objections based on his understanding of the original agreement, such as insisting that the state prove the enhancement factor to the court. Indeed, the court subsequently declined to enforce the agreement as defendant understood it, explaining, “I don’t know if there’s still an objection to the allegation of aggravating circumstances or if we need to call witnesses on that or whether we need a jury on that. * * *. I’m not clear about that. So I’m pretty reluctant to go down that road, as tempting as it would be.” As discussed above, the court later explained that defendant would be precluded from making objections under any new deal, and defendant refused to reenter his pleas.
Even if we were to characterize the state’s waiver argument as one of “estoppel by election” as the dissent has done, we are not persuaded that defendant ever took a position that was inconsistent with the remedy he seeks on appeal. He consistently demanded that he be sentenced on his original plea agreement. His double jeopardy argument was also consistent with that position; his counsel argued that “our position would be that the jeopardy prevents any trial, any further prosecution!.] * * *. So it doesn’t seem like there’s really anything to try on the case because he has guilty pleas entered. The only thing left is sentencing.”