
506 Pa. 410 (1984)
485 A.2d 755
COMMONWEALTH of Pennsylvania, DEPARTMENT OF PUBLIC WELFARE, Petitioner,
v.
COURT OF COMMON PLEAS OF PHILADELPHIA COUNTY, Respondent.
Supreme Court of Pennsylvania.
Argued September 10, 1984.
Decided December 18, 1984.
*411 *412 Howard Ulan, Asst. Counsel, Dept. of Public Welfare, John O.J. Shellenberger, III, Allen C. Warshaw, Deputy Attys. Gen., Harrisburg, for petitioner.
Alfred J. DiBona, Jr., Rita S. Levine, Defender's Ass'n of Philadelphia County, Ilene W. Shane, Developmental Disabilities Law Project, Howland W. Abramson, Charles W. Johns, Paul J. Gelman, Philadelphia, for respondent.
Before NIX, C.J., and LARSEN, FLAHERTY, McDERMOTT, HUTCHINSON, ZAPPALA and PAPADAKOS, JJ.

OPINION
McDERMOTT, Justice.
The Commonwealth, Department of Public Welfare (Department) has petitioned this Court for a writ of prohibition in order to preclude the Court of Common Pleas of Philadelphia from ruling on the propriety of the transfer of mentally *413 retarded patients from one facility to another. The Commonwealth has further requested that this Court assume plenary jurisdiction of the underlying controversy, and that we review the decision of the Commonwealth Court denying the application for a stay.
The proposed transfer involves 86 patients who were involuntarily committed by the Philadelphia court pursuant to Section 406 of Mental Health/Mental Retardation Act,[1] 50 P.S. § 4406. Each of these patients was committed specifically to a residential program known as the Woodhaven Extension Program, located on grounds adjacent to, and/or part of, the Philadelphia State Hospital in Northeast Philadelphia.
In approximately April, 1984, the Department decided it would be more efficient, both economically and administratively, to close the Woodhaven facility. This decision was precipitated by the expiration of the service contract between the Department and Temple University, whereby Temple had operated the Woodhaven facility.
In conjunction with the decision to close the Woodhaven facility the Department decided to transfer all of the patients currently in the program to the Embreeville Center, located in Chester County. Embreeville is a state operated facility dedicated exclusively to the care of mentally retarded patients. It is located approximately 35 miles from center city Philadelphia, and approximately 50 miles from Woodhaven.
Upon hearing of the proposed transfers the Defenders' Association of Philadelphia, which was the attorney of record for most of the patients involved, filed a petition to amend the orders of commitment to provide that any transfer would require an individual hearing prior to its effectuation.[2] The petition to amend was considered by the Honorable Alfred J. DiBona, Jr., of the Court of Common Pleas of Philadelphia. However, prior to a decision on said petition, *414 the Department entered a special appearance and filed preliminary objections contesting, among other things, the jurisdiction of the common pleas court to hear this matter, as well as the authority of that court to order relief. On April 27, 1984, Judge DiBona signed a rule to show cause why an order should not be entered prohibiting the transfers. The rule provided that "all proceedings to stay meanwhile." This rule was appealed to the Commonwealth Court which denied relief, per Crumlish, P.J., on May 4, 1984.
On the return date for the rule, May 9, 1984, Judge DiBona heard oral argument on the Department's preliminary objections. On June 1, 1984, Judge DiBona overruled the Department's preliminary objections. The Department appealed this decision to the Commonwealth Court. Thereafter, on June 11, 1984, Judge DiBona entered an order, vacating the automatic supersedeas triggered by the appeal,[3] continuing the effect of his prior orders, and mandating that "no movement of individuals, or discharge shall be permitted without further order of this Court."
On June 19, 21 and 22, 1984, hearings were held before Judge DiBona at the Department's request. At these hearings, testimony was presented relating to the decisions to close the Woodhaven program and transfer the patients to Embreeville. On June 22, 1984, Judge DiBona entered an order continuing the effect of his prior orders, mandating that the patients currently at Woodhaven remain there, and that until further order of the court, the Department's only available option, other than maintaining the Woodhaven program, was to discharge the patients into the community. On June 27, 1984, the judge entered another order authorizing the sheriff to enforce his prior orders.
The judge's order was again appealed to the Commonwealth Court, and again Judge DiBona vacated the automatic supersedeas. Thereafter, the Department filed its third application for relief and second application for stay pending appeal in Commonwealth Court. This application *415 was denied, per Crumlish, P.J., on June 29, 1984. Later that same day, an application for writ of prohibition was filed in this Court. Thereafter, the Department filed an "Amended Application for Writ of Prohibition and Mandamus, Application to Assume Extraordinary Jurisdiction and Application to Review Denial of Stay."[4]
The respondent in this application is the Court of Common Pleas of Philadelphia. Under the current posture of the case, i.e. writ of prohibition, the persons most directly affected by this litigation are technically not parties thereto. Consequently, the Defender's Association, on behalf of the 86 mentally retarded patients, has filed for leave to intervene, which we hereby grant, in accordance with Pa.R. Civ.P. 2327.
Turning to the merits of the Department's petition for writ of prohibition, we must begin with the well recognized rules governing the issuance of such a writ. "Prohibition is a common law writ of extremely ancient origin . . . Its principal purpose is to . . . prevent an inferior judicial tribunal from assuming a jurisdiction with which it is not legally vested." Carpentertown Coal and Coke Company v. Laird, 360 Pa. 94, 97-98, 61 A.2d 426, 428 (1948). "The rationale for granting the writ `is to shut off the necessity of going through a hearing, trial, before a tribunal that has no power to deal with the subject at all.' (Citations omitted.)" Spykermen v. Levy, 491 Pa. 470, 480, 421 A.2d 641, 646 (1980). The decision to issue the writ rests within the sound discretion of the court, discretion which should be exercised only in cases of extreme necessity, i.e., where none of the ordinary remedies provided by law are applicable or adequate to afford relief. Carpentertown Coal, supra, 360 Pa. at 102, 61 A.2d at 430.
The writ may not be used to usurp or perform the functions of an appeal, writ of error or certiorari, or to correct any mistakes, errors or irregularities in deciding any question of law or fact within a court's jurisdiction. *416 The office of the writ, as at common law, is to prevent an unlawful assumption of jurisdiction, not to correct mere errors and irregularities in matters over which the court has cognizance. Where the general scope and purpose of the action is within the jurisdiction of the court, any error or overstepping of its authority in a portion of its judgment, or any other error in its proceedings, is only ground for a review or appeal, and not prohibition. Commonwealth v. Mellon National Bank and Trust Co., 360 Pa. 103, 107, 61 A.2d 430, 433 (1948) quoting Ferris, Extraordinary Legal Remedies. See generally, Spykermen v. Levy, supra 491 Pa. at 480, 481, 421 A.2d at 646-647.
The Department, contends that the Court of Common Pleas of Philadelphia was without jurisdiction to enter upon the present controversy, based upon the Commonwealth Court's exclusive jurisdiction under the Judicial Code. See 42 Pa.C.S. § 761. In the alternative they argue that they had the absolute right to make decisions concerning the closing of facilities, and that the common pleas court was without authority to order them to continue operating the Woodhaven facility.
These arguments rest upon the Department's characterization of the underlying proceedings as "injunctive." If this characterization were accurate we would be inclined to agree with petitioners, i.e. that the lower court exceeded its jurisdiction. See e.g. Bell v. Thornburgh, 491 Pa. 263, 420 A.2d 443 (1980); Hoolick v. Retreat State Hospital, 24 Pa.Cmwlth. 218, 354 A.2d 609 (1976) aff'd 476 Pa. 317, 382 A.2d 739 (1978). See also O'Bannon v. Town Court Nursing Center, 447 U.S. 773, 100 S.Ct. 2467, 65 L.Ed.2d 506 (1980). However at no time have the intervenors attempted to enjoin the Department from closing the Woodhaven facility; and the hearing judge specifically stated that he did "not intend to require the Commonwealth to continue to operate a facility which it determined should be closed." Slip Opinion, No. 4630 November Term 1982, p. 3 (June 1, 1984). In addition, the Department's "injunction" argument is undercut by the fact that the order in question does not *417 preclude them from closing the facility if they would release the patients in question. Although the court's order put the Department in a difficult position, it is clear that the intent and focus of that order was the welfare of the patients who had previously been committed by the court. Thus the question of the lower court's jurisdiction must be evaluated within that context.
The test of whether a court has jurisdiction over a particular controversy depends upon "the competency of the court to determine controversies of the general class to which the case presented for its consideration belonged,  whether the court had power to enter upon the inquiry, not whether it might ultimately decide that it was unable to grant the relief sought in the particular case." (emphasis in original) Studio Theaters, Inc. v. Washington, 418 Pa. 73, 77, 209 A.2d 802, 804-805 (1965). See Yezerski v. Fong, 58 Pa.Cmwlth. 566, 569, 428 A.2d 736, 737 (1981).
Subsection (b) of Section 406 of the Act provides in relevant part:
In its order of commitment, said court may permit partial hospitalization or outpatient care, or if at any time thereafter the director shall determine such partial hospitalization or outpatient care to be beneficial to the person so committed, the same may be permitted by said court upon application by the director.
Although this section does not deal specifically with the present factual situation, it implicitly requires some court involvement when changes in that court's commitment order are sought. Compare Mental Health Procedure Act[5] §§ 115, 303-306; 50 P.S. §§ 7115, 7303-7306. In addition, we have previously stated that courts have inherent power to supervise the enforcement of their orders. See Brocker v. Brocker, 429 Pa. 513, 241 A.2d 336 (1968) cert. denied, 393 U.S. 1081, 89 S.Ct. 857, 21 L.Ed.2d 773 (1968).
The commitment orders in question specifically committed the various individuals to the Woodhaven facility. *418 In addition, each order provided for continued involvement by the lower court, providing for annual review by that court. It is unquestioned that the proposed transfer of these patients would change both the facility and the geographic location from that which was ordered by the committing judge. These changes would obviously alter the express terms of the original commitments. Given this fact it is ludicrous to argue that the Department may unilaterally effect these changes without the committing court having the opportunity to reconsider its order. Therefore, we hold that the Department's objection to the jurisdiction of the Court of Common Pleas of Philadelphia is without merit.
There exists at least one additional reason why prohibition is inappropriate in the present case. A writ of prohibition should never be employed prematurely, especially where there exists factual questions as to whether jurisdiction is appropriate. Troiani Bros., Inc. v. Commonwealth, P.U.C., 488 Pa. 386, 412 A.2d 562 (1980). We note that Section 416(d) of the Mental Health/Mental Retardation Act, 50 P.S. § 4416(d) provides the court of common pleas with jurisdiction over transfers from local to state facilities, and vice versa. See Commonwealth, ex rel. DiEmilio v. Shovlin, 449 Pa. 177, 181 fn. 7, 295 A.2d 320, 323 fn. 7 (1972). Intervenors have challenged the Department's characterization of Woodhaven as a "state" facility; and have also argued that Embreeville is a more restrictive placement.[6] It is clear that these challenges presented a factual question for the lower court, in the first instance, to resolve.
This Court has previously held that a court or tribunal is competent to decide the factual questions which will trigger *419 its jurisdiction, and the mere possibility of an erroneous ruling is not a basis for prohibition. Troiani Bros., supra; Carpentertown Coal Co., supra.
The Commonwealth has also contested the propriety of interim relief ordered by the common pleas court, i.e. "that the patients shall remain at the facility until further ordered," arguing that this effectively enjoins the Commonwealth from closing the facility. It is clear that the common pleas order is not in the nature of an injunction, but rather in the nature of a stay, the propriety of which may be challenged by appeal to higher courts. See Pa.R.A.P. 3315. In this regard, the record reflects that the Department appealed Judge DiBona's order to the Commonwealth Court, which per Crumlish, P.J., refused to alter the orders. Included within the current application is a request that we review this determination.
The propriety of a grant or denial of a stay is governed by the guidelines enunciated in Commonwealth, P.U.C. v. Process Gas Co., 502 Pa. 545, 467 A.2d 805 (1983). Thus a stay is warranted if:
1. The petitioner makes a strong showing that he is likely to prevail on the merits.
2. The petitioner has shown that without the requested relief, he will suffer irreparable injury.
3. The issuance of a stay will not substantially harm other interested parties in the proceedings.
4. The issuance of a stay will not adversely affect the public interest.
Id., 502 Pa. at 552, 553, 467 A.2d at 808, 809.
Under the facts of this case the Commonwealth's request for a "stay" would have actually changed the status quo, in that they would have proceeded with the proposed transfers. It was for that reason, obviously, that the lower court originally vacated the automatic supersedeas, and it was intervenors (petitioners below) who were effectively granted a stay. Therefore, we evaluate the lower courts' decisions from the perspective of the intervenors, *420 and for the following reasons, we find no error in their decision. First, intervenors have made the requisite showing that they are entitled to a pre-transfer hearing. Secondly, if the Department is permitted to proceed with their proposed transfers, the patients will suffer the irreparable injury of having been permanently uprooted from their current placement without having the opportunity to challenge the appropriateness of their new placement. Thirdly, although there may be some added financial burden placed on the Department in continuing to maintain the Woodhaven facility, that burden, when weighed against the potential damage to the individuals, is not substantial.[7] Finally, we see no adverse effect on the interests of the public at large, especially when weighed against the potential for harm to these patients.[8]
For the foregoing reasons we deny the Department's petition for a writ of prohibition.[9] Concurrently, we decline *421 to accept plenary jurisdiction of the underlying controversy, or alter the decision of the Commonwealth Court regarding petitioner's application for a stay.
HUTCHINSON, J., files a Dissenting Opinion in which FLAHERTY, J., joins.
HUTCHINSON, Justice, dissenting.
I dissent. I believe Commonwealth Court has exclusive original jurisdiction over this controversy. It involves the Department's discretion in closing a facility, see Hoolick v. Retreat State Hospital, 24 Commonwealth Ct. 218, 354 A.2d 609 (1976), affirmed, 476 Pa. 317, 382 A.2d 739 (1978), not a modification of a commitment order under the Mental Health Procedures Act, see 50 P.S. § 7115. Of course, the effect of any such order on individuals who have been individually committed may be subject to review on due process grounds. Such individual, particularized review may be alternately available in the forum which entered the commitment order, here Philadelphia Common Pleas. The type of review required in Common Pleas would, however, be totally inappropriate for a class action because the needs of each individual patient are discrete and particular. In the old style chancellors would have said the equitable remedy of class action is unavailable because the issues are multifarious. The Defender's Association of Philadelphia's attempt to bring a class action on behalf of all the patients at Woodhaven should be dismissed or transferred because judicial review of the Department of Public Welfare's decision to close the facility will focus on the impact of the closing on the patients as a group, and not as individuals. Consequently, this case belongs in Commonwealth Court.
FLAHERTY, J., joins in this Dissenting Opinion.
NOTES
[1]  Act of October 20, 1966, P.L. 96, art. IV § 406.
[2]  This petition was filed under the caption In re Mario Reyes, et al., No. 4630, November Term, 1982, in the interest of all 86 patients.
[3]  Pa.R.A.P. 1736(b).
[4]  It is this amended application with which we are concerned.
[5]  Act of July 9, P.L. 817, No. 143 § 101 et seq.
[6]  This latter challenge is a predicate for intervenor's argument that due process requires a hearing before a patient may be transferred from a less restrictive placement to a more restrictive placement. See Eubanks v. Clarke, 434 F.Supp. 1022 (E.D.Pa.1977). In light of our decision that a committing judge retains supervisory jurisdiction over the patient committed, we see no need to address this constitutional question at this time.
[7]  There are two additional reasons which militate against finding that the Department will suffer substantial harm. The first is simply that any harm which accrues to the Department is largely self created, in that better planning could have prevented many of the present problems. Secondly, the Department admitted that the money originally budgeted for Woodhaven was not reallocated to other mental health uses but, somewhat surprisingly, was returned to the Commonwealth general fund. Thus, at the time Judge DiBona vacated the supersedeas, continuing to operate Woodhaven until hearings were held would not have strained the Department's budget in a greater manner than was originally provided for.
[8]  The above analysis can be applied from the alternative perspective, i.e. the Department's request for a stay, and the result would be the same in that the Department has failed to make a "strong showing that they can prevail on the merits of their argument," or that they will suffer "irreparable injury."
[9]  At oral argument we permitted the respondent to submit a supplemental reply brief. Therein respondent argued that intervenor's petition to amend the commitment orders was in the nature of a writ of habeas corpus, and therefore the court had jurisdiction under Section 426 of the Mental Health/Mental Retardation Act, 50 P.S. Section 4426. It is clear that the intervenors, petitioners below, did not consider their petition as a petition for habeas corpus, nor was it considered by the hearing judge as such. In light of our decision above we see no need to answer the theoretical question as to whether a petition to amend commitment orders is tantamount to a petition for habeas corpus, especially on the record that was developed below.
