
630 N.W.2d 778 (2001)
STATE of Iowa, Plaintiff,
v.
IOWA DISTRICT COURT FOR MONROE COUNTY, Defendant.
No. 00-0271.
Supreme Court of Iowa.
July 5, 2001.
Thomas J. Miller, Attorney General, Mary E. Tabor, Assistant Attorney General, *779 and Steven E. Goodlow, County Attorney, for plaintiff.
Christine E. Branstad of Hopkins & Huebner, P.C., Des Moines, for defendant.
TERNUS, Justice.
This case is a certiorari action brought by the State challenging the district court's authority to sentence Clyde Gullion, a class "B" drug felon, to a ten-year indeterminate prison term. Upon our review, we think the court misconstrued Iowa Code section 901.10(1) (1999). Contrary to the district court's interpretation of this statute, it does not permit the court to reduce the twenty-five-year indeterminate sentence normally imposed for class "B" felonies pursuant to Iowa Code section 902.9(1). Rather, as the State asserts, section 901.10(1) only authorizes the court to reduce the mandatory one-third minimum term that a person convicted under Iowa Code section 124.401(1)(b) must serve. See Iowa Code § 124.413 (requiring that a person convicted under section 124.401(1)(b) serve a minimum of one-third of the maximum indeterminate sentence imposed by law). Because the district court had no power to sentence the defendant[1] to a ten-year indeterminate sentence, we sustain the writ of certiorari, vacate the defendant's sentence, and remand the case for resentencing.

I. Background Facts and Proceedings.

Gullion, the defendant in the underlying criminal case, pled guilty to a charge of possession of a schedule II controlled substance (methamphetamine) with the intent to deliver in violation of Iowa Code section 124.401(1)(b)(7), a class "B" felony.[2] At sentencing, the defendant argued that the court had discretion under section 901.10(1) to decrease the twenty-five-year indeterminate sentence required by section 902.9(1) if it found mitigating circumstances. The defendant also claimed the court had discretion to reduce the mandatory one-third minimum term that the defendant must serve by one-third based on the defendant's guilty plea. See Iowa Code § 901.10(2) (allowing, under specified circumstances, reduction of mandatory minimum sentence that defendants charged with certain crimes are required to serve). Over the State's objection, the district court sentenced the defendant to a ten-year indeterminate sentence, and reduced the mandatory minimum time that the defendant must serve by one-third in view of the defendant's guilty plea.
The State filed a petition for writ of certiorari, challenging the authority of the court to impose the reduced sentence. The State argues in this court that section 901.10(1) allows a reduction of the mandatory minimum term that certain drug offenders must serve, but does not permit a reduction of the overall sentence.

II. Scope of Review.

"Certiorari is a law action to determine whether a tribunal ... has exceeded its jurisdiction or otherwise acted illegally." Polk County Sheriff v. Iowa Dist. Ct., 594 N.W.2d 421, 423 (Iowa 1999). Our scope of review depends upon the nature of the issues raised in the certiorari proceeding. See id. This court reviews a *780 district court's interpretation of a statute for correction of errors of law. See State v. Iowa Dist. Ct. for Black Hawk County, 616 N.W.2d 575, 578 (Iowa 2000). Because the determinative issue in this case is the district court's interpretation and application of section 901.10(1), we review for legal error.

III. Applicable Sentencing Statutes.

The defendant pled guilty to a violation of section 124.401(1)(b)(7), a class "B" felony. This statute requires that a violator be sentenced pursuant to section 902.9(1), which dictates a twenty-five-year sentence for class "B" felons. In addition, section 902.3 provides that the sentence for a class "B" felony must be indeterminate. The defendant's sentence is also subject to section 124.413, which states:
A person sentenced pursuant to section 124.401, subsection 1, paragraph ... "b" ... shall not be eligible for parole until the person has served a minimum period of confinement of one-third of the maximum indeterminate sentence prescribed by law.
Iowa Code § 124.413. Probation is not an option available to the court. See id. § 907.3(1)(k) (providing that court may not place the defendant on probation if the defendant's offense is a violation of section 124.401(1)(b)). When these statutes are considered together, it is apparent that they require the defendant to be sentenced to an indeterminate twenty-five-year prison term of which he must serve a mandatory minimum one-third before he is eligible for parole. See generally State v. Rodgers, 560 N.W.2d 585, 587 (Iowa 1997) (holding that "[u]nder the general indeterminate sentencing statute, a sentencing judge must impose an indeterminate sentence for the full statutory maximum").
Nonetheless, the parties agree that the legislature has provided for the modification of this sentencing scheme for some first time offenders. The sentencing statute permitting such modification is section 901.10, which states:
901.10 Imposition of mandatory minimum sentences.
1. A court sentencing a person for the person's first conviction under section 124.406, 124.413, or 902.7 may, at its discretion, sentence the person to a term less than provided by the statute if mitigating circumstances exist and those circumstances are stated specifically in the record.
2. Notwithstanding subsection 1, if the sentence under section 124.413 involves a methamphetamine offense under section 124.401, subsection 1, paragraph "a" or "b", the court shall not grant any reduction of sentence unless the defendant pleads guilty. If the defendant pleads guilty, the court may, at its discretion, reduce the mandatory minimum sentence by up to one-third. If the defendant additionally cooperates in the prosecution of other persons involved in the sale or use of controlled substances, and if the prosecutor requests an additional reduction in defendant's sentence because of such cooperation, the court may grant a further reduction in defendant's mandatory minimum sentence, up to one-half of the remaining mandatory minimum sentence.
3. The state may appeal the discretionary decision on the grounds that the stated mitigating circumstances do not warrant a reduction of the sentence.
Iowa Code § 901.10. The fighting issue in this case is whether section 901.10(1) gave the district court discretion to reduce the maximum indeterminate sentence applicable to the defendant's offense, or only the *781 mandatory minimum term that the defendant must serve.[3]

IV. Discussion.

"The primary purpose of statutory construction is to determine legislative intent." State v. McCoy, 618 N.W.2d 324, 325 (Iowa 2000); accord State v. Carpenter, 616 N.W.2d 540, 542 (Iowa 2000) ("The polestar of statutory interpretation is the intent of the legislature."). The court gleans this intent from the words used by the legislature. See McCoy, 618 N.W.2d at 325; State v. Kidd, 562 N.W.2d 764, 765 (Iowa 1997). The court does "not speculate as to the probable legislative intent apart from the words used in the statute." State v. Adams, 554 N.W.2d 686, 689 (Iowa 1996); accord State v. Welton, 300 N.W.2d 157, 160 (Iowa 1981) ("when a statute is plain and its meaning is clear, courts are not permitted to search for meaning beyond its expressed terms"). "Although the title of a statute cannot limit the plain meaning of the text, it can be considered in determining legislative intent." T & K Roofing Co. v. Iowa Dep't of Educ., 593 N.W.2d 159, 163 (Iowa 1999). In addition, "legislative intent is to be gleaned from the statute as a whole, not from a particular part only." De More v. Dieters, 334 N.W.2d 734, 737 (Iowa 1983).
The specific statutory language at issue here is the provision that "[a] court sentencing a person for the person's first conviction under section 124.406, 124.413, or 902.7 may, at its discretion, sentence the person to a term less than provided by the statute...." Iowa Code § 901.10(1) (emphasis added). A mere reading of the quoted language leads us to the initial thought that the words "the statute" must reference the only statute identified in section 901.10(1), namely, the statute under which the person was convictedeither section 124.406, section 124.413, or section 902.7. It is significant that each statute referenced in section 901.10(1) is a statute that requires a defendant to serve a certain portion of his or her indeterminate sentence. See id. §§ 124.406(1)(a) (requiring adult defendant convicted of distributing drugs to minor to serve "a minimum term of confinement of five years" and, if distributed within a certain distance of a school, to serve "a minimum confinement of ten years"), 124.413 (stating that person convicted of a drug offense under section 124.401(1)(b) is not eligible for parole until person "has served a minimum period of confinement of one-third of the maximum indeterminate sentence"), 902.7 (requiring person committing a forcible felony using a dangerous weapon to "serve a minimum of five years of the sentence imposed by law"). It appears, therefore, that when the legislature states in section 901.10(1) that the court may sentence a person "to a term less than provided by the statute," the legislature is referring to the mandatory minimum term of confinement prescribed by one of the statutes specifically referenced in section 901.10(1).
This initial impression is supported by a review of the original statute adopted by the General Assembly in 1985. Senate File 213, which was enacted into law, included not only the text of the statute, but the title, "IMPOSITION OF MANDATORY MINIMUM SENTENCES," as well. 1985 Iowa Acts ch. 41, § 1 (codified at Iowa Code § 901.10 (Supp.1985)). Thus, *782 the section heading appearing in the Code, "Imposition of Mandatory Minimum Sentences," indicates the legislature's intent to address the subject of mandatory minimum sentences, not indeterminate sentences.
Finally, a review of the entire statute also supports this interpretation. Section 901.10(2) provides that "[n]otwithstanding subsection 1," a person convicted of a methamphetamine offense is not entitled to "any reduction of sentence unless the defendant pleads guilty." The word "notwithstanding," in this context, means "despite." See Merriam Webster's Collegiate Dictionary 795 (10th ed.1993). Thus, in spite of what is allowed in subsection 1 concerning "reduction of sentence," subsection 2 sets up additional requirements for defendants convicted of a methamphetamine offense before such defendants may receive a "reduction in sentence." See Iowa Code § 901.10(2). It is apparent that both subsections refer to the same "sentence." Significantly, in limiting the possible reduction of sentence under subsection 2, the legislature specifically refers to "the mandatory minimum sentence" and limits any reduction to one-third of that sentence. Id. § 901.10(2) (emphasis added). We think that when the statute is considered as a whole it is clear that the subject of both subsections is the mandatory minimum sentence imposed by the referenced statutes, not the indeterminate sentence required by the general sentencing statutes.

V. Summary and Disposition.

Iowa Code section 901.10(1) allows a sentencing court to reduce the mandatory minimum sentence otherwise required by section 124.401, section 124.413, or section 902.7, if mitigating circumstances exist and it is the defendant's first conviction subject to one of these statutes. It does not permit the court to lessen the indeterminate sentence imposed by law. Thus, the most favorable sentence to which the defendant in this case is entitled is an indeterminate twenty-five-year sentence with a mandatory minimum term of one-third, subject to a possible reduction of the mandatory minimum term by no more than one-third.
The district court here exceeded its authority by sentencing the defendant to a term less than the twenty-five-year indeterminate sentence required by section 902.9(1). As a consequence, the defendant's sentence is illegal and void. See State v. Halliburton, 539 N.W.2d 339, 343 (Iowa 1995) ("An illegal sentence is one not authorized by statute; it is void."). Therefore, we sustain the State's petition for writ of certiorari, vacate the defendant's sentence, and remand the case for resentencing.
WRIT SUSTAINED; SENTENCE VACATED AND CASE REMANDED FOR RESENTENCING.
NOTES
[1]  All references in this opinion to "the defendant" are to Gullion, the real party in interest, rather than to the nominal defendant, the Iowa District Court.
[2]  The defendant also pleaded guilty to possession of ephedrine in violation of section 124.401(4), a class "D" felony. He was sentenced to a five-year indeterminate sentence on this charge. Neither his conviction nor sentence with respect to this offense is challenged on appeal.
[3]  The State does not contest on appeal that under section 901.10(2) the defendant may receive up to a one-third reduction in the mandatory minimum term to be served, provided the defendant's current conviction is his first conviction subject to section 124.413 and there are mitigating circumstances present. Although the parties disagreed at the sentencing hearing as to whether the defendant's current conviction was his first subject to section 124.413, that issue is not raised on appeal.
