
140 P.3d 1117 (2006)
140 N.M. 168
2006-NMCA-093
MIMBRES VALLEY IRRIGATION CO., Plaintiff,
v.
Tony SALOPEK, et al., Defendants,
State of New Mexico ex rel. State Engineer, Plaintiff-In-Intervention-Appellee,
v.
San Lorenzo Community Ditch Association, Defendant-Appellant.
No. 25,570.
Court of Appeals of New Mexico.
June 29, 2006.
*1118 Office of the State Engineer, DL Sanders, Chief Counsel, Francis L. Reckard, Special Assistant Attorney General, Tracy L. Hofmann, Special Assistant Attorney General, Santa Fe, NM, for Appellee.
Peter Thomas White, Santa Fe, NM, for Appellant.

OPINION
VIGIL, Judge.
{1} This case involves a mandamus action brought in the district court seeking to enforce adjudicated rights to water in the Mimbres River Stream System in southwestern New Mexico. San Lorenzo Community Ditch Association appeals from a district court order quashing a peremptory writ of mandamus after the district court determined that a peremptory writ of mandamus was not proper because the pleadings raised issues of fact and that San Lorenzo otherwise has a plain, speedy, and adequate remedy in the ordinary course of the law. We conclude that we do not have jurisdiction over this case because no final, appealable order is before us. We dismiss the appeal.

BACKGROUND AND PROCEDURAL HISTORY
{2} The history of this case began in 1970 when the State Engineer filed a complaint in intervention to adjudicate all water rights having as their source of water the public surface or underground waters of the Mimbres River Stream System or Mimbres Underground Water Basin. In 1993, the final decree adjudicating those rights was filed in the district court. The final decree determined in part that San Lorenzo has water rights that are senior to those of other upstream individuals and entities who also own water rights enabling them to divert water from the Mimbres River. All defendants, their successors, assigns, lessees, and any other person having actual or constructive knowledge of the decree were "permanently enjoined from any diversion or use of the public waters of the Mimbres River Stream System and Mimbres Underground Water Basin, except in accordance with the adjudication orders and this decree." The final decree further provided that the court would appoint a Water Master to administer the orders within the decree and that the court would retain jurisdiction of the case to enforce its adjudication orders and to otherwise administer its provisions. The district court then appointed the Water Master requested by the State Engineer.
{3} In September 2003, San Lorenzo filed a petition for preliminary and permanent injunction to enjoin upstream surface water users from diverting water from the Mimbres River when the flows of the river were insufficient to satisfy its own diversion requirements as adjudicated in the final decree. While the petition alleged that upstream surface water users were diverting surface water from the Mimbres River in derogation of its superior rights, it also acknowledged that it was not possible to determine if the cause of San Lorenzo's water supply shortages was due to the Water Master failing to measure or monitor the diversions or because of drought conditions. In part, San Lorenzo's petition for preliminary and permanent injunction requested the district court to enter its order:

*1119 A. Granting its preliminary and permanent injunction requiring that the respondents, their agents and employees from diverting the surface waters of the Mimbres River until and so long as the flow of the Mimbres River arriving at the San Lorenzo Community Ditch diversion dam is 6.7 cubic feet per second;
B. Issuing a mandatory injunction requiring the respondents to construct headgates, if one does not exist, and install measuring devices on their ditches[.]
{4} The district court then filed an order of reference to the Water Master directing the Water Master to convene a meeting of San Lorenzo and private upstream ditches in an effort to apportion the water so that San Lorenzo could get its rightful priority and if no agreement among the ditches was reached, "the Water[M]aster may specify a rotation period for the allocation of water among the ditches." A meeting was subsequently convened and the representatives of the ditches were unable to agree upon a rotation schedule for distribution of water. Accordingly, the Water Master ordered a rotation system of water distribution on April 8, 2004. San Lorenzo refused to abide by the rotation schedule established by the Water Master, and the Water Master filed a motion requesting that San Lorenzo show cause why it should not be held in contempt for failure to comply with the rotation system. The show cause hearing was set for June 29, 2004.
{5} On June 28, 2004, the day before the show cause hearing, San Lorenzo filed a petition for peremptory writ of mandamus. The petition alleges that San Lorenzo requested that the Water Master administer priorities on the Mimbres River pursuant to the final decree and its Priority Call and Demand for Water but, because the Water Master refused to perform his duties, junior upstream water users were diverting water from the Mimbres River in violation of its senior rights. The petition alleged that the maximum diversion rate for the San Lorenzo Community ditch was computed to be at least 6.7 cubic feet per second during the month of July and that San Lorenzo had already filed a petition for preliminary and permanent injunction asking the court to enjoin the upstream holders of junior priority rights from diverting any water from the Mimbres River when the flow of the river at the San Lorenzo Community Ditch Diversion was 6.7 cubic feet per second or less. Therefore, San Lorenzo requested that the court issue a peremptory writ of mandamus to the Water Master "ordering him to administer water rights by priority in times of shortage when requested to do so by water right owners or community ditches having priority to divert and use water and to curtail or terminate the diversion and use of water by junior priority water rights that take water out-of-priority."
{6} A "Peremptory Writ of Mandamus" was then issued by the district court. In pertinent part, the writ recites that San Lorenzo does not have a remedy at law and that San Lorenzo "makes a prima facie showing that the petitioner may be entitled to the relief sought by the Petition." The "Peremptory Writ of Mandamus" then simply states, "IT IS THEREFORE ORDERED that the Petition for Writ of Mandamus in the above case be and hereby is granted[,]" and that the Water Master file a response to the petition within thirty days after being served with the writ.
{7} The State Engineer filed the answer on behalf of the Water Master, which admitted and denied various allegations made in the petition for peremptory writ of mandamus. In pertinent part, the Water Master asserted that the petition should be denied because San Lorenzo had an adequate remedy at law, namely the pending petition for preliminary and permanent injunctions which San Lorenzo had failed to prosecute. Further, the Water Master disputed San Lorenzo's factual claim of a maximum diversion rate of 6.7 cubic feet per second and asserted that "reliance on a calculated maximum diversion rate alone is not dispositive of the actual rate of flow Petitioner's [sic] require to meet existing soil and crop conditions, rather it is a maximum rate when conditions so require."
{8} The district court held a hearing and issued a memorandum opinion after it "considered everything submitted on the Petition *1120 for Peremptory Writ of Mandamus, Peremptory Writ of Mandamus and the State Engineer and Water Master's Answer to the Petition." In pertinent part, the district court concluded that San Lorenzo had an injunction action pending against upstream irrigation ditches, which would in effect enforce its priority rights if it was successful. Further, the district court concluded that the Water Master and State Engineer had raised factual questions in the answer to the writ and that "[e]ffective administration will require a more detailed analysis of the entire water system, including more comprehensive measurement or estimation flows, demands, diversions and returns." The district court therefore determined that the peremptory writ of mandamus should be quashed, and an order quashing the writ was filed. San Lorenzo appeals.

ANALYSIS
{9} The issue of whether the trial court's order is appealable has not been raised by the parties. However, "an appellate court has the duty to determine whether it has jurisdiction of an appeal," therefore "it will examine the record and, if required, will sua sponte question its jurisdiction." Rice v. Gonzales, 79 N.M. 377, 378, 444 P.2d 288, 289 (1968). We conclude that the order quashing a peremptory writ of mandamus in this case is not a final, appealable order under Rule 12-201 NMRA.
{10} A mandamus proceeding is technical in nature and closely regulated by statute. See In re Grand Jury Sandoval County, 106 N.M. 764, 766, 750 P.2d 464, 466 (Ct.App.1988) (observing that mandamus proceedings are technical in nature); Charles T. Dumars & Michael B. Browde, Mandamus In New Mexico, 4 N.M. L.Rev. 155, 157 (1974) ("The New Mexico statutes delineate in some detail the requirements for a proper mandamus action."). The statutes regulating a mandamus proceeding are at NMSA 1978, Sections 44-2-1 to -14 (1884, as amended through 1953).
{11} Mandamus lies only to compel a public officer to perform an affirmative act where, on a given state of facts, the public officer has a clear legal duty to perform the act and there is no other plain, speedy, and adequate remedy in the ordinary course of the law. See West v. San Jon Bd. of Educ., 2003-NMCA-130, ¶ 9, 134 N.M. 498, 79 P.3d 842; Lovato v. City of Albuquerque, 106 N.M. 287, 289, 742 P.2d 499, 501 (1987). The writ applies only to ministerial duties and it will not lie when the matter has been entrusted to the judgment or discretion of the public officer. El Dorado at Santa Fe, Inc. v. Bd. of County Comm'rs, 89 N.M. 313, 316-17, 551 P.2d 1360, 1363-64 (1976). A "ministerial duty" arises only when the law directs that a public official must act when a given state of facts exists. See State ex rel. Four Corners Exploration Co. v. Walker, 60 N.M. 459, 463, 292 P.2d 329, 332 (1956) (stating a public official's ministerial duty is "an act or thing which he is required to perform by direction of law upon a given state of facts being shown to exist, regardless of his own opinion as to the propriety or impropriety of doing the act in the particular case"). In the language of the statute, the writ of mandamus may only be used:
[T]o compel the performance of an act which the law specially enjoins as a duty resulting from an office, trust or station; but though it may require an inferior tribunal to exercise its judgment, or proceed to the discharge of any of its functions, it cannot control judicial discretion.
Section 44-2-4. Further, "[t]he writ shall not issue in any case where there is a plain, speedy and adequate remedy in the ordinary course of law." Section 44-2-5. In light of its characteristics, it is settled that "`Mandamus is a drastic remedy to be invoked only in extraordinary circumstances.'" State ex rel. Shell W. E & P, Inc. v. Chavez, 2002-NMCA-005, ¶ 8, 131 N.M. 445, 38 P.3d 886 (quoting Brantley Farms v. Carlsbad Irrigation Dist., 1998-NMCA-023, ¶ 12, 124 N.M. 698, 954 P.2d 763).
{12} A mandamus action is initiated by the filing of a verified application or petition for writ of mandamus. See Brantley Farms, 1998-NMCA-023, ¶ 12, 124 N.M. 698, 954 P.2d 763 ("The party seeking a writ must first file an application or petition."); Dumars & Browde, supra at 158-159; Rule 12-504(B)(1) NMRA (providing that a writ proceeding *1121 in the exercise of the Supreme Court's original jurisdiction is initiated by filing a verified petition setting forth the facts and the law in concise form which support issuance of the writ). The court may issue either an "alternative" writ or a "peremptory" writ. Section 44-2-6 ("The writ is either alternative or peremptory."). An alternative writ directs the public officer to either do the act required to be performed or show cause before the court on a certain date why he has not done so. Id. A peremptory writ directs the public official to perform the act without notice or an opportunity to be heard. See Bd. of Comm'rs of Guadalupe County v. Dist. Ct. of Fourth Judicial Dist., 29 N.M. 244, 256, 223 P. 516, 519 (1924) (stating that a peremptory writ of mandamus is entered without notice and an opportunity to be heard and constitutes a final judgment). As such, the statute directs that it may be issued only ("[w]hen the right to require the performance of the act is clear, and it is apparent that no valid excuse can be given for not performing it[.]"). Section 44-2-7. Because it is issued without notice and an opportunity to be heard, it will be an exceedingly rare case where a peremptory writ is proper. Dumars & Browde, supra at 161-62. This being the case, the statute directs, "in all other cases the alternative writ shall be first issued." Section 44-2-7.
{13} The statute specifies what must be contained in the writ:
The alternative writ shall state concisely the facts showing the obligation of the defendant to perform the act, and his omission to perform it, and command him, that immediately after the receipt of the writ, or at some other specified time, he do the act required to be performed, or show cause before the court out of which the writ issued, at a specified time and place, why he has not done so; and that he then and there return the writ with his certificate of having done as he is commanded. The peremptory writ shall be in a similar form, except that the words requiring the defendant to show cause why he has not done as commanded, shall be omitted.
Section 44-2-6 (emphasis added).
{14} The writ itself is therefore required to set forth the full and complete allegations which entitle the petitioner to the writ. See City of Sunland Park v. N.M. Pub. Regulation Comm'n, 2004-NMCA-024, ¶ 7, 135 N.M. 143, 85 P.3d 267 (stating that the writ becomes the initial pleading in the case which should state a cause of action within itself and that the allegations of fact in the petition itself are not considered); Dumars & Browde, supra at 162 (stating that the writ delineates the full and complete allegations of the petition). Following service of the petition and alternative writ as directed by the court, the public official answers the factual allegations contained in the alternative writ and sets forth any legal defenses he has to the action. See State ex. rel. Garcia v. Bd. of Comm'rs, 21 N.M. 632, 641, 157 P. 656, 659 (1916) (holding that the answer to an alternative writ of mandamus may plead the facts, if any exist, which will defeat the writ, and set forth any legal reason why a peremptory writ should be denied). In the language of the statute, "[o]n the return day of the alternative writ, or such further day as the court allows, the party on whom the writ is served may show cause by answer, made in the same manner as an answer to a complaint in [a] civil action." Section 44-2-9. Thus, the alternative writ serves the same function as a complaint in a civil action and the answer to the writ serves as the answer. See City of Sunland Park, 2004-NMCA-024, ¶ 7, 135 N.M. 143, 85 P.3d 267 ("Together, the writ and the answer form the issues that are before the court."). Again, the statute expressly provides, "[n]o other pleading or written allegation is allowed than the writ and answer. They shall be construed and amended in the same manner as pleadings in a civil action[.]" Section 44-2-11.
{15} If the writ is not legally sufficient because it lacks the necessary allegations of fact, but the respondent nevertheless answers the allegations contained in the petition as if they were set forth in the writ, then this defect in the writ is waived and the allegations contained in the petition itself are considered. City of Sunland Park, 2004-NMCA-024, ¶ 8, 135 N.M. 143, 85 P.3d 267 (stating that defects in the writ can be waived and the allegations in the petition *1122 may be considered where the respondent answers the allegations as if they were set forth in the writ); State ex rel. Burg v. City of Albuquerque, 31 N.M. 576, 581, 249 P. 242, 245 (1926) (holding that by answering the allegations set forth in the petition as if they were set forth in the writ, the defect in the writ was waived, and the allegations contained in the petition were deemed incorporated into the writ). After the answer is filed, the issues raised by these pleadings are then tried as in any other civil case. Section 44-2-11 ("[T]he issues thereby joined [by the writ and answer] shall be tried and further proceedings had in the same manner as in a civil action."); Dumars & Browde at 163 ("The mandamus statute provides that the case is to be tried on the writ and the answer."). If no answer is made to the alternative writ, there is a default and a peremptory writ of mandamus "shall be allowed." Section 44-2-10.
{16} In this particular case, San Lorenzo filed a verified "petition for peremptory writ of mandamus" alleging that the Water Master was failing to perform his clear legal duty to administer the adjudicated water right priorities of the Mimbres River to its detriment and that it had no plain, speedy, and adequate remedy in the course of the law. The district court thereupon issued a "Peremptory Writ of Mandamus." However, the writ was not a true peremptory writ because it directed the Water Master to "prepare and file with [the district] court and serve on the interested parties within thirty days after the date of service of this Writ a response to the Petition for Peremptory Writ of Mandamus." Instead, the writ which was actually issued was in the nature of an alternative writ by directing that an answer be filed. Moreover, the writ itself was defective because it did not set forth the full and complete facts which demonstrated that San Lorenzo was entitled to the writ. Nevertheless, the Water Master answered the factual allegations contained in the petition. Thus, San Lorenzo's petition and the Water Master's answer constituted the pleadings in the case, setting forth the issues that were before the court.
{17} Pertinent to this case, San Lorenzo's petition alleges:
9. The court adjudicated under the San Lorenzo Community Ditch a total of 398.5 acres with a priority of December [1869] and 16.5 acres with a priority of 1875.
. . . .
17. In December 2002 or early January 2003 the San Lorenzo Community Ditch installed three measuring devices to determine the rate of flow and the volume of water diverted by the ditch.
18. The maximum diversion rate for the San Lorenzo Community Ditch is computed to be at least 6.7 cubic feet per second during the month of July. This maximum monthly diversion rate is based on a consumptive irrigation requirement of 4.47 inches per acre, an on-farm irrigation efficiency of 50 percent, a farm delivery requirement of 0.74 feet per acre, an off-farm conveyance efficiency of 75 percent, and a total irrigated acreage of 415.4 acres. If the off-farm conveyance efficiency is 65 percent rather than 75 percent, the maximum diversion rate would be at least 7.8 cubic feet per second.
. . . .
25. The Watermaster has a present ability to administer priorities using the computed maximum diversion requirement for the San Lorenzo Community Ditch and the measuring devices that have been installed on the Ditch.
In response to these allegations, the Water Master answered:
9. . . . [U]pon information and belief that the original adjudicated acreage for the San Lorenzo Community Ditch Association was 415.40, 16.5 acres of which have an 1875 priority date, and that water rights have been transferred off of 46.17 acres adjudicated a December 1869 priority date, pursuant to permits issued by the Office of the State Engineer, leaving 352.73 acres with a December 1869 priority date currently entitled to irrigation rights. Based on 352.73 acres instead of 415.4 acres, the Office of the State Engineer hydrologist calculates a maximum diversion rate of 5.7 cubic feet per second when it is needed, but not as a continuous rate.
. . . .

*1123 14. Respondents deny that the maximum diversion rate described in paragraph 18 of the Petition is accurate. As noted, based on 352.73 acres instead of 415.4 acres, the Office of the State Engineer hydrologist calculates a maximum diversion rate of 5.7 cubic feet per second when it is needed, but not as a continuous rate. Respondents further state that reliance on a calculated maximum diversion rate alone is not dispositive of the actual rate of flow Petitioner's require to meet existing soil and crop conditions, rather it is a maximum rate when conditions so require.
. . . .
19. Respondents deny paragraph 25 of the Petition and affirmatively state that, while the maximum diversion rate alone is sufficient to establish the maximum amount of water San Lorenzo may require, field investigations are necessary to establish the acreage and crops actually being irrigated and the amount of the flow required in order to determine which juniors may be subject to curtailment and the duration of the curtailment. The State admits that the measuring devices at San Lorenzo could be used in administering a priority call but states that the measuring devices, standing alone, are not sufficient for strict priority administration.
20. In response to paragraph 25 of the Petition, Respondents further state that there is no device on the river itself to indicate when flows reach a certain level at the San Lorenzo Community Ditch; rather, as noted in Petitioner's paragraph 17, the measuring devices determine only the rate of flow and volume of water diverted by the ditch. Moreover, effective administration will require a more detailed analysis of the entire Mimbres surface water system, including more comprehensive measurement or estimation of flows, demands, diversions, and returns. Finally, San Lorenzo has failed and refused to provide the Water[M]aster or his assistants with access to the measuring devices installed on the San Lorenzo ditch.
{18} The memorandum opinion filed by the district court states that it appears that the answer filed by the Water Master raises questions of fact and that mandamus should not issue when issues of fact are raised. "`The rights of the parties may not be adjudicated by mandamus.'" (quoting Concerned Residents for Neighborhood, Inc. v. Shollenbarger, 113 N.M. 667, 670, 831 P.2d 603, 606 (Ct.App.1991)). We agree with this reasoning and further conclude that no final, appealable order was entered.
{19} Where issues of fact are raised by the alternative writ and answer, a trial must first be held to resolve those factual issues to determine if the petitioner is entitled to the extraordinary writ of mandamus. "Relevant rights and duties must be established before a writ of mandamus can issue." Schein v. N. Rio Arriba Elec. Coop., Inc., 1997-NMSC-011, ¶ 22, 122 N.M. 800, 932 P.2d 490; see State ex rel. State Highway Comm'n v. Quesenberry, 72 N.M. 291, 294, 383 P.2d 255, 257 (1963) (stating that rights between parties are not adjudicated by mandamus because it is a method of enforcing an existing right). It has only been in cases where the parties did not dispute the relevant underlying facts giving rise to a duty to act that the courts have been able to determine that the writ was properly issued. See Brantley Farms, 1998-NMCA-023, ¶ 19, 124 N.M. 698, 954 P.2d 763 (citing Perea v. Baca, 94 N.M. 624, 627, 614 P.2d 541, 544 (1980) ("[F]inding that, because director of Department of Alcoholic Beverage Control had conceded that statutory requirements for issuing transfer of license had been satisfied, and there was no question concerning the completion of the discretionary acts, mandamus was proper.")); El Dorado at Santa Fe, Inc., 89 N.M. at 319, 551 P.2d at 1366 (holding that the board of county commissioners had a clear duty to approve a subdivision plat where the board admitted that it had determined that the subdivision application complied with statutory requirements). Where, as in this case, the facts are disputed, a trial is contemplated because mandamus is only appropriate to compel an official to perform a duty if the duty is clear and indisputable. See Witt v. Hartman, 82 N.M. 170, 172, 477 P.2d 608, 610 (1970) ("Mandamus lies to compel the performance of a statutory duty only when it is clear and indisputable.").
*1124 {20} The mandamus statute directs, "[i]f judgment is given for the plaintiff, he shall recover the damages which he has sustained, together with costs and disbursements, and a peremptory mandamus shall be awarded without delay." Section 44-2-12. The final judgment is then reviewable on appeal as in any other case. See Dumars & Browde, supra at 163 ("Appeals are taken from mandamus judgments in the same manner as from any other action[.]"). Section 44-2-14 provides:
[I]n all cases of proceedings by mandamus in any district court of this state, the final judgment of the court thereon shall be reviewable by appeal or writ of error in the same manner as now provided by law in other civil cases.
{21} A mandamus proceeding is treated in the same way as any other civil action to determine if a final, appealable order has been filed. In Board of Trustees of Village of Los Ranchos de Albuquerque v. Sanchez, 2004-NMCA-128, 136 N.M. 528, 101 P.3d 339, we held that although the district court issued a peremptory writ of mandamus, there was no final, appealable order because the amount of damages was not resolved even though the petition requested, and the writ ordered damages, attorney fees, and costs. Id. ¶ 11. We therefore dismissed the appeal because the order before us was not a final, appealable order. Id. ¶ 14. See also Kucel v. N.M. Med. Review Comm'n, 2000-NMCA-026, ¶ 16, 128 N.M. 691, 997 P.2d 823 (concluding that an order granting a writ of mandamus was a final, appealable order because it included decretal language carrying the decision into effect by compelling the director of the medical review commission to set a panel hearing).
{22} We hold that no final, appealable order was entered in the district court because further proceedings are contemplated. The petition and answer raise issues of fact that have not been decided, and no determination has been made concerning whether the Water Master has a clear duty to perform an act and whether he was performing that ministerial act. In light of our holding, we need not decide whether the pending petition for preliminary and permanent injunction San Lorenzo filed, but has not pursued, constitutes a plain, speedy, and adequate remedy in the ordinary course of the law.

CONCLUSION
{23} The appeal is dismissed and the case is remanded to the district court for further proceedings.
{24} IT IS SO ORDERED.
WE CONCUR: MICHAEL D. BUSTAMANTE, Chief Judge and IRA ROBINSON, Judge.
