Opinion by
Judge MacPhail,Allegheny County (County), along with many other counties in the Commonwealth, is confronted with a prison crisis caused by over-crowding. In response to *75a suit by inmates, the United States District- Court for the Western District of Pennsylvania, after finding that the Allegheny County Jail (County Jail) was unconstitutionally overcrowded entered an order directing, inter alia, that by January 1,1984 the County Jail should house no more than 500 male and 30 female prisoners.1 That order was subsequently amended to provide that the County would be required to pay a fine of $5,000 for each inmate released on and after February 15, 1984 to comply with the District Court’s order.
The County thereafter petitioned the Deputy Commissioner for the Bureau of Correction to authorize the release of some of its inmates to state correctional facilities. The Deputy Commissioner denied the request, pointing out that its own facilities were being over-burdened by commitments throughout the Commonwealth. The County then instituted the instant action in our original jurisdiction in the nature of a complaint in mandamus and in equity requesting that we direct the appropriate Commonwealth officers and agencies (Respondents)2 to receive County inmates. The Respondents have filed preliminary objections in the nature of a demurrer averring that the County’s amended complaint fails to state a claim in either mandamus or equity.
Certain elementary principles of lav/ must guide us. For the purpose of ruling upon the demurrer, the factual allegations in the County’s complaint, but not the legal conclusions set forth therein, must be as*76sumed to be true. Zurenda v. Commonwealth, 46 Pa. Commonwealth Ct. 67, 405 A.2d 1124 (1979). Before the extraordinary writ of mandamus will be issued which compels the performance of a ministerial act or mandatory duty, the person seeking the writ must demonstrate a clear legal right to it, a corresponding duty to be performed by the defendant-respondent and the absence of an adequate remedy at law. Valley Forge Racing Association, Inc. v. State Horse Racing Commission, 449 Pa. 292, 297 A.2d 823 (1972). Where the action sought to be compelled is discretionary, mandamus will not lie to control that discretionary act, but the Courts will review the exercise of the actor’s discretion where it is arbitrarily or fraudulently exercised or is based upon a mistaken view of the law. Garratt v. Philadelphia, 387 Pa. 442, 127 A.2d 738 (1956).
In the case sub judice, the County complains that the Deputy Commissioner refused its request to transfer 76 inmates from the County Jail to state correctional facilities. The County alleges that the Deputy Commissioner has the authority to make such transfers by virtue of the provisions of Section 1 of the Act of June 11, 1923, P.L. 1044, as amended, 61 P.S. §72. A copy of the response of the Deputy Commissioner to that request is attached to the petition for review now before us. The pertinent part of that response is as follows:
Please be advised that after careful review of your petitions and consideration of the impact these transfers would have upon our facilities, it is my decision to disapprove your request. . . .
It is my hope that you can in turn grasp the reality of the burden placed on our limited resources as we attempt to accommodate the ever-increasing number of inmates committed to our *77custody from across the Commonwealth. This office has been disapproving similar requests albeit involving smaller numbers of prisoners which are being received from other counties who are also attempting to cope with an increased inmate census.
Nowhere in the complaint is it alleged that the Deputy Commissioner’s action was arbitrary, fraudulent or based on a mistaken view of the law. Indeed, from all that appears in the complaint before us, including the response of the Deputy Commissioner, the discretion vested in the Deputy Commissioner by law has been prudently exercised.
The County next complains that the Bureau of Correction, although authorized by the provisions of Section 4 of the Act of October 16, 1972, P.L. 913, 61 P.S. §460.14, to do so, has failed or refused to authorize the transfer of female inmates from the County Jail to state regional community treatment centers. There is no allegation of a specific request to the Bureau for the transfer of female inmates but the letter from the Deputy Commissioner to which previous reference has been made herein appears to be a blanket denial of requests for transfer regardless of gender. Again, in the absence of at least an allegation of arbitrariness, fraud or mistake of law, there is no basis upon which this Court could uphold an action in mandamus, and again from our examination of the allegations of the complaint and the exhibit attached thereto it appears that the Deputy Commissioner had valid reasons for exercising the discretion vested in him by law.
The County finally complains that the Pennsylvania Board of Probation and Parole (Board) has failed or refused to accept custody of inmates housed at the County Jail who have been placed there by the Board because they have allegedly violated the terms *78of their parole. The petition avers that there is some duty imposed upon the Board by Sections 17 and 17.1 of the Act of August 6,1941, P.L. 861, as amended, 61 P.S. §§331.17 and 331.17a to accept the custody of such inmates. The Board contends that there is nothing in the law cited by the County which authorizes or directs it to accept the custody of such inmates and that such inmates were placed in the County Jail pursuant to the exercise of the Board’s discretion which again has not been challenged as being arbitrary, fraudulent or based upon a mistake of law.
In sum, we must agree with the Respondents that the amended petition for review fails to set forth a cause of action in mandamus upon which relief can be granted.
We now turn to the second cause of action wherein the County seeks equitable relief based upon the same factual allegations as were set forth to support the mandamus action. The County argues that it is between a rock and a hard place. On the one hand it is under a Federal Court order to reduce its prison population and on the other, it has a legal duty to confine persons committed to jail by the courts or placed there by other authorities for future proceedings. It sets forth the various actions it has taken in good faith to alleviate the situation including seeking relief from the Bureau of Correction. All such efforts have been without success. It now complains that it has no adequate remedy at law and that the circumstances in which it finds itself virtually cry out for equitable relief.
While equity springs from and is administered through the conscience, the exercise of discretion by a court of equity is not an arbitrary or capricious function, but is one directed within the channels of precedent. Peoples-Pittsburgh Trust Company v. Blickle, *79330 Pa. 398, 199 A. 213 (1938). Before a mandatory injunction will issue, it is essential that a clear right to relief must he established and it must appear that irreparable harm will occur to the petitioner if the injunction is not granted. Moyer v. Davis, 67 Pa. Commonwealth Ct. 251, 446 A.2d 1355 (1982), aff’d, 501 Pa. 192, 460 A.2d 754 (1983). Here again the County is confronted with the general principle that equity will not interfere with the exercise of discretionary powers of public officials unless it appears that their action is based upon a misconception of the law or is the result of arbitrary will or caprice. Downing v. Erie City School District, 360 Pa. 29, 61 A.2d 133 (1948). In Crawford v. Department of Health, 19 Pa. Commonwealth Ct. 10, 338 A.2d 727 (1975), our Court was confronted with a claim for mandamus and equitable relief where petitioners therein sought to have us direct the respondents to alter existing regulations to require the fluoridation of water. The respondents there, as here, raised preliminary objections in the nature of a demurrer to the petition for review contending that the petitioners had failed to state a cause of action in either mandamus or equity because the respondents were under no statutory duty to so alter the regulations. Our Court sustained the demurrer holding that because the duty of the public officials involved was discretionary, there could be no enforceable right to compel those officials to perform that duty or to prevent them from performing that duty. We believe the two cases to be analogous.
Although we appreciate the County’s plight, we cannot fashion a remedy to relieve the situation where it is clear that equity has no authority to intervene.
Since the petition for review has been previously amended and still does not state a cause of action, we will sustain the demurrer without leave to amend.
*80Order
The preliminary objections of the respondents in the nature of a demurrer are sustained and the Petition for Review is dismissed.
Inmates of the Allegheny County Jail v. Wecht, 573 F. Supp. 454 (W.D. Pa. 1983).
The Commonwealth of Pennsylvania, Bureau of Correction; Cien R. Joffes, Commissioner, Bureau of Correction; Erskind DeRamus, Deputy Commissioner, Bureau of Correction; and the Pennsylvania Board of Probation and Parole, Fred W. Jacobs, Chairman.