OPINION OF THE COURT
Davis, J.Petitioner is a defendant in a criminal action pending in the Monroe County Court who has been charged with rape and sodomy. During the course of the criminal action, the People moved for an order directing petitioner to provide a blood sample to be tested for his human immunodeficiency virus (HIV) status and further directing that the results of that test be disclosed to the complainant and her husband. The affidavit of the First Assistant District Attorney in support of the motion states that the requested relief was not sought pursuant to the discovery provisions of CPL 240.40 (2) (b) (v) and he expressly "agree[d] not to use any of the results for any aspect of the prosecution”. Rather, the relief was requested for the purpose of assisting the complainant who desired “only to use the test results in an effort to relieve and recover from her emotional trauma”. The statutory provision upon which the People predicated their claim of entitlement, to the requested relief was Public Health Law § 2785 (2). Petitioner opposed the People’s motion. Respondent, a Monroe County Court Judge, orally granted the relief sought. Prior to the issuance of respondent’s order, however, petitioner commenced this *198original CPLR article 78 proceeding seeking a judgment in the nature of prohibition to restrain and enjoin respondent from (1) compelling petitioner to submit to a blood test to determine his HIV status and (2) further directing that the results of that test be disclosed to the complainant and her husband. Petitioner contends that a writ of prohibition should issue because (1) County Court lacks jurisdiction or authority to compel petitioner to submit to such blood test or to compel disclosure of the results of that test, (2) the District Attorney lacks authority to move for blood testing pursuant to the Public Health Law, (3) Public Health Law § 2785 (2) does not authorize an order compelling petitioner to submit to a blood test to determine his HIV status, and (4) an order compelling him to submit to a blood test to determine his HIV status would violate his Federal and State constitutional rights. The People argue that the petition should be dismissed because the court-ordered testing and disclosure were proper under the circumstances of this case.
"When a petitioner seeks relief in the nature of prohibition pursuant to CPLR 7803 (2), the court must make a two-tiered analysis. It must first determine whether the issue presented is the type for which the remedy may be granted and, if it is, whether prohibition is warranted by the merits of the claim” (Matter of Holtzman v Goldman, 71 NY2d 564, 568). The extraordinary remedy of prohibition is not available to correct or prevent trial errors of substantive or procedural law, no matter how grievous (see, La Rocca v Lane, 37 NY2d 575, 579, cert denied 424 US 968). Rather, "[prohibition is available only where there is a clear legal right to such relief, and then only where a court acts or threatens to act either without jurisdiction or in excess of its authorized powers” (Matter of James N. v D’Amico, 139 AD2d 302, 303, lv denied 73 NY2d 703). If a court acts without jurisdiction or acts or threatens to act in excess of its powers, prohibition is not mandatory but is discretionary. Whether that discretion should be exercised involves a consideration of a number of factors, including the gravity of the harm caused and the availability of other methods of redress (see, Matter of B. T. Prods. v Barr, 54 AD2d 315, 317, affd 44 NY2d 226).
Petitioner contends that prohibition lies in the circumstances of this case because respondent has acted or is threatening to act without jurisdiction or in excess of his authorized powers. We agree. County Court is a court of limited jurisdiction and it may exercise jurisdiction over only those classes of *199actions and proceedings specifically granted to it by the State Constitution or by statute (see, NY Const, art VI, § 11; Judiciary Law §§ 190, 190-b; Newhouse Props. v McGee, 139 AD2d 923; Matter of Hill v Marks, 124 AD2d 445). While County Court unquestionably has jurisdiction over the pending criminal action (see, CPL 10.10, 10.20), here, the People’s motion was not made to develop evidence for use in the prosecution of the criminal action. Rather, the sole statutory basis upon which the People’s motion was predicated was Public Health Law § 2785 (2). That provision, contrary to the People’s argument, did not confer jurisdiction on County Court. Indeed, the People cite no statutory authority that grants jurisdiction to County Court either to compel a defendant in a criminal action to submit to a blood test for the purpose of determining his HIV status or to direct disclosure of the results of that test where, as here, the test results sought were not for use in any aspect of the criminal action (cf., Matter of Anonymous, 156 AD2d 1028, affd 76 NY2d 766; People v Thomas, 139 Misc 2d 1072).
Furthermore, prohibition is available where the court acts or threatens to act in excess of its authorized powers. Public Health Law § 2785 (2) does not authorize court-ordered testing to determine the HIV status of a person. That section authorizes court-ordered disclosure of confidential HIV-related information only in specific circumstances not present here. Public Health Law § 2781 delineates the conditions for obtaining an order for the performance of an HIV-related test. Pursuant to that section, HIV-related testing is prohibited without the written informed consent of the person to be tested, except as authorized by CPLR 3121 or otherwise specifically permitted by statute (see, Matter of Anonymous, supra, at 1029). Because of the absence of specific statutory authority that permits HIV testing under the circumstances of this case, the authority of County Court in this regard is circumscribed by Public Health Law § 2781 (1).
Application of the established principles regarding prohibition compels the conclusion that petitioner has shown that "the issue presented is the type for which the remedy [of prohibition] may be granted” (Matter of Holtzman v Goldman, supra, at 568). Petitioner has demonstrated a "clear legal right” (Matter of James N. v D’Amico, supra, at 303) to the remedy and respondent has threatened to act without jurisdiction and in excess of his authorized powers by ordering petitioner to submit to a blood test to determine his HIV *200status and by directing that those test results be disclosed to the complainant and her husband.
Additionally, we conclude that, in the exercise of sound judicial discretion, "prohibition is warranted by the merits of the claim” (Matter of Holtzman v Goldman, supra, at 568). The issuance of an order by respondent compelling petitioner to submit to a blood test to determine his HIV status and directing that those test results be disclosed to the complainant and her husband cannot be corrected on appeal or by any other proceedings at law or in equity. No appeal would lie from such an order since it would be neither an order issued as part of the criminal proceeding nor an order issued in a separate civil proceeding (see, La Rocca v Lane, supra, at 579). Therefore, prohibition is the only remedy available to redress the lack of jurisdiction and excess of power. Accordingly, judgment should be granted prohibiting respondent from compelling petitioner to submit to a blood test for the purpose of determining his HIV status and from directing that the results of that test be disclosed to the complainant and her husband. In view of our holding, we do not address the remaining arguments raised by petitioner.
Boomer, J. P., Pine, Boehm and Fallon, JJ., concur.
Petition unanimously granted, without costs, and judgment granted in accordance with an opinion by Davis, J.