*1287OPINION
Per Curiam:On January 25, 1991, the district court convicted petitioner Byron Crutcher, pursuant to a guilty plea, of one count of burglary and one count of possession of stolen property. Crutcher agreed to stipulate to his prior felony convictions. The district court adjudicated Crutcher a habitual criminal and sentenced him to serve two concurrent terms of life with the possibility of parole in the Nevada State Prison. On February 7, 1991, in case number C96172, Crutcher was convicted, pursuant to a guilty plea, of another count of burglary. Crutcher was once again adjudicated a habitual criminal and was sentenced to another term of life with the possibility of parole, to run consecutively to the sentence imposed in the first case. The state did not present copies of Crutcher’s prior judgments of conviction at either sentencing hearing. Further, in both cases, the criminal information filed by the state against Crutcher did not seek to impose the habitual criminal enhancement and did not list Crutcher’s prior felony convictions. The two cases were consolidated for appeal. This court dismissed the direct appeal on March 5, 1992. Crutcher v. State, Docket No. 21967 (Order Dismissing Appeal, March 5, 1992).
On March 8, 1993, Crutcher filed in the district court a petition for a writ of habeas corpus. Crutcher contended that the district court erroneously adjudicated him a habitual criminal because the state did not present evidence of his prior convictions at the sentencing hearings. The district court, without conducting an evidentiary hearing or appointing counsel, denied the petition. Crutcher then appealed to this court. This court entered an order remanding the matter to the district court for further proceedings.
After conducting an evidentiary hearing, the district court entered an order denying Crutcher’s petition for a writ of habeas corpus. The district court stated:
[A]lthough the holding of Staley v. State, 106 Nev. 75, 787 P.2d 396 (1990) was in existence when the Defendant was sentenced, this Court understood said holding to prohibit a Defendant from being able to stipulate to his status. The Court did not believe the Staley holding to mean that a defendant could not stipulate to the validity of his prior felony convictions and thus obviate the need for the State to obtain copies of said convictions from foreign jurisdictions. The subsequent McAnulty decision has made it apparent to this Court that the Nevada Supreme Court requires that a *1288sentencing judge review each judgment of conviction relied upon by the State to establish a defendant’s status as an habitual criminal.
In an attempt to comply with McAnulty v. State, 108 Nev. 179, 826 P.2d 567 (1992), the district court ordered the state to file an amended information setting forth Crutcher’s prior felony convictions and seeking to have the habitual criminal enhancement imposed. The district court’s order also scheduled a new sentencing hearing for the purpose of providing the state the opportunity to present proof of Crutcher’s prior felony convictions.
On January 18, 1995, four years after Crutcher began serving his sentences for his convictions, the state filed an amended information setting forth Crutcher’s prior convictions and seeking the enforcement of the habitual criminal statute. A sentencing hearing was held on February 10, 1995. At this hearing, the district court directed Crutcher to plead guilty to the amended information. Crutcher refused, and instead requested that he be sentenced on the information to which he had pleaded guilty four years before. The district court set aside Crutcher’s guilty plea, entered a plea of not guilty on Crutcher’s behalf and set the case for trial.
On March 24, 1995, Crutcher filed this petition for a writ of mandamus or prohibition. This court stayed the proceedings below and ordered the state to file an answer to the petition. An answer was filed on April 17, 1995.
Crutcher contends that the district court erroneously adjudicated him to be a habitual criminal because the state failed to present proof of his prior felony convictions at his sentencing hearings. We agree. We conclude that the district court erred in determining that because it misinterpreted the meaning of Staley and because McAnulty was not in existence at the time of Crutcher’s sentencing, the court properly adjudicated Crutcher to be a habitual criminal.
In Staley v. State, 106 Nev. 75, 787 P.2d 396 (1990), we determined that a defendant cannot stipulate to his status as a habitual criminal. We stated that “[t]he question of the validity of the prior convictions must be determined by the district court as a matter of law . ...” Id. at 78, 787 P.2d at 397. In McAnulty v. State, 108 Nev. 179, 826 P.2d 567 (1992), the district court determined that the appellant was a habitual criminal based solely on the appellant’s stipulation that he had prior felony convictions. We stated that “[t]he procedure used by the district court in sentencing appellant was clearly in violation of our express *1289holding in Staley. ” Id. at 181, 826 P.2d at 568. Thus, our decision in McAnulty did not change the law; it was simply an interpretation of existing law. In the case at hand, Crutcher was adjudicated a habitual criminal solely on the basis of his stipulation to his prior convictions. Therefore, as in McAnulty, the procedure used by the district court in sentencing Crutcher was clearly in violation of the express holding of Staley.
We further conclude that the district court erred in adjudicating Crutcher a habitual criminal because, at that time, the state had not filed an information seeking to impose the habitual criminal enhancement and listing Crutcher’s prior felony convictions. Additionally, the state cannot now remedy this error by filing an amended information seeking to impose the habitual criminal enhancement four years after Crutcher’s sentencing. NRS 207.010(5), provides in relevant part: “A count under this section may be separately filed after conviction of the primary offense . . . . ” We conclude that because the habitual criminal enhancement affects the sentencing stage of the proceedings, the legislature clearly intended that it be charged before sentencing. Thus, this statute permits the habitual criminal enhancement to be charged after conviction, but still requires that it be charged before sentencing. Consequently, the state improperly filed the habitual criminal enhancement after appellant had begun serving his sentence.
A writ of mandamus is available to compel the performance of an act which the law requires as a duty resulting from an office, trust or station, NRS 34.160, or to control an arbitrary or capricious exercise of discretion. See Round Hill Gen. Imp. Dist. v. Newman, 97 Nev. 601, 637 P.2d 534 (1981). We conclude that the district court had a duty to grant Crutcher’s petition for a writ of habeas corpus on the basis that he was erroneously adjudicated a habitual criminal and to sentence Crutcher pursuant to the original informations filed by the state.
Accordingly, we grant this petition. We quash the amended information filed by the state on January 18, 1995, and we vacate that portion of the district court’s order which provides for a new sentencing hearing for the purpose of allowing the state to present proof of Crutcher’s prior convictions. The clerk of this court shall issue a writ of mandamus compelling the district court to enter an order granting Crutcher’s petition for a writ of habeas corpus on the basis that he was erroneously adjudicated a habitual *1290criminal and compelling the district court to sentence Crutcher on the primary offenses pursuant to the original informations.1
Although petitioner has not been granted permission to file documents in this matter in proper person, see NRAP 46(b), we have received and considered petitioner’s proper person documents. In light of this order, we deny as moot appellant’s motion to strike and sanction.