
966 P.2d 747 (1998)
126 N.M. 39
1998-NMSC-023
STATE of New Mexico, Plaintiff-Appellant,
v.
Escolastico MARTINEZ, Defendant-Appellee.
No. 24,194.
Supreme Court of New Mexico.
July 15, 1998.
Motion for Rehearing denied August 19, 1998.
Tom Udall, Attorney General, Margaret McLean, Assistant Attorney General, Santa Fe, for Appellant.
Phyllis H. Subin, Chief Public Defender, Bruce Rogoff, Appellate Defender, Santa Fe, for Appellee.

OPINION
MINZNER, Justice.
{1} Defendant Escolastico Martinez pleaded guilty to, inter alia, a charge of aggravated driving while intoxicated (DWI), third offense, contrary to NMSA 1978, § 66-8-102(F)(2) (1994, prior to 1997 amendment). On this charge, the magistrate court sentenced Martinez to 364 days in jail, suspending 274 days and leaving a remaining jail term of 90 days. The court later entered an amended sentence granting 90 days presentence credit for in-patient alcohol treatment. We conclude that trial courts possess inherent discretionary authority to grant presentence confinement credit, so long as the exercise of discretion does not unduly interfere *748 with the Legislature's authority to establish criminal penalties. However, we hold that the magistrate court impermissibly substituted alcohol treatment for mandatory jail contrary to the Legislature's expressed intent. Therefore, we reverse the amended sentence and remand with instructions to reinstate the 90-day jail term mandated by Section 66-8-102(F)(2).

I.
{2} On February 14, 1995, Martinez signed a plea and disposition agreement, pleading guilty to a third offense aggravated DWI, contrary to Section 66-8-102(F)(2), and driving with a revoked license, contrary to NMSA 1978, § 66-5-39 (1994). The plea and disposition agreement, signed by the magistrate judge and the prosecutor, contained the following disposition for the DWI charge: "364 days jail with 274 days suspended for 90 days; 1 year supervised probation; random urinalysis; alcohol screening and treatment." The court ordered Martinez to report to a screening and assessment program. Because the assessment included a recommendation of 90 days in-patient treatment and counseling, Martinez immediately entered an in-patient alcohol treatment program at the Recovery of Alcoholics Program (RAP).
{3} The magistrate court later formally sentenced Martinez in accordance with the plea and disposition agreement. In addition, the court imposed a fine of $750 for the DWI charge. The court also finalized its decision to suspend 274 days of the 364 day sentence and imposed, as part of the suspension, the condition that Martinez successfully complete a 90-120 day treatment program at RAP. Finally, the court entered a commitment to jail for 90 days, scheduled to commence on June 16, 1995.
{4} RAP discharged Martinez on June 2, 1995, after successfully completing the treatment program in 106 days. Martinez then moved to amend his sentence to reflect presentence credit for the time he spent in treatment. The court granted Martinez's motion and allowed 106 days of in-patient treatment in lieu of 90 days jail. Although Martinez also was convicted, under Section 66-5-39, of driving with a revoked license, for which the magistrate court sentenced Martinez to 364 days and suspended 357 days, the trial court did not grant presentence confinement credit on this charge. In the amended judgment and sentence, the court committed Martinez for the remaining seven days jail on the revoked license conviction. Thus, though Martinez was in treatment for 106 days, the court granted presentence confinement credit only with respect to the 90 day sentence for the DWI charge.
{5} The State then appealed the magistrate court's grant of confinement credit. The district court concluded that court-ordered, compelled attendance at an in-patient treatment program constitutes official confinement for purposes of presentence confinement credit. As a result, the district court affirmed the amended sentence.
{6} After the State appealed the decision of the district court, the Court of Appeals certified the matter to this Court. The Court of Appeals, unlike the parties and the district court, was unwilling to assume that the magistrate court possessed the power to grant presentence confinement credit for a misdemeanor DWI. The Court of Appeals noted that statutory authority exists for granting presentence confinement credit for felony convictions, NMSA 1978, § 31-20-12 (1967), but there is no statute addressing presentence confinement credit for misdemeanors in general. As a result, the Court of Appeals concluded that the existence of such authority is an issue of substantial public interest that should be decided by this Court. See NMSA 1978, § 34-5-14(C)(2) (1972) (providing for the certification of appeals from the Court of Appeals to this Court).

II.
{7} In this case, we must determine whether trial courts possess authority to grant presentence confinement credit[1] for inpatient *749 alcohol treatment with respect to a third offense DWI conviction. We recognize that the issue of presentence confinement credit evokes constitutional concerns. Compare Johnson v. Prast, 548 F.2d 699, 702 (7th Cir.1977) ("[T]he equal-protection clause requires consideration by the sentencing judge of presentence custody resulting from inability to post bond."), and State v. Phelan, 100 Wash.2d 508, 671 P.2d 1212, 1216 (1983) ("Prior incarceration not only must be credited against a maximum sentence, but must be credited on any sentence imposed."), with Crowden v. Bowen, 734 F.2d 641, 642 (11th Cir.1984) (concluding that presentence credit is constitutionally required if it extends a prisoner's sentence beyond the maximum allowable by law), and People v. Turman, 659 P.2d 1368, 1373 (Colo.1983) (en banc) ("[T]here is no constitutional right to credit for presentence confinement."). However, we believe it is unnecessary to address those concerns in order to resolve this case. Rather, we resolve this issue by construing Section 66-8-102.
{8} Our primary goal in interpreting a statute is to give effect to the Legislature's intent. We look first to the words chosen by the Legislature and the plain meaning of the Legislature's language. See Whitely v. New Mexico State Personnel Bd., 115 N.M. 308, 311, 850 P.2d 1011, 1014 (1993). The Legislature has provided that "[o]n a first conviction under [Section 66-8-102], any time spent in jail for the offense prior to the conviction for that offense shall be credited to any term of imprisonment fixed by the court." Section 66-8-102(E). The Legislature omitted any additional reference to preconviction credit in defining repeat offenses. See § 66-8-102(F), (G). Thus, the plain language of the statute appears to restrict the requirement of preconviction confinement credit to "a first conviction."
{9} Nonetheless, we "must exercise caution in applying the plain meaning rule." State ex rel. Helman v. Gallegos, 117 N.M. 346, 353, 871 P.2d 1352, 1359 (1994). While we do not ignore the language used by the Legislature, we must ensure that words are not interpreted outside of any relevant legislative context. Thus, we will interpret statutes as a whole and look to other statutes in pari materia in order to determine legislative intent. See Roth v. Thompson, 113 N.M. 331, 334, 825 P.2d 1241, 1244 (1992).
{10} For fourth and subsequent convictions for DWI, the Legislature has provided that "an offender is guilty of a fourth degree felony, as provided in Section 31-18-15 NMSA 1978." Section 66-8-102(G). Further, the Legislature has provided that "[a] person held in official confinement on suspicion or charges of the commission of a felony shall, upon conviction of that or a lesser included offense, be given credit for the period spent in presentence confinement against any sentence finally imposed for that offense." Section 31-20-12. "[W]e presume that the [L]egislature was aware of other statutes in existence at the time a statute was enacted." Luboyeski v. Hill, 117 N.M. *750 380, 384, 872 P.2d 353, 357 (1994). Therefore, we presume, based on Section 31-20-12 and the Legislature's use of the word "felony" in Section 66-8-102, that the Legislature intended to require that trial courts grant presentence credit, for official confinement, to defendants convicted of a fourth or subsequent offense of DWI. See State v. Clah, 1997-NMCA-091, ¶ 11, 124 N.M. 6, 946 P.2d 210, cert. denied, No. 24,584, 123 N.M. 626, 944 P.2d 274 (1997).
{11} However, our conclusion that the Legislature intended to provide presentence credit for felony DWI offenders leaves a noticeable void in the statutory scheme. The Legislature expressly has required that credit be given for all offenses other than the second and third, but it has left no indication as to whether credit for the second and third offense should be mandatory, discretionary, or prohibited.
{12} A trial court's power to sentence is derived exclusively from statute. See State v. Dominguez, 115 N.M. 445, 456, 853 P.2d 147, 158 (Ct.App.1993). This limitation on judicial authority reflects the separation of powers notion that "it is solely within the province of the Legislature to establish penalties for criminal behavior." State v. Mabry, 96 N.M. 317, 321, 630 P.2d 269, 273 (1981); see NM Const. art. III, § 1 (providing for the division of the powers of government between the legislative, judicial, and executive branches). Previously, we have enforced this limitation of authority by upholding the power of the Legislature to impose mandatory sentences, see Mabry, 96 N.M. at 321, 630 P.2d at 273, and by holding that district courts do not have jurisdiction to correct or modify sentences for good time that is served prior to sentencing because "[t]he computation of good time credits is exclusively an administrative responsibility," State v. Aqui, 104 N.M. 345, 348, 721 P.2d 771, 774 (1986), limited in part on other grounds by Brooks v. Shanks, 118 N.M. 716, 719-20, 885 P.2d 637, 640-41 (1994).
{13} Nonetheless, the judiciary's role in sentencing criminal defendants is not a purely ministerial task.
Indisputably under our constitutional system the right to try offences against the criminal laws and upon conviction to impose the punishment provided by law is judicial, and it is equally to be conceded that in exerting the powers vested in them on such subject, courts inherently possess ample right to exercise reasonable, that is, judicial, discretion to enable them to wisely exert their authority.
Ex parte United States, 242 U.S. 27, 41-42, 37 S.Ct. 72, 61 L.Ed. 129 (1916) (holding that federal courts, absent Congressional authority, do not have the power to suspend a mandatory sentence); accord Mistretta v. United States, 488 U.S. 361, 390, 109 S.Ct. 647, 102 L.Ed.2d 714 (1989) ("[T]he sentencing function long has been a peculiarly shared responsibility among the Branches of Government and has never been thought of as the exclusive constitutional province of any one Branch."); cf. State v. Sanchez, 109 N.M. 428, 434, 786 P.2d 42, 48 (1990) (Baca, J., dissenting) ("Sentencing is a function that involves the three bodies of our government, and each branch must be allowed to fulfill its function.").
{14} The granting of presentence confinement credit, unlike credit for good time served, as in Aqui, or the suspension of a mandatory sentence, as in Mabry and Ex parte United States, does not necessarily interfere with the Legislature's role in establishing appropriate penalties for crimes. Presentence confinement credit represents a court's recognition that a defendant, in fact, has satisfied a portion of the penalty mandated by the Legislature. See State v. Trudeau, 487 N.W.2d 11, 15 (N.D.1992) ("Time spent in custody that has been credited toward a sentence is effectively the same thing as time served pursuant to a sentence."). It is the duty of the judiciary, in implementing the directives of the Legislature, to exercise reason and ensure that the ends of justice are met. See State v. Miranda, 108 N.M. 789, 792, 779 P.2d 976, 979 (Ct.App.1989) (stating that the purpose of presentence confinement credit is "to assure equal treatment of all defendants whether or not they are incarcerated prior to conviction"). Thus, as long as any particular confinement credit does not lessen the penalty intended by the Legislature, *751 or otherwise frustrate the Legislature's constitutional function of establishing criminal penalties, we conclude that the judiciary possesses inherent discretionary authority to grant presentence confinement credit. Cf. Kronz v. State, 462 So.2d 450, 451 (Fla.1985) (determining that trial courts possess "inherent discretionary authority to award credit for time served in other jurisdictions while awaiting transfer to Florida").
{15} As we already indicated, Section 66-8-102 is silent on the issue of presentence credit for second and third offenses but requires preconviction credit for jail time with respect to first offenses and, through Section 31-20-12, presentence credit for official confinement with respect to fourth and subsequent offenses. We have noted that the Legislature, by promulgating the 1994 amendments to Section 66-8-102, "sought to increase the punishment for subsequent offenders by conferring fourth-degree-felony status on fourth or subsequent DWI convictions," rather than changing the nature of the offense of DWI. State v. Anaya, 1997-NMSC-010, ¶ 14, 123 N.M. 14, 933 P.2d 223 (emphasis added). We do not believe the Legislature intended to treat second and third offenders more severely than fourth and subsequent offenders. Therefore, because the Legislature has not limited presentence credit for fourth and subsequent offenses of DWI, we conclude that the Legislature did not intend to limit trial courts' inherent discretion to provide presentence credit for second and third offenders.[2] As a result, we conclude that the magistrate court did not exceed its authority in exercising its discretion to grant presentence confinement credit for a third offense of DWI.

III.
{16} Nevertheless, we conclude that the magistrate court's reliance on inpatient alcohol treatment as the basis for confinement credit violated Section 66-8-102. In Section 66-8-102, the Legislature has provided for multiple sentencing options. Specifically, for third offenders convicted of aggravated DWI, the Legislature has provided for a mandatory minimum jail term of 90 days. Section 66-8-102(F)(2). This mandatory sentence is not to be suspended, deferred, or taken under advisement. Id. Thus, there is a clear legislative intent to require repeat offenders to spend a specified amount of time in jail. Separately, and in addition to the mandatory jail term, the Legislature has provided that a court may, if necessary, require the offender to attend a court-approved alcohol treatment program. Section 66-8-102(H). The Legislature clearly considered alcohol treatment to be a form of punishment for DWI offenders separate from jail terms. Given this clear legislative intent, we conclude that presentence confinement credit for inpatient alcohol treatment can be applied only to a sentence of alcohol treatment and not to a sentence of jail.
{17} The magistrate court ordered Martinez to attend an alcohol screening program and, based on the recommendations of the screening agency, determined that alcohol treatment was necessary. This punishment is specifically contemplated by Section 66-8-102(H). The magistrate court then applied this treatment as credit for a jail term under Section 66-8-102(F)(2). While the magistrate court generally possessed discretionary authority to award presentence confinement credit, the magistrate court's substitution of alcohol treatment for jail directly conflicts with the Legislature's clear intent in Section 66-8-102 and interfered with the Legislature's function of establishing criminal penalties for DWI.
{18} Our decision that the presentence confinement credit was impermissible applies with equal force to the credit granted for Martinez's attendance of treatment after the imposition of sentence on May 4, 1995. Again, we believe the Legislature intended to create separate punishment for jail and treatment and to require a specified minimum *752 jail term. Thus, the magistrate court erred by substituting treatment for jail.
{19} Further, with respect to the specific sentence imposed in this case, we conclude that the magistrate court's attempt to grant credit for postsentence treatment violates an additional legislative directive contained in Section 66-8-102. The magistrate court sentenced Martinez to 364 days in jail and suspended 274 days. As a condition of the suspension, the magistrate court required that Martinez successfully complete the treatment program. The magistrate court then filed a commitment for 90 days jail to coincide with the conclusion of 120 days of treatment at RAP. The treatment and the jail term were clearly separate portions of the same sentence, to be served consecutively. As a result, the trial court's grant of credit for treatment between May 4 and June 2 effectively represents a suspension of the jail term, cf. Clah, 1997-NMCA-091, ¶ 18, 124 N.M. 6, 946 P.2d 210 (characterizing postsentence "credit" for time spent in a post-traumatic stress unit at a veteran's hospital as "in essence ... a period of qualified or conditional suspension"),and directly contradicts the express prohibition against suspending the mandatory minimum sentence in Section 66-8-102(F)(2).
{20} Because we conclude that the Legislature created distinct punishments for alcohol treatment and jail, we address neither whether trial courts have discretion, in relation to second and third offenses of DWI, to grant credit for presentence confinement other than jail nor whether any confinement must be preconviction rather than presentence. Compare § 66-8-102(E) (referring to credit for "jail" time served "prior to the conviction"), with § 31-20-12 (referring to "presentence" credit for "official confinement"). For similar reasons, it is unnecessary for us to review the district court's determination that in-patient alcohol treatment is official confinement for purposes of presentence credit, though we recognize that this question may arise under the DWI statute for credit not interfering with a mandatory minimum jail term or under statutory offenses other than DWI. Cf. Clah, 1997-NMCA-091, ¶¶ 14-15, 124 N.M. 6, 946 P.2d 210 (concluding that in-patient alcohol treatment for a felony DWI was not "official" confinement because it was not required by the court); State v. Fellhauer, 1997-NMCA-064, ¶ 17, 123 N.M. 476, 943 P.2d 123 (establishing a two-part test for determining whether time spent outside a correctional facility constitutes "official confinement" pursuant to Section 31-20-12), cert. denied, No. 24,465, 123 N.M. 446, 942 P.2d 189 (1997).

IV.
{21} We conclude that the magistrate court erred by granting credit for 90 days of in-patient alcohol treatment in lieu of the 90 days jail mandated by the Legislature for a third offense aggravated DWI. Thus, we reverse the amended judgment and sentence and remand for imposition of the original sentence in accordance with Section 66-8-102(F)(2).
{22} IT IS SO ORDERED.
FRANCHINI, C.J., and BACA, SERNA and McKINNON, III, JJ., concur.
NOTES
[1]  We note that the record is less than clear as to whether the time Martinez spent in treatment was actually presentence. Martinez entered into a plea agreement on February 14 that was signed by the magistrate judge and the prosecutor. The agreement included, under a section entitled "disposition," the condition that Martinez attend alcohol treatment. Martinez began attending treatment immediately. Additionally, the plea agreement indicated that a substantial portion of Martinez's sentence would be suspended for 90 days. Further, it appears that the magistrate court never entered a formal judgment and sentence. Instead, it appears that the court formally sentenced Martinez on either April 4 or May 4, 1995. Because Martinez began treatment immediately after his plea, see Sellers v. Broadwater, 176 W.Va. 232, 342 S.E.2d 198, 200-01 (1986) (concluding that a defendant's participation in psychological counseling as a condition of probation in a plea agreement constituted the execution of a sentence for purposes of double jeopardy and made the plea binding on the prosecution and the court despite the lack of a final judgment), and because the magistrate court indicated that the sentence was temporarily suspended, see State v. Kenneman, 98 N.M. 794, 796-97, 653 P.2d 170, 172-73 (Ct.App.1982) (distinguishing the imposition and suspension of a sentence from a deferral of sentencing), it would appear that, instead of awaiting sentence while in treatment, Martinez actually began serving his sentence by attending the alcohol treatment program. Nevertheless, the parties, the magistrate court, the district court, and the Court of Appeals deemed the treatment to be presentence confinement. Therefore, because we believe this distinction would not affect our ruling in this case, we assume, without deciding, that the in-patient treatment before May 4, 1995, occurred prior to the imposition of the sentence. Cf. NMSA 1978, § 31-20-3(C) (1985) (granting authority to delay sentencing, not to exceed sixty days, for diagnostic purposes).
[2]  We note that any legislative prohibition on presentence confinement credit would be subject to constitutional restrictions. Cf. Williams v. Illinois, 399 U.S. 235, 244, 90 S.Ct. 2018, 26 L.Ed.2d 586 (1970) ("[T]he Equal Protection Clause of the Fourteenth Amendment requires that the statutory ceiling placed on imprisonment for any substantive offense be the same for all defendants irrespective of their economic status.").
