
148 Pa. Commonwealth Ct. 29 (1992)
609 A.2d 622
Francis KESTER, Petitioner,
v.
PENNSYLVANIA BOARD OF PROBATION AND PAROLE, et al., Respondents.
Commonwealth Court of Pennsylvania.
Submitted on Briefs October 25, 1991.
Decided May 11, 1992.
*33 Francis Kester, petitioner, for himself.
Arthur R. Thomas, Asst. Chief Counsel, for respondent.
Before CRAIG, President Judge, and PALLADINO, J., and BARRY, Senior Judge.
BARRY, Senior Judge.
Francis Kester filed a pleading styled "Motion and Notice Seeking the Board to Lift the Detainer Against Petitioner, Until Charges are Ruled on by the Superior Court". This Court ordered that the pleading be treated as a petition for review in our original jurisdiction challenging the detainer lodged against Kester by the Pennsylvania Board of Probation and Parole (the Board). The Board filed preliminary objections in the nature of a demurrer contending that (1) detainer actions lie within this Court's appellate jurisdiction rather than its original jurisdiction, and that (2) the petition fails to state a cause of action because the Board properly detained petitioner *34 pending the disposition of new criminal charges pursuant to its authority under 37 Pa.Code § 71.3(1).
Our initial inquiry, as in all cases, is a determination of whether this Court has subject matter jurisdiction to hear the petition. This Court's jurisdiction is governed by the Judicial Code. Our appellate jurisdiction is provided for as follows:
[T]he Commonwealth Court shall have exclusive jurisdiction of appeals from final orders of government agencies in the following cases:
(1) All appeals...from any other Commonwealth agency having Statewide jurisdiction.
42 Pa.C.S. § 763(a)(1).
Because the Board is a Commonwealth agency having statewide jurisdiction, Kester's petition clearly passes that prong of the test. Bronson v. Board of Probation and Parole, 491 Pa. 549, 421 A.2d 1021 (1980), certiorari denied, 450 U.S. 1050, 101 S.Ct. 1771, 68 L.Ed.2d 247 (1981). Kester's pleading, however, challenges a detainer order. Kester was detained pursuant to 37 Pa.Code § 71.3(1) because criminal charges were pending against him. The Board must conduct a parole revocation hearing once those pending charges are resolved. See 37 Pa.Code § 71.3(2). Parole revocation orders are final orders within our appellate jurisdiction. Bronson, 491 Pa. at 555-57, 421 A.2d at 1024-25. The detainer Kester challenges is an intermediary step in the parole revocation process. Under Bronson it is not a final order. Because the detainer is not a final order, Kester's direct challenge to that detainer is not appealable.[1]
The form by which a suit seeking review of an agency action is brought is not dispositive; actions should be *35 treated as if filed in proper form. Commonwealth, Auditor General v. Borough of East Washington, 474 Pa. 226, 378 A.2d 301 (1977). Thus, we will examine Kester's petition to determine whether it can be construed as challenging final agency action in any form. The prayer for relief in Kester's petition seeks a hearing. The Board is required to conduct a preliminary hearing within thirty days of Kester's detention under 37 Pa.Code § 71.3(9).[2] This portion of Kester's petition could be construed as a request for a remand for the Board to hold the required hearing. A petition seeking a remand for an administrative hearing properly lies within the appellate jurisdiction of this Court. O'Brien v. Commonwealth, State Employes' Retirement System, 503 Pa. 414, 469 A.2d 1008 (1983), certiorari denied, 469 U.S. 816, 105 S.Ct. 83, 83 L.Ed.2d 30 (1984). Assuming, arguendo, that a failure to comply with Section 71.3(9) constitutes final agency action, Kester's petition is still fatally flawed. Noticeably absent from Kester's petition is any allegation that there has been a violation of 37 Pa.Code § 71.3(9). Without an allegation of the Board's failure to comply with its own regulations, a petition seeking a remand for an administrative hearing cannot come within our appellate jurisdiction.
Alternatively, Kester's petition could invoke this Court's original jurisdiction. The relevant portions of the section delineating that jurisdiction provide as follows:
The Commonwealth Court shall have original jurisdiction of all civil actions or proceedings:
(1) Against the Commonwealth government, including any officer thereof, acting in his official capacity, except:

*36 (i) actions or proceedings in the nature of applications for a writ of habeas corpus or post-conviction relief not ancillary to proceedings within the appellate jurisdiction of the court;
42 Pa.C.S. § 761(a)(1)(i).
Read in its entirety, Kester's pleading seeks relief from an allegedly illegal detention resulting from the Board's detainer order. Habeas corpus is the recognized means for testing the legality of detention. Wilson v. Bureau of Corrections, 85 Pa.Commonwealth Ct. 32, 480 A.2d 392 (1984); Commonwealth v. Krall, 452 Pa. 215, 217 n. 1, 304 A.2d 488, 489 n. 1 (1973). Where the substance of a pleading is identical to a writ of habeas corpus, it should be treated as such. Commonwealth v. Orman, 268 Pa.Superior Ct. 383, 408 A.2d 518 (1979). Accord Commonwealth ex rel. Fink v. Rundle, 423 Pa. 133, 135 n. 1, 222 A.2d 717, 718 n. 1 (1966). Kester's petition seeks habeas relief and will be so treated.[3] To come within our original jurisdiction, Kester's petition must present a habeas corpus claim ancillary to a matter within our appellate jurisdiction.
As discussed above, there is no matter yet within our appellate jurisdiction. Thus, there can be no ancillary original jurisdiction. In a case analyzing the ancillary original jurisdiction of our sister Superior Court, our Supreme Court held that ancillary jurisdiction exists only where there is a matter already on appeal before the Superior Court. Municipal *37 Publications, Inc. v. Court of Common Pleas of Philadelphia County, 507 Pa. 194, 489 A.2d 1286 (1985). In so holding, our Supreme Court expressly rejected the argument that potential appellate jurisdiction of a case conferred ancillary original jurisdiction of a related claim; ancillary original jurisdiction is limited to "instances in which an appeal has been lodged in [the appellate] court and it becomes necessary to mandate or prohibit action by a lower court in aid of the [appellate] Court's effective exercise of its appellate jurisdiction." Id., 507 Pa. at 200, 489 A.2d at 1288.
Further support for this interpretation is found in the Statutory Construction Act of 1972. Ancillary jurisdiction is clearly a term of art. Such phrases are to be construed according to their peculiar meaning. 1 Pa.C.S. § 1903(a). Ancillary jurisdiction is defined as the "[p]ower of court to adjudicate and determine matters incidental to the exercise of its primary jurisdiction of an action." BLACK'S LAW DICTIONARY, 5th Ed., p. 79. Until a court is exercising its primary jurisdiction, no matter can be incidental to that exercise. Thus, no matter can be ancillary to potential appellate jurisdiction.[4]
The Judicial Code provides that this Court shall not dismiss an erroneously filed matter due to lack of jurisdiction; rather, the case is to be transferred to the proper court. 42 Pa.C.S. § 5103. See also Szymanski v. Allegheny County Court Criminal Division, 77 Pa.Commonwealth Ct. 316, 465 A.2d 1081 (1983). As we construe Kester's petition as seeking a writ of habeas corpus, jurisdiction would lie in the courts of common pleas.[5]
*38 The Judicial Code provides that venue for habeas corpus cases shall be prescribed by general rule. 42 Pa.C.S. § 6502(b). Pennsylvania Rule of Criminal Procedure 1701 governs venue when a petition seeking habeas corpus relief challenges the legality of the petitioner's detention or the conditions of confinement in a criminal matter. Because a detainer is part of the parole revocation process, the Rules of Criminal Procedure do not apply. See Rivenbark v. Pennsylvania Board of Probation and Parole, 509 Pa. 248, 501 A.2d 1110 (1985) (rescission of parole is purely administrative function); Chapman v. Pennsylvania Board of Probation and Parole, 86 Pa.Commonwealth Ct. 49, 484 A.2d 413 (1984) (parole revocation proceedings are civil administrative matters rather than criminal prosecutions); Hossback v. Pennsylvania Board of Probation and Parole, 80 Pa.Commonwealth Ct. 344, 471 A.2d 186 (1984) (parole revocation is not part of criminal prosecution).
The detention Kester challenges is civil in nature. The Pennsylvania Rules of Civil Procedure have no specific provision governing venue for civil habeas corpus cases. The general venue provisions of those rules do not apply because the Board, an agency of the Commonwealth, is not an "individual" as that term is used in Rule 1006. The Commonwealth is mentioned as a defendant in Rule 1503. That rule, however, governs equitable actions. Habeas corpus is an action at law, not an action in equity. See Commonwealth ex rel. Levine v. Fair, 394 Pa. 262, 146 A.2d 834 (1958) (habeas corpus is a common law writ). Rule 2103 governs venue when the Commonwealth is the plaintiff. This rule does not apply here because the Board is the defendant. Thus, no rule of civil procedure specifically applies to the petition presented here.
The general import of both Pa.R.Crim.P. 1701 and Pa.R.C.P. No. 1006 is that venue lies in the judicial district where the nexus of the underlying transaction took place. Kester is being detained in the Lackawanna County Jail. The criminal charges which gave rise to the detainer were brought *39 in Lackawanna County. Thus there is a substantial nexus between Lackawanna County and this petition. Accordingly, this petition is transferred to the Court of Common Pleas of Lackawanna County.[6]

ORDER
NOW, May 11, 1992, the petition of Francis Kester, seeking habeas corpus relief in this matter, is transferred to the Court of Common Pleas of Lackawanna County.
CRAIG, President Judge, dissenting.
As the majority opinion states, the board's preliminary objections contend that (1) this action is within this court's appellate jurisdiction, and that (2) the board properly detained petitioner pending the disposition of new criminal charges.

1. Jurisdiction
Judicial Code section 763(a), 42 Pa.C.S. § 763(a), provides in relevant part as follows:
Commonwealth Court shall have exclusive jurisdiction of appeals from final orders of government agencies in the following cases:
(1) All appeals from Commonwealth agencies under Sub-chapter A of Chapter 7 of Title 2...and including... any...Commonwealth agency having statewide jurisdiction. (Emphasis added.)
Section 761(a) of the Code, 42 Pa.C.S. § 761(a), which relates to this court's original jurisdiction, reads as follows:

*40 The Commonwealth Court shall have original jurisdiction of all civil actions or proceedings:
(1) Against the Commonwealth government, including any officer thereof, acting in his official capacity, except:
(i) actions or proceedings in the nature of applications for a writ of habeas corpus or post-conviction relief not ancillary to proceedings within the appellate jurisdiction of the court;
....
The board clearly is a "Commonwealth agency having statewide jurisdiction." Hence, this court does have appellate jurisdiction over detainer challenges under section 763 of the Code, 42 Pa.C.S. § 763, if the action taken by the board in detaining the petitioner constitutes a final order. However, the court is in agreement that we have original jurisdiction over detainer challenges because board detainer decisions do not constitute final orders.[1]
The board may detain a prisoner who is paroled and then later arrested on new criminal charges pursuant to 37 Pa.Code § 71.3(1), which provides:
A parolee may be detained on a Board warrant pending disposition of a criminal charge following the occurrence of one of the following:
(i) A district justice has conducted a criminal preliminary hearing and concluded that there is a prima facie case against the parolee.
(ii) The parolee waives a criminal preliminary hearing and is held for court.
(iii) The parolee is convicted of a crime before a judge of the Philadelphia Municipal Court or a district justice.
*41 When the board detains a parolee pursuant to 37 Pa.Code § 71.3(1), the board will not conduct a parole revocation hearing until after the resolution of the new criminal charges. See 37 Pa.Code § 71.3(2). If the parolee is convicted, the board has 120 days to hold a revocation hearing. 37 Pa.Code § 71.4(1). The Supreme Court of Pennsylvania has held that parole revocation orders are final orders within this court's appellate jurisdiction, Bronson v. Commonwealth Board of Probation and Parole, 491 Pa. 549, 421 A.2d 1021 (1980), cert. denied, 450 U.S. 1050, 101 S.Ct. 1771, 68 L.Ed.2d 247 (1981). Accordingly, detainers are properly characterized as preliminary steps taken by the board in the parole revocation process and do not constitute final orders.
Our decision in Ryles v. Pennsylvania Board of Probation and Parole, 41 Pa.Commonwealth Ct. 337, 399 A.2d 151 (1979), supports the view that detainer challenges are within this court's original jurisdiction. In Ryles, the board lodged a detainer against a prisoner who had been released on parole and was later arrested on new criminal charges. The court treated Ryles' "Motion to Have Parole Reinstated" as a petition for review addressed to this court's original jurisdiction. Although the court in that case referred to a detainer as a "final action", 41 Pa.Commonwealth Ct. at 338, 399 A.2d at 151, the phrase "final action", as used by the court in Ryles, is not synonymous with the phrase "final order" as used in § 763 of the Judicial Code.
Furthermore, in Bellochio v. Board of Probation and Parole, 126 Pa.Commonwealth Ct. 419, 559 A.2d 1024 (1989), this court, noting that there was no authority to assume appellate jurisdiction over a petition for review challenging a detainer, treated the petition as within this court's original jurisdiction pursuant to section 761 of the Judicial Code, 42 Pa.C.S. § 761.
In support of its contention that detainers fall within this court's appellate jurisdiction, the board cites Kline v. Pennsylvania Board of Probation and Parole, No. 1417 C.D.1991, an action pending before this court. Although this court initially addressed the detainer challenge in Kline as within the court's appellate jurisdiction, that treatment was because of a clerical *42 mistake. After the court corrected the mistake, the court addressed the detainer challenge as within this court's original jurisdiction.
The board argues that the petitioner's detainer challenge is an action in mandamus and that such an action is not the proper method for challenging a detainer. "[M]andamus is an extraordinary writ which will only lie to compel official performance of a ministerial act or mandatory duty where there is a clear legal right in the plaintiff, a corresponding duty in the defendant, and a want of any other appropriate remedy." Pennsylvania Dental Association v. Commonwealth Insurance Department, 512 Pa. 217, 227, 516 A.2d 647, 652, petition for allowance of appeal denied, 512 Pa. 234, 516 A.2d 656 (1986). However, the petitioner brought this action under this court's original jurisdiction pursuant to 42 Pa.C.S. § 761(a), without reference to mandamus, seeking a hearing before this court to determine the validity of the board's action.

2. Failure to State a Cause of Action
The board also contends that Kester's petition fails to state a cause of action for which relief may be granted.
Although Kester has framed his petition in very broad terms and included many irrelevant allegations, the averments do assert that he did not violate any of the conditions of his parole and that the board is illegally detaining him.
In this case, the petitioner has alleged that the board has lodged a detainer against him based upon new criminal charges, which he avers resulted in a mistrial. The board argues that they have properly detained the petitioner under 37 Pa.Code § 71.3.
As noted above, that regulation allows the board to detain parolees pending the disposition of new criminal charges only when one of the following has occurred: (1) a finding by a district justice after a preliminary hearing that there is a prima facie case against the parolee; (2) the parolee waived a preliminary hearing and is held for court; (3) conviction of a crime at trial by a judge of the Philadelphia Municipal Court *43 or a district justice; or (4) an examiner has conducted a detention hearing.
The board argues that we can infer from paragraphs III and XIV of the petition for review that either (1) a district justice has conducted a criminal preliminary hearing and concluded that there is a prima facie case against the parolee or (2) the parolee waived a criminal preliminary hearing and is being held for court, because the Pennsylvania Rules of Criminal Procedure require one of those two things to occur before a person is tried for a crime.
Those pleadings state:
III.
The District Attorney is a party, because of its involvement in not communicating the fact that this petitioner's trial ended in a mistrial and the mistrial was caused by the Commonwealth and is now being appealed to the Superior Court for dismissal on the grounds of Double Jeopardy and prosecutor misconduct intentionally resulting in the added confinement of the petitioner.
XIV.
The petitioner is not guilty of any wrong doing and has not been adjudicated guilty of any offense by the Court. Rather the trial ended in a mistrial at the cause to be made note, infected by an inexperienced District Attorney, and done so deliberately, when her case was in shambles. The record so reflects this. (Emphasis in original.)
Admittedly, the petitioner can succeed in challenging the detainer against him only if he is able to prove that the board has detained him without satisfying one of the above criteria. Although the petitioner's pleadings suggest that one of these criteria may have been satisfied, based on an inference from the petitioner's averments that he has proceeded to trial on the new charges, this court should not assume that the requirements of 37 Pa.Code § 71.3 have been met. The board's preliminary objections should be overruled.
NOTES
[1]  This Court has previously held that a detainer was final action within our appellate jurisdiction. Ryles v. Pennsylvania Board of Probation and Parole, 41 Pa.Commonwealth Ct. 337, 399 A.2d 151 (1979). Ryles was decided before our Supreme Court's decision in Bronson which indicates that the parole revocation order is the final agency act which is subject to appellate review. Thus, Bronson implicitly overruled Ryles to that extent.
[2]  The Board asks us to infer that Kester has either been accorded a criminal preliminary hearing or has waived that hearing. If that is true, Kester could be detained without a further hearing. 37 Pa.Code § 71.3(2); Jezick v. Pennsylvania Board of Probation and Parole, 109 Pa.Commonwealth Ct. 226, 530 A.2d 1031 (1987). The record in this case, however, is silent on those matters. Further, there is no allegation by either party that a detention hearing was conducted by an examiner as required by § 71.3(1)(iv). Thus, it is unclear whether 37 Pa.Code § 71.3(2), allowing a detention without further hearing, applies. Accordingly, we will view the record as requiring the Board to comply with the thirty day hearing requirement of § 71.3(9).
[3]  Kester could have sought to invoke this Court's original jurisdiction by a petition seeking mandamus relief. Mandamus is available to compel the Board to conduct a hearing or correct a legal mistake. Bronson, 491 Pa. at 554, 421 A.2d at 1023. Mandamus, however, lies "only to compel the performance of a ministerial act or mandatory duty...." St. Clair v. Pennsylvania Board of Probation and Parole, 89 Pa.Commonwealth Ct. 561, 566, 493 A.2d 146, 151 (1985). Moreover, a petition seeking mandamus must allege a legal right in the plaintiff, a corresponding duty in the defendant and want of any other adequate remedy at law. County of Allegheny v. Commonwealth, 507 Pa. 360, 490 A.2d 402 (1985). Kester's pleading does not allege any of these three necessary elements; thus, it cannot be construed as a petition seeking mandamus. Kester does not seek mandamus and this case is distinguishable from cases involving properly pled petitions seeking such relief.
[4]  This interpretation is also consistent with the use of the concept of ancillary jurisdiction in the Federal Court system. See Finkle v. Gulf & Western Mfg. Co., 744 F.2d 1015 (3d Cir. 1984) (ancillary jurisdiction is a tool by which a federal district court acquires jurisdiction of all facets of a case properly in a federal court because a portion of the issues presented confer federal jurisdiction).
[5]  Any judge of a court of record is empowered to issue the writ. 42 Pa.C.S. § 6502(a). All the courts of common pleas are courts of record. 42 Pa.C.S. § 321. The courts of common pleas also have unlimited original jurisdiction. 42 Pa.C.S. § 931(a). We read these three statutory sections to confer jurisdiction in this matter on the courts of common pleas.
[6]  We note that, because habeas corpus is an extraordinary writ, a petition seeking such relief will not be granted where an alternative remedy exists. Commonwealth ex rel. Paulinski v. Isaac, 483 Pa. 467, 397 A.2d 760, certiorari denied, 442 U.S. 918, 99 S.Ct. 2841, 61 L.Ed.2d 286 (1979). Mandamus is available to correct errors of law or compel performance of a duty by the Board under Bronson. Thus, we are hard pressed to conceive of any scenario where a petition such as the one Kester presents here would be successful. Nonetheless, Kester is entitled to seek habeas corpus relief if he so chooses. 42 Pa.C.S. § 6501. Any decision on the merits of his petition must be rendered by a court with competent jurisdiction to hear the case.
[1]  Although this application, to release the petitioner from a detainer, can be characterized as a proceeding in the nature of habeas corpus, neither the petitioner nor the board has questioned this court's jurisdiction on that ground, apparently because 42 Pa.C.S. § 761(a), as quoted above, expressly provides that our jurisdiction does extend to applications for a writ of habeas corpus where the matter is "ancillary to proceedings within the appellate jurisdiction" of the court, and this detainer under 37 Pa.Code § 71.3(1) is certainly ancillary to the board's parole revocation proceedings, which are exclusively subject to review in our appellate jurisdiction.
