
719 P.2d 821 (1986)
104 N.M. 243
Ralph E. ELLINWOOD, District Attorney for the Sixth Judicial District, Petitioner-Appellant,
v.
Honorable Y.B. MORALES, Magistrate, Grant County District, Division II, Respondent-Appellee.
No. 8254.
Court of Appeals of New Mexico.
May 8, 1986.
*822 Paul G. Bardacke, Atty. Gen., Peter S. Kierst, Asst. Atty. Gen., Santa Fe, for petitioner-appellant.
Anthony W. White, Foy, Foy & Jollensten, Silver City, for respondent-appellee.

OPINION
DONNELLY, Judge.
The state appeals from an order of the district court denying its petition for a writ of mandamus brought by the District Attorney for the Sixth Judicial District against the Honorable Y.B. Morales, Magistrate Judge, Division II, Grant County. The petition for writ of mandamus sought to compel the magistrate to rescind his order modifying his original sentence imposed in State v. Torres, Luna County Magistrate Court No. 08-02-84-0223 A.
This appeal raises three issues: (1) whether the writ of mandamus was the proper remedy; (2) whether the magistrate abused its discretion in placing defendant Torres on unsupervised probation; and (3) whether the plea agreement obligated Torres to serve 120 days in jail. The first issue is dispositive. We affirm.

FACTS
The state filed a criminal complaint in the District Court of Grant County charging Nestor Torres with the commission of a felony, larceny of property over $100 but not more than $2,500. Following plea negotiations, the case was remanded to the magistrate court where Torres agreed to plead guilty to a misdemeanor. Subsequently, Torres entered into a plea and disposition agreement in the magistrate court, whereby he pled guilty to the charge of receiving stolen property, a misdemeanor. Under the terms of the plea and disposition agreement, Torres was to receive a jail sentence of 120 days "which shall not be suspended or deferred." The plea and disposition agreement also provided that Torres give up "any and all motions, defenses, objections or requests which he has made or raised, or could assert hereafter, to the court's entry of judgment against him and imposition of a sentence upon him consistent with this agreement." In return, the state promised to dismiss the felony charge.
Magistrate Judge Morales initially sentenced Torres to 120 days in the county jail in accordance with the terms of the plea agreement. A few days later, Torres requested Judge Morales to modify his sentence on the basis of "extreme hardship." The state opposed the motion. Judge Morales found that the sentence should be modified "[d]ue to changed circumstances," and ordered that the original sentence should be reduced to 120 days of unsupervised probation.
The state then filed a petition for writ of mandamus in the district court, seeking issuance of a writ directing the magistrate court to rescind the modification of Torres' sentence. Following a hearing, the district court denied the petition for issuance of the writ. The order denying application for the writ was entered on December 21, 1984.

PROPRIETY OF MANDAMUS
The state argues that prerequisites to issuance of the writ of mandamus were satisfied, and that the state had no "`plain, speedy and adequate remedy'" available at law. The state also contends that it is "`beneficially interested'" in the proceeding, and that the magistrate court was required to either reject the plea and disposition agreement or to enforce its terms and provisions.
NMSA 1978, Section 44-2-5 provides: "The writ [of mandamus] shall not issue in any case where there is a plain, speedy and adequate remedy in the ordinary course of law. It shall issue on the information of the party beneficially interested."
Respondent asserts that the district court properly rejected the application for the writ because mandamus was not a proper remedy. Respondent argues that the state had a plain, speedy and adequate remedy available at law, namely, the right to appeal the order of modification. We do not reach the merits of the state's claims concerning the issue of whether the magistrate *823 court abused its discretion in modifying the sentence imposed or the issue of whether Torres was obligated to serve the 120-day jail sentence, because we determine that mandamus was not the proper remedy herein. The state had a plain, speedy and adequate remedy available at law and in lieu of filing its application for mandamus, could have pursued an appeal from the order of the magistrate court to the district court.
The state argues, however, citing NMSA 1978, Magis.Crim.Rule 41 (Repl.Pamp. 1981), that the Rules of Criminal Procedure for the Magistrate Courts as they existed at the time of the proceedings below, provided for a right of appeal in criminal proceedings only to the defendant, and not to the state. Although we agree that Magis. Crim.Rule 41 does not expressly provide for a right of appeal by the state from a final order of the magistrate court, nevertheless, the right of the state to pursue an appeal from a final order in criminal proceedings has been specifically recognized in certain instances. See Smith v. Love, 101 N.M. 355, 683 P.2d 37 (1984) (upholding right of state to appeal from order of metropolitan court dismissing criminal charge for failure to prosecute); State v. Giraudo, 99 N.M. 634, 661 P.2d 1333 (Ct.App.1983) (recognizing right of state to appeal from metropolitan court's order of dismissal).
Under the facts herein, the state had a right of appeal from the order of the magistrate court modifying Torres' sentence. The state has a right to appeal decisions of the district courts where the claim of a final disposition contrary to law is raised. State v. Santillanes, 96 N.M. 482, 632 P.2d 359 (Ct.App.1980). The state's right of appeal also applies to challenge final orders of a similar nature, entered by the magistrate court.
Article VI, Section 27 of the New Mexico Constitution provides: "[a]ppeals shall be allowed in all cases from the final judgments and decisions of the probate courts and other inferior courts to the district courts, and in all such appeals, trial shall be had de novo unless otherwise provided by law." Under this constitutional provision, the state had a right to appeal the propriety of the magistrate court order modifying the terms of the plea bargain previously approved by the court.
Where a plain, speedy and adequate remedy at law exists, mandamus will not be granted. Section 44-2-5. Mandamus does not lie where there is an adequate remedy by appeal. Montoya v. Blackhurst, 84 N.M. 91, 500 P.2d 176 (1972); State v. Reese, 91 N.M. 76, 570 P.2d 614 (Ct.App. 1977). See also Baca v. Burks, 81 N.M. 376, 467 P.2d 392 (1970) (mandamus should not be used as a substitute for appeal).
Mandamus is an extraordinary remedy which is available only in cases wherein other remedies fail or are inadequate. Cf. State ex rel. Sweeney v. Second Judicial District, 17 N.M. 282, 127 P. 23 (1912). Here, there is no showing that the relief sought by the state would not be adequately accorded by appeal.
The order denying the petition for writ of mandamus is affirmed.
IT IS SO ORDERED.
HENDLEY, C.J., and BIVINS, J., concur.
