The opinion of the court was delivered by: Kapsner, Justice.
[¶1] Kyle Mackey appeals from a district court order amending his sentence and denying his motion to withdraw his guilty plea. Mackey argues the court's original sentence was illegal, and he should have been allowed to withdraw his guilty plea because a manifest injustice occurred as a result of the court's original sentence. We affirm, concluding withdrawal of Mackey's guilty plea is not necessary to correct a manifest injustice.
[¶2] Mackey was charged with three counts of gross sexual imposition. The State alleged that between July 1, 2009, and September 4, 2009, Mackey, then a twenty-two-year-old police officer, had engaged in a sexual act on three occasions with T.C., a fourteen-year-old female. At Mackey's plea hearing, the district court also discussed a separate criminal information charging Mackey with one count of luring and one count of corruption or solicitation of a minor. The State and Mackey entered into a binding plea agreement that provided Mackey would plead guilty to the first count of gross sexual imposition, the second count would be subject to a pretrial diversion for ten years, and the remaining charges against Mackey would be dismissed. Under the plea agreement, Mackey would argue for the minimum mandatory sentence of five years while the State would "argue for more, with a cap of 15 years." Throughout the plea hearing, the court advised Mackey of the time to which he could be sentenced rather than the time which he could serve. Mackey stated he understood the terms of the plea agreement and pled guilty. The court took the plea agreement under advisement and ordered a presentence investigation.
[¶3] On August 10, 2010, the court held Mackey's sentencing hearing and accepted the binding plea agreement. For the first time, the court began referring to time served, instead of time sentenced, when discussing the provisions of the plea agreement. The court then sentenced Mackey to thirty years in prison, ordering him to serve eight and suspending the remaining twenty-two for five years. Neither party objected to the sentence during the sentencing hearing.
[¶4] On September 9, 2010, after obtaining different counsel, Mackey appealed from the criminal judgment. While that appeal was pending before this Court, Mackey filed a motion with the district court on January 28, 2011, under N.D.R.Crim.P. 35(a) and 32(d),*fn1 to withdraw his guilty plea, claiming the district court had imposed a sentence greater than the maximum contained in the plea agreement. In an amended criminal judgment filed February 14, 2011, the district court referenced a memorandum dated January 31, 2011, that denied Mackey's motion. The district court's judgment of February 14, 2011, also amended Mackey's original sentence of thirty years to fifteen, ordering him to serve eight years and suspending the remaining seven for five years. Mackey then filed a second appeal on February 22, 2011.
[¶5] Mackey argues his original sentence was illegal, which would entitle him to withdraw his guilty plea. Alternatively, Mackey claims he should have been allowed to withdraw his guilty plea because a manifest injustice occurred when the district court sentenced him to thirty years despite the court's acceptance of his binding plea agreement that provided for a maximum sentence of fifteen years.
[¶6] Rule 35 provides, "The sentencing court may correct an illegal sentence at any time . . . ." N.D.R.Crim.P. 35(a)(1). A sentence that fails to comply with a promise of a plea agreement is an illegal sentence. State v. Edwards, 2007 ND 113, ¶ 5, 736 N.W.2d 449. In Ostafin v. State, we stated:
[W]hen a defendant brings a motion to correct an illegal sentence under Rule 35(a), N.D.R.Crim.P., the sentencing court should first determine whether the illegal sentence can be corrected in such a manner so as to preserve the intent of the original plea agreement and give the defendant that for which he bargained. Only if such modification of the original sentence cannot be done, should the defendant be given the opportunity to withdraw his guilty plea. 1997 ND 102, ¶ 15, 564 N.W.2d 616. Mackey claims this rule from Ostafin is "not necessary to the holding and is dicta." Mackey attempts to support his argument by stating, "Because the defendant never asked to withdraw his plea, it was unnecessary for the Court to decide whether he should have been allowed to withdraw the plea." We disagree. The statement at issue was necessary in that case because, although Ostafin had only moved to correct his illegal sentence, the district court gave him the choice of either withdrawing his guilty plea and standing trial or permitting the judge to correct the sentence; Ostafin chose to withdraw his guilty plea. Id. at ¶ 3. On appeal, it was necessary for this Court to clarify that, when a defendant moves to correct an illegal sentence under Rule 35(a), the defendant should only be allowed to withdraw his guilty plea if correction of the original sentence cannot be accomplished. Id. at ¶ 15. The Ostafin rule is therefore binding.
[¶7] Mackey argues the thirty-year term imposed by the district court was in direct violation of N.D.R.Crim.P. 11(c)(4). Rule 11(c)(4) sets forth, "If the court accepts the plea agreement, it must inform the defendant that, to the extent the plea agreement is of the type specified in Rule 11(c)(1)(A) or (C), the agreed disposition will be included in the judgment." Mackey's plea agreement is of the type specified in Rule 11(c)(1)(A) and (C), which provide "the plea agreement may specify that the prosecuting attorney will: (A) not bring, or will move to dismiss, other charges; . . . (C) agree that a specific sentence or sentencing range is the appropriate disposition of the case." Mackey interprets the plea agreement as providing minimum and maximum terms for his total sentence instead of for time served. His argument is supported by the language used by the district court throughout the plea hearing when the court addressed Mackey:
[I]f I accept the plea agreement, you could be sentenced to more than 5, but 15 y[ea]rs or less, and if I did that, you could not withdraw this plea agreement. Do you understand that? . . . In other words, I do not have to accept [defense counsel's] recommendation of 5 years. And if I don't accept it, and if I don't sentence you to more than 15 years you can't withdraw this plea. Do you understand that? (Emphasis added.) Mackey asked, "Does that mean . . . I can't be sentenced to any more than 15?" (Emphasis added.) The court responded, "Correct. . . . [I]f it's between 5 and 15, you cannot say . . . I want to back out now. You couldn't do that. As long as the sentence would be between 5 and 15 years." (Emphasis added.) Following the court's explanation of sentencing under the agreement, Mackey pled guilty.
[¶8] Not until the sentencing hearing did the court refer to time served under the plea agreement, when it stated, "The plea agreement provided that the State could argue for no more than fifteen (15) years of served imprisonment, and obviously the Defendant is going to be arguing for the mandatory minimum of five (5) years. . . . The Court could not exceed those guidelines without violating the agreement." (Emphasis added.) The State argues Mackey's sentence was not illegal because, at the sentencing hearing, the court referred to years of "served imprisonment" outlined in the plea agreement. By ordering Mackey to serve only eight years of his sentence, the State claims the original sentence was within the fifteen-year maximum term of the plea agreement. We disagree. The State also asserts that by correcting the original sentence, the court "corrected any perceived error in its original sentence." We agree.
[¶9] By amending Mackey's sentence, the district court implied its original sentence was illegal. Because Rule 35 allows the sentencing court to correct an illegal sentence at any time, the court properly amended Mackey's sentence and provided him with that for which he bargained; thus, Mackey was not entitled to withdraw his plea under Rule 35. In his reply brief, Mackey contends, "[T]he issue on appeal is not whether the trial court's original sentence violated the plea agreement . . . . Rather, the issue before this Court is whether, to avoid a manifest ...