
155 P.3d 761 (2007)
2007-NMCA-036
STATE of NEW MEXICO, ex rel. BOARD OF COUNTY COMMISSIONERS, County of SAN MIGUEL; and New Mexico Association of Counties, a New Mexico nonprofit corporation, Petitioners-Appellees.
v.
Joe R. WILLIAMS, Secretary of the New Mexico Corrections Department; Charlene Knipfing, Director of the Probation and Parole Division, State of New Mexico Parole Board, a/k/a Board of Probation and Parole, a/k/a Probation and Parole Division; and John Doe, Director of the Probation and Parole Division for the County of San Miguel, Respondents-Appellants.
No. 25,819.
Court of Appeals of New Mexico.
January 9, 2007.
Certiorari Denied March 19, 2007.
*763 Victor R. Marshall & Associates, P.C., Victor R. Marshall, Diane P. Donaghy, of Counsel, Albuquerque, NM, for Appellees.
New Mexico Corrections Department, Nick D'Angelo, General Counsel, Santa Fe, NM, for Appellants.
Certiorari Denied, No. 30,251, March 19, 2007.

OPINION
FRY, Judge.
{1} In this case we are asked to determine whether the department of corrections is responsible for the costs of housing parole violators who are incarcerated in a county jail at the request of the department. We hold that it is. Respondents, whom we refer to collectively as "Corrections," are the secretary of the corrections department, the director of that department's probation and parole division, and the district supervisor of San Miguel County's probation and parole division. Corrections appeals from a writ of mandamus and the corresponding written decision issued in favor of Petitioners, which we refer to collectively as "the County" and which include the San Miguel County board of county commissioners and the New Mexico Association of Counties. The district court determined that Corrections must pay for the costs associated with the confinement of parolees held in any county detention facilities. We affirm.
BACKGROUND
1. The First Lawsuit
{2} The County brought suit against Corrections prior to its initiation of the present action. We refer to the initial lawsuit as the *764 "first lawsuit." The first lawsuit was in the form of a complaint for declaratory and injunctive relief. We briefly review the proceedings in the first lawsuit because Corrections argues on appeal that the first lawsuit precluded the County from bringing the present lawsuit in accordance with the doctrines of res judicata and collateral estoppel.
{3} The complaint in the first lawsuit alleged that Corrections had been using county jails to hold parolees alleged to have violated their parole and that "[e]xcept in rare instances, [Corrections has] adopted a practice of refusing to compensate or reimburse" the County for the costs associated with housing these parolees. The County sought a declaratory judgment that Corrections was responsible for the costs of housing parolees, "with such cost to be negotiated between the parties, or set by the court in the absence of agreement."
{4} Corrections filed motions to dismiss the first lawsuit and argued that the County's suit was barred by sovereign immunity. At the hearing on the motions, the district court determined that sovereign immunity barred the suit but suggested that the merits of the case might be reached via a petition for writ of mandamus. The County indicated it could quickly amend the existing complaint to add a mandamus claim. Corrections objected to amendment on the basis that "[a] petition for writ of mandamus is an entirely different cause of action and theory of law" with "an entirely different procedure for response," and stated that the County could file such a petition as a separate lawsuit. The County's attorney had no objection to filing a separate lawsuit "as long as the judgment specifies that it's without prejudice to file such an action." The district court replied:
No, my ruling on this has absolutely nothing to do with mandamus. It's just ruling that a declaratory judgment[]that sovereign immunity does preclude declaratory judgment. It would have no bearing whatsoever on you. There's no statute of limitation, no nothing that would preclude you from filing a totally separate action on a mandamus if you chose to do so.
The district court subsequently said that its ruling would be with prejudice only as to the declaratory judgment complaint filed in the first lawsuit.
{5} At the presentment hearing, the district court clarified that its ruling was not on the merits but simply a determination that "declaratory judgment is not the appropriate cause of action[.] . . . I haven't ruled that the issues themselves are[] barred by sovereign immunity." Later in the hearing, the district court stated, "I agree this does not preclude your considering mandamus or prohibition, whether those lie or not. . . . [A]nd I'm not ruling on that, but this certainly does not preclude your attempting that anyhow, if that is an appropriate remedy." The district court's written order dismissed the complaint and found "that the claims in the Complaint for declaratory judgment against [Corrections] are barred in that [Corrections is] entitled to sovereign immunity." The order went on to conclude that "[t]his ruling is only on the declaratory judgment issue."
2. The Present Litigation
{6} On the day of the presentment hearing in the first lawsuit, the County filed this suit as a verified petition for a writ of mandamus and a writ of prohibition, which made the same general allegations as the complaint in the first lawsuit. The County sought a writ compelling Corrections to pay the costs associated with housing parolees. The district court entered an alternative writ of mandamus or writ of prohibition and scheduled the matter for hearing. Corrections filed an answer and a motion to dismiss, raising essentially the same issues Corrections now raises on appeal. After a hearing, the district court entered the peremptory writ of mandamus and prohibition and a corresponding written decision. Corrections appeals.
DISCUSSION
{7} As an initial matter, we consider the proper nomenclature for the district court's action in the present case. Although the parties do not dispute the district court's description of its decision as a writ of mandamus or prohibition, we believe the proper terminology for the district court's action is mandamus, not prohibition. See Stanley v. Raton Bd. of Educ., 117 N.M. 717, 718, 876 P.2d 232, 233 (1994) (explaining that writs of *765 prohibition are "extraordinary writ[s], issued by a superior court to an inferior court" and that mandamus includes an order requiring a public functionary "[to restore] the complainant to rights or privileges of which he has been illegally deprived." (internal quotation marks and citations omitted; first alteration in original)). Therefore, in this opinion we refer to the district court's action as the issuance of a writ of mandamus.
{8} Corrections makes an argument related to the merits of the writ of mandamus and several procedural sub-arguments. It also argues that the writ is barred by principles of sovereign immunity or precluded by the doctrines of collateral estoppel or res judicata. We address each argument in turn.
1. Merits of the Writ
{9} Corrections argues that the actions required by the writ were not ministerial or "specially enjoined by law." In order to address this contention, we first consider the nature of mandamus in New Mexico. A writ of mandamus "may be issued to any inferior tribunal, corporation, board or person, to compel the performance of an act which the law specially enjoins as a duty resulting from an office, trust or station." NMSA 1978, § 44-2-4 (1884). "Mandamus is appropriate to compel the performance of an affirmative act by another where the duty to perform the act is clearly enjoined by law and where there is no other plain, speedy and adequate remedy in the ordinary course of law." West v. San Jon Bd. of Educ., 2003-NMCA-130, ¶ 9, 134 N.M. 498, 79 P.3d 842 (internal quotation marks and citation omitted); see also State ex rel. Sandel v. N.M. Pub. Util. Comm'n, 1999-NMSC-019, ¶ 11, 127 N.M. 272, 980 P.2d 55 (stating that "mandamus is an appropriate means to prohibit unlawful or unconstitutional official action" (internal quotation marks and citation omitted)). Determining whether the acts compelled by the writ were "clearly enjoined by law" requires us to consider the meaning of various statutes, which is a question of law. See In re Adjustments to Franchise Fees, 2000-NMSC-035, ¶ 7, 129 N.M. 787, 14 P.3d 525 (stating that a question underlying a mandamus action that involves interpretation of a statute is a question of law).
{10} The question raised by the mandamus petition is which governmental entity is responsible for the housing and care of parolees who are alleged to have violated the terms of their parole. A parolee is a person who has been convicted of a felony and who has completed a term of imprisonment in a corrections facility designated by the department of corrections. See NMSA 1978, § 31-18-15(C) (2005) (requiring courts sentencing convicted felons "to imprisonment in a corrections facility designated by the corrections department" to include in such sentences "authority for a period of parole"); NMSA 1978, § 31-21-10(C) (2005) (establishing the length of parole periods for inmates who have "served the sentence of imprisonment imposed by the court in an institution designated by the corrections department"). Indeed, by statute, "[p]ersons sentenced to imprisonment for a term of one year or more shall be imprisoned in a corrections facility designated by the corrections department." NMSA 1978, § 31-20-2(A) (1993). It is clear that the "corrections facility" referred to in these statutes is one under the jurisdiction of the department of corrections. Cf. id. (noting that if "a portion of the sentence is suspended so as to provide for imprisonment for not more than eighteen months[,] then the imprisonment may be in such place of incarceration, other than a corrections facility under the jurisdiction of the corrections department, as the sentencing judge, in his discretion, may prescribe" (emphasis added)).
{11} In addition, convicted felons serving their sentences in the state penitentiary system are subject to the authority of the state parole board, which has the power to "grant, deny or revoke parole." NMSA 1978, § 31-21-25(B)(1) (2001). While the parole board may decide to release a convicted felon to parole after a period of imprisonment, as a convicted felon, he remains within the legal custody of the corrections department until he completes his sentence. Robinson v. Cox, 77 N.M. 55, 59, 419 P.2d 253, 256 (1966) ("A paroled prisoner is not discharged from the custody of the prison authorities, but is at all times under the complete *766 custody and control, and subject to the orders of the parole board[.]"). That the corrections department retains legal responsibility for parolees is evident in the statute that authorizes the department to issue warrants for the arrest of parole violators: "At any time during release on parole the [parole] board or the director [of the corrections department's field services division] may issue a warrant for the arrest of the released prisoner for violation of any of the conditions of release." § 31-21-14(A); see also NMSA 1978, § 31-21-5(D), (E) (1991) (defining "board" as "the parole board" and "director" as "the director of the field services division of the corrections department").
{12} We agree with the district court that New Mexico law mandates that a parolee remains in the legal custody of the department of corrections for the duration of his original sentence, regardless of where he is physically locatedat the state penitentiary, in a county jail, or elsewhere. The department of corrections also retains legal responsibility, including financial responsibility, for a convicted felon, whether he is imprisoned at the state penitentiary, on parole, or rearrested as a parole violator. Although not binding legal precedent on this Court, we agree with the analysis set forth in 26 Op. N.M. Att'y Gen. 48, 50 (1968), in which the attorney general concluded that the department of corrections must pay the cost of hospitalizing and transporting a parolee who was arrested by a parole officer and placed in the county jail. We also adopt the analysis set forth in 62 Op. N.M. Att'y Gen. 105, 106 (1970), in which the attorney general, citing our Supreme Court's opinion in Robinson, determined that when a parolee is arrested on a parole violation and placed in a county jail he "is in the control and custody of the State Penitentiary and the Department of Corrections must bear the cost of such control and custody." 62 Op. N.M. Att'y Gen. at 106.
{13} We conclude, therefore, that Corrections' legal responsibility for convicted felons during the term of their sentences, no matter where they are physically located, is mandated by law, and this legal responsibility is not discretionary. See, e.g., Hart v. City of Albuquerque, 1999-NMCA-043, ¶ 17, 126 N.M. 753, 975 P.2d 366 ("A ministerial duty required of a public official constitutes 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." (internal quotation marks and citations omitted)).
Procedural Arguments
{14} We turn now to Corrections procedural sub-arguments. Corrections argues that the district court erred in issuing mandamus because: (1) the County did not sustain its burden of proof because issues of fact made mandamus inappropriate; (2) the County's allegations in its petition were impermissibly vague and conclusory; (3) the writ imposes no monetary limit on the amount Corrections will have to pay for parolees, despite the fact that the legislature appropriated only $1 million to cover Corrections' obligations; (4) the writ is overly broad in favor of all counties and the New Mexico Association of Counties; and (5) mandamus was improper because the County had an adequate remedy at law by way of appeal from the dismissal of the first lawsuit.
{15} With respect to the County's burden of proof, Corrections argues that in order to prevail, the County had to present evidence establishing that Corrections failed to pay the costs of confinement for parolees in the past. Because the County did not present any witnesses or evidence, Corrections contends, the district court should have dismissed the petition for mandamus. We are not persuaded. By the time of the hearing on the petition, the County was seeking only prospective relief, not recovery of costs for parolees housed in the past. In addition, the question of which governmental entity is responsible for the cost of detaining parolees is a question of law determined by consideration of applicable statutes and cases. For the same reasons, we also reject Corrections' argument that issues of fact about past payment of these costs precluded issuance of mandamus.
{16} As for Corrections' argument that the allegations in the County's petition *767 were vague and conclusory, we are equally unpersuaded. Corrections contends the allegations in a mandamus petition must be pleaded with the same specificity as in other civil actions. Assuming this statement is correct, we fail to see how the County's petition fell below the standard for notice pleading that is applicable in civil actions. "Under our rules of notice pleading, it is sufficient that [the] defendants be given only a fair idea of the nature of the claim asserted against them sufficient to apprise them of the general basis of the claim." Garcia v. Coffman, 1997-NMCA-092, ¶ 11, 124 N.M. 12, 946 P.2d 216 (internal quotation marks, citation, and alteration omitted). The County's allegations provided a definition of "parolees;" stated that Corrections often ordered parolees to be detained in county jails; complained that county jails were, as a result, forced to bear the cost of detaining and caring for parolees; cited authority for the proposition that such costs should be borne by Corrections; and asked for a writ ordering Corrections to bear the costs of housing and providing for parolees detained in county jails. These allegations clearly apprised Corrections of the general basis of the County's claim.
{17} Corrections further contends that its obligation to bear the costs of detaining parolees in county jails should be capped at the $1 million appropriated by the legislature. We do not agree. As we discussed above, Corrections has statutory duties, and these do not vary with the size of its budget. All governmental agencies must somehow carry out their statutorily defined duties within the constraints of a legislatively established annual budget. In this regard, the legislature has authorized several alternatives to housing parole violators with county jails. For example, Corrections can return violators back to the penitentiary system in accordance with NMSA 1978, § 31-21-14(A) (1963), or it can send them to alternative correctional programs pursuant to the Adult Community Correction Act, NMSA 1978, §§ 33-9-1 to -10 (1983, as amended through 2004). Should Corrections or sentencing district courts consider county jails to be convenient short-term holding spaces, the legislature has authorized Corrections to enter into agreements with the counties for housing parole violators. NMSA 1978, § 31-20-2(G) (1993) ("The corrections department may enter into contracts with public or private detention facilities for the purpose of housing inmates lawfully committed to the corrections department.").
{18} Corrections next argues that the writ is overly broad because it applies to all counties, not just to San Miguel County, which brought the action. We disagree. The Association of Counties was also a petitioner, and the petition alleged that the Association represented the interests of all its member counties. As we discussed above, Corrections has statutory obligations to pay the cost of housing parolees in county jails, and these obligations apply statewide.
{19} Corrections also contends mandamus was improper because the County had an adequate remedy at law by way of an appeal from dismissal of the first lawsuit. See Montoya v. Blackhurst, 84 N.M. 91, 92, 500 P.2d 176, 177 (1972) (stating that mandamus does not lie where there is an adequate remedy by appeal). We are not persuaded. It is clear that the district court intended its dismissal of the first lawsuit to be with prejudice only as to the declaratory judgment form of action, not as to the merits of the County's claims in the context of an action for mandamus. The district court expressly stated that "declaratory judgment is not the appropriate cause of action[.] . . . I haven't ruled that the issues themselves are[] barred by sovereign immunity." Thus, we fail to see how an appeal from this ruling would have availed the County anything. Moreover, an appeal from the dismissal of the declaratory judgment action would not have provided the County with the remedy it seeks in the present mandamus action. In the declaratory judgment action, the County sought damages for Corrections' alleged past breaches of tort duties or implied contract obligations. The district court determined such relief was barred by sovereign immunity. In contrast, in this mandamus action, the County requested the district court to compel Corrections' future compliance with statutory mandates. Thus, we cannot say that the County had an *768 adequate remedy at law consisting of appeal from the written order in the first lawsuit.
3. Sovereign Immunity Does Not Bar Mandamus
{20} Corrections argues that since its individual respondents are state agencies or state employees acting in their official capacity, issuance of mandamus was barred by sovereign immunity. We review de novo the validity of a claim of sovereign immunity. See Gallegos v. Pueblo of Tesuque, 2002-NMSC-012, ¶ 6, 132 N.M. 207, 46 P.3d 668.
{21} Corrections first contends the County's petition for mandamus is founded on a theory such as quasi-contract, quantum meruit, or unjust enrichment, and asserts that it is immune from such claims pursuant to NMSA 1978, § 37-1-23(A) (1976), which provides that "[g]overnmental entities are granted immunity from actions based on contract, except actions based on a valid written contract." Alternatively, Corrections argues that the County's petition is founded on a claim in tort for which Corrections' immunity has not been waived by the Tort Claims Act.
{22} We do not agree that the County's claims in this case sounded in either contract or tort. Instead, the County expressly sought an order to prospectively require the respondent officials to perform duties imposed on them by law. "Traditionally, mandamus actions could be brought against governmental officials requiring them to perform their statutory duty regardless of whether the government enjoyed sovereign immunity because such actions were not actions against the state." Bd. of County Comm'rs v. Risk Mgmt. Div., 120 N.M. 178, 181, 899 P.2d 1132, 1135 (1995); see also State ex rel. Castillo Corp. v. N.M. State Tax Comm'n, 79 N.M. 357, 359, 443 P.2d 850, 852 (1968) (stating that a mandamus proceeding compels performance of a plainly required duty and "is not a suit against the [s]tate"). Because this mandamus action is not a suit against the state, sovereign immunity is not a bar.
4. Res Judicata or Collateral Estoppel Do Not Preclude Mandamus
{23} Corrections contends that the doctrines of res judicata and collateral estoppel bar the County's suit in this case. Corrections argues that this case has the same parties, essentially the same cause of action or legal theory, the same ultimate factual issue, and the same relief requested as the first lawsuit, which was dismissed by the district court as barred on sovereign immunity grounds. We disagree and hold that neither res judicata nor collateral estoppel bar this mandamus action.
{24} This issue as a mixed question of law and fact. We review the facts to determine whether they are supported by substantial evidence, but we review de novo the legal conclusions flowing from those facts. Bank of Santa Fe v. Marcy Plaza Assocs., 2002-NMCA-014, ¶ 12, 131 N.M. 537, 40 P.3d 442.
{25} "Claim preclusion, or res judicata, precludes a subsequent action involving the same claim or cause of action." Id. ¶ 13. Res judicata applies when there is "(1) identity of parties or privies, (2) identity of capacity or character of persons for or against whom the claim is made, (3)[the] same cause of action, and (4)[the] same subject matter." Id. (internal quotation marks and citation omitted; alteration in original). In order for res judicata to apply, "the claimant must have had a full and fair opportunity to litigate the claim in the original action and there must have been a final decision on the merits." Moffat v. Branch, 2002-NMCA-067, ¶ 17, 132 N.M. 412, 49 P.3d 673. Corrections, as the party seeking to bar the County's suit in mandamus, has the burden of establishing res judicata. Anaya v. City of Albuquerque, 1996-NMCA-092, ¶ 5, 122 N.M. 326, 924 P.2d 735.
{26} Res judicata does not apply in this case because no adjudication of the merits occurred in the first lawsuit. The district court determined only that declaratory judgment was barred by sovereign immunity. See City of Sunland Park v. Macias, 2003-NMCA-098, ¶ 21, 134 N.M. 216, 75 P.3d 816 (stating that a prerequisite to application of the doctrine of res judicata, "not only must the claimant have had a full and fair opportunity to litigate the claim in the original action, but there must also have been a final decision on the merits"). In City of Sunland *769 Park, this Court declined to rely on res judicata where the county in that case had argued below, as Corrections argues here, that it was not arguing the merits of the issues but simply seeking dismissal for failure to state a claim. Id. ¶ 21. Similarly, we decline to rely on res judicata where Corrections simply argued in the first lawsuit that sovereign immunity barred the declaratory judgment action and prevailed on that ground without an adjudication on the merits.
{27} Corrections alternatively argues that collateral estoppel precludes the present mandamus action. "Collateral estoppel, like res judicata, is a judicial economy measure to prevent litigation of an issue already judicially decided." Int'l Paper Co. v. Farrar, 102 N.M. 739, 741, 700 P.2d 642, 644 (1985). "The application of collateral estoppel generally requires that (1) the parties in the current action were the same or in privity with the parties in the prior action, (2) the subject matter of the two actions is different, (3) the ultimate fact or issue was actually litigated, and (4) the issue was necessarily determined." City of Sunland Park, 2003-NMCA-098, ¶ 10, 134 N.M. 216, 75 P.3d 816.
{28} We are not persuaded that collateral estoppel is applicable. The district court in the first lawsuit dismissed the County's declaratory judgment action solely on the basis of sovereign immunity. Thus, the only issue decided in the case was the immunity bar against the County's claims for damages and declaratory judgment. The district court indicated that the merits of the case, i.e., the question of which entity should pay for the care and housing of parolees, could possibly be reached if the action were brought in mandamus. Corrections argued that the County's filing of a separate mandamus action would be preferable to its amending the complaint. Thus, the district court and the parties anticipated and intended that the lawsuit, refashioned as a petition for writ of mandamus, would be refiled. Collateral estoppel is inapplicable because the ultimate issue in the case was not litigated or decided in the first lawsuit.
CONCLUSION
{29} We affirm the district court's peremptory writ of mandamus and the decision on petition for writ of mandamus.
{30} IT IS SO ORDERED.
WE CONCUR: RODERICK T. KENNEDY and MICHAEL E. VIGIL, Judges.
