Defendant, Paul Matthew Bartley, appeals from the judgment and sentence following his convictions of operating while intoxicated third, in violation of Iowa Code sections 321J.2(l)(a), or (b), 321J.2(2)(c), 902.8, and 902.9(3) (2009), two counts of child endangerment, in violation of section 726.6(l)(a), and driving while revoked, in violation of section 321J.21. He was tried, convicted and sentenced by District Associate Judge Phillip J. Tabor pursuant to Iowa Code 602.6302(2) as the charges were indictable misdemeanors and a class “D” felony. Defendant argues the district associate judge lacked subject matter jurisdiction to enter judgment and sentence him as an habitual offender under sections 902.8 and 902.9(3).
I. BACKGROUND AND PROCEEDINGS. On October 14, 2009, defendant, Paul Matthew Bartley, was charged by trial information with operating while intoxicated third, two counts of child endangerment, and driving while revoked. Two months later the State amended Count I of the trial information to charge defendant as an habitual offender under sections 902.8 and 902.9(3). A jury trial commenced on January 4, 2010 and the jury found defendant guilty on all charges. Defendant admitted two prior OWI convictions within the last twelve years, making this conviction his third OWI under section 321J.2(2)(e) and thus, a class “D” felony. Defendant also admitted he had two prior felony convictions in the State of Illinois— one for burglary in 1995 and one for home invasion in 1997. Based on these admissions, the court entered judgment against defendant and also found that sentencing would be subject to sections 902.8 and 902.9(3) as well as chapter 321J.
Defendant filed pro se motions for a new trial and in arrest of judgment on January 28 and February 4, 2010, respectively. Defendant’s counsel filed a motion in arrest of judgment and for a new trial on February 10, 2010 asserting among other things that the district associate judge lacked subject matter jurisdiction under Iowa Code section 602.6306 to hear the habitual offender count because of the accompanying fifteen-year indeterminate sentence. On February 16, 2010, District Associate Judge Tabor heard the pending motions and ruled that he had subject matter jurisdiction over the habitual offender filing. Judge Tabor stated the charge remained a class “D” felony even though it now had the enhancement of the habitual offender sentence. The court ruled it had jurisdiction over class “D” *610felonies under section 602.6306, and defendant’s motion was denied.
Defendant was sentenced to a period not to exceed fifteen years with a mandatory minimum of three years for OWI third, habitual offender. He was sentenced to a period not to exceed two years for both counts of child endangerment and fined $1000 for driving while licensed revoked. The sentences were ordered to run concurrently. Defendant appeals this judgment and sentence alleging that the district associate judge did not have subject matter jurisdiction over the habitual offender charge.
II. SCOPE OF REVIEW. The question of whether a court has subject matter jurisdiction is purely legal question and our review is at law. Iowa R.App. P. 6.907; S.S. v. Iowa Dist. Ct., 528 N.W.2d 130, 132 (Iowa 1995). This action was initially filed as a direct appeal; however, we now decide that it should have been filed as a certiorari action under Iowa Rule of Appellate Procedure 6.107 as defendant is claiming that the district associate judge exceeded his jurisdiction. Pursuant to Iowa Rule of Appellate Procedure 6.108, the direct appeal should not be dismissed, but this court will proceed as if the proper petition for writ of certiorari had been requested. Defendant raised the issue of the district associate judge’s subject matter jurisdiction in his post-trial motion in arrest of judgment and motion for a new trial and at the sentencing proceeding of February 16, 2010; however, even if it had not been properly raised and preserved below, a challenge to the subject matter jurisdiction can be raised at any time. State v. Moret, 486 N.W.2d 589, 591 (Iowa 1992). We grant the writ and proceed.
III. SUBJECT MATTER JURISDICTION. Subject matter jurisdiction refers to the courts power “to hear cases and determine cases of the general class to which a particular proceeding belongs.” S.S., 528 N.W.2d at 132. Jurisdiction is granted to the district court by the Iowa Constitution and statute. Iowa Const, art. V, § 6; Iowa Code § 602.6101. The Iowa district court is a unified trial court, which has “exclusive, general, and original jurisdiction of all actions, proceedings, and remedies, civil, criminal, probate, and juvenile.” Iowa Code § 602.6101. The subject matter jurisdiction of the district associate judges can be found in section 602.6306. Specifically subsection 2 provides “[district associate judges also have ... jurisdiction of indictable misdemeanors, class “D” felony violations, and other felony arraignments.” Iowa Code § 602.6306(2).
Under section 902.8, an habitual offender is a person convicted of a class “C” or class “D” felony who has twice before been convicted of any felony in this state or any other state. The habitual offender is not eligible for parole until the person has served a minimum sentence of three years confinement. Id. § 902.8. In addition, section 902.9(3) provides that an habitual offender shall be confined for no more than fifteen years. In contrast, a class “D” felon who is not an habitual offender is sentenced to no more than five years confinement. Id. § 902.9(5).
The habitual offender statute has been held to be merely a “sentencing procedure by which punishment is enhanced for one who is convicted of this third felony.” State v. Popes, 290 N.W.2d 926, 927 (Iowa 1980). It is not a separate crime, but a mechanism whereby the court can “more severely punish those incorrigible offenders who have not responded to the restraining influence of conviction and incarceration.” State v. Smith, 291 N.W.2d 25, 27 (Iowa 1980); see also State v. Woody, 613 N.W.2d 215, 217 (Iowa 2000).
In this case, there is no question that the charge of OWI 3rd is a class “D” *611felony. Iowa Code § 321J.2(2)(c). There is also no question that the district associate judge is granted the jurisdiction to hear class “D” felony violations under section 602.6306(2). The question is whether this jurisdiction also extends to sentence class “D” felonies under the habitual offender sentence enhancement found in section 902.8 and 902.9(3).
Defendant claims the district associate judge lacks the jurisdiction in this case because section 602.6306(2) does not specifically provide for district associate judges to hear matters involving habitual offenders and as such, this jurisdiction is reserved for the district judges only. The State asserts that the express language of the statute provides that district associate judges can hear all class “D” felonies and may thereby impose all sentences which may follow from such a conviction.
When interpreting statutes, “ ‘our primary goal is to give effect to the intent of the legislature.’ ” State v. Anderson, 782 N.W.2d 155, 158 (Iowa 2010). The intent of the statute is found from the statute as a whole and not only a particular part. Id. “ ‘When a statute is plain and its meaning clear, courts are not permitted to search for meaning beyond its express terms.’ ” Id. The rules of statutory construction are employed only when the statute is ambiguous. State v. Sailer, 587 N.W.2d 756, 760 (Iowa 1998). A statute can be ambiguous in two ways “(1) from the meaning of particular words; or (2) from the general scope and meaning of the statute when all its provisions are examined.” Id.
We find that section 602.6306(2) is clear and unambiguous. The legislature granted district associate judges the authority to hear class “D” felonies. This includes the ability to sentence those convicted of class “D” felonies in whatever manner the Code provides. The legislature did not distinguish between various types of class “D” felonies, and neither shall we.
WRIT ANNULLED.