
561 So.2d 1236 (1990)
STATE of Florida, DEPARTMENT OF HEALTH AND REHABILITATIVE SERVICES, Petitioner,
v.
Alan SCHREIBER, Broward County Public Defender, the Honorable Mel Grossman of the Circuit Court of the Seventeenth Judicial Circuit in and for Broward County, Florida, and Kathryn Twyman, Respondents.
Nos. 90-0067, 90-0113.
District Court of Appeal of Florida, Fourth District.
May 16, 1990.
*1237 Larry F. Kranert, Jr., Fort Lauderdale, and Howard M. Talenfeld of Colodny, Fass *1238 & Talenfeld, P.A., North Miami, for petitioner.
Steven Michaelson, Chief Asst. Public Defender and Fred Goldstein, Asst. Public Defender, Fort Lauderdale, for respondent, Alan Schreiber.
Steven L. Josias of Josias & Goren, P.A., Sp. Asst. Atty. Gen., and J. Philip Landsman of Platt, Haas & Landsman, Fort Lauderdale, for respondent, The Honorable Melvin Grossman.
GUNTHER, Judge.
Petitioner, the Department of Health and Rehabilitative Services (HRS), has filed a petition: (1) seeking certiorari review of two non-final orders entered by the Broward County Circuit Court on December 18, 1989, (2) seeking to prohibit the lower court from taking any further action in the case, and (3) seeking to prevent the Public Defender of Broward County from exceeding the scope of his office. HRS has also filed a non-final appeal of the two December 18, 1989, orders.
We agree with HRS's contention that the trial court, under the facts of this case, lacks subject matter jurisdiction to make inquiry into and issue orders with respect to the conditions, staffing patterns and treatment of patients confined at the South Florida State Hospital (SFSH), and we also agree that the public defender has no authority to request such a judicial inquiry.
Respondent Kathy Twyman (Twyman) was committed to HRS and placed in the Forensic Service Unit of South Florida State Hospital (SFSH). Thereafter, Twyman twice escaped from the unit, and on June 19, 1979, the trial court sua sponte issued an order to HRS executives to show cause why they should not be held in contempt of court for failure to perform their appointed duties, by permitting the defendant to escape.
At a hearing on the contempt matter on June 28, 1979, the Dade and Broward County Public Defenders made a joint ore tenus motion, asking that their offices be permitted to intervene on behalf of Kathy Twyman and "all other people similarly situated at the State Hospital," and requesting that the court make an inquiry into the conditions and quality of treatment at the Forensic Service Unit. Twyman was still at large after having escaped, and did not request or authorize the public defenders to make such a motion.
The court treated the ore tenus motion as a petition for writ of habeas corpus pursuant to section 394.459(10), Florida Statutes (1989), and granted the motion, and on July 2, 1979, rendered a written order stating that it would inquire into the conditions, staffing patterns, and treatment and care of patients confined in the Forensic Service Unit of SFSH.
On October 25, 1979, the Dade and Broward County Public Defenders filed a motion for an evidentiary hearing, contending that HRS, in operating and maintaining the Forensic Unit at SFSH, was in violation of numerous federal and state constitutional provisions by failing to provide an adequate program of care and treatment for patients. Also on October 25, 1979, the court enjoined HRS from placing any additional criminally charged persons in SFSH prior to November 9, 1979.
On November 5, 1979, representatives from the Dade and Broward County Public Defenders' offices met with representatives from HRS to attempt to resolve the issues raised in the court's July 2, 1979, order. They agreed to create a panel of experts to inspect the forensic facilities and report back to the court detailing their findings.
Thereafter, in March 1980, the Dade and Broward County Public Defenders and HRS entered into a lengthy Stipulation of Settlement, agreeing to numerous conditions and services for patients of the Forensic Service Unit of SFSH, and agreeing that an Internal Monitoring Review Group would be formulated to monitor the implementation of the standards set forth in the stipulation. It was also agreed that the Monitoring Review Group would submit *1239 monthly status reports to the court. Kathy Twyman, who was still at large, was not a party to the stipulation. On March 27, 1980, the court approved the stipulation. Thereafter, the Monitoring Review Group submitted its status reports as required. Only the forensic unit, not the main South Florida State Hospital, was monitored.
Three years later, in September 1982, each of the three separate buildings constituting the Forensic Service Unit of SFSH were closed, patients were either discharged or transferred to other facilities, and operation of the forensic unit was terminated. After the forensic unit closed, there was no further monitoring by the Review Group. The Review Group's final report, dated October 4, 1982, and entitled "Operational Plan for The Phase-Out Of SFSH's Forensic Facility," was submitted to the court without objection.
Four years later, on March 25, 1986, a new forensic unit, the South Florida Evaluation and Treatment Center, was opened. The purpose of this new unit was to provide similar services as those previously in effect at the forensic unit of South Florida State Hospital. The new unit serves as a hospital for patients with criminal court holds who require a secure unit and who do not qualify for placement in a less restrictive environment such as SFSH.
During the period between the closing of the Forensic Service Unit and the opening of the new unit, persons found incompetent to stand trial and not guilty by reason of insanity were placed in the general civil population at SFSH without monitoring, and without objection or intervention by the Dade or Broward County Public Defenders or the court.
On November 17, 1989, more than seven years after the closing of the Forensic Service Unit and more than three years after the new unit opened, the circuit court entered a sua sponte order in the Twyman case, enjoining HRS from placing any forensic patients at SFSH until further order of the court, and setting a hearing to ascertain HRS's compliance with the stipulation of settlement and prior orders of the court.
On November 27, 1989, the court ordered that the level of security personnel at SFSH ("institutional security specialists") would remain in full force and effect through December 18, 1989, at which time the matter would be considered at a hearing.
At a hearing on November 21, 1989, the court ordered a monitoring committee to inspect SFSH with respect to the standards and services set forth in the stipulation of settlement. Reports on the inspection were thereafter filed by the Dade and Broward County Public Defenders, stating that certain items (e.g., square footage of space allotted to each patient) were not in compliance with the stipulation, and recommending inter alia that the hospital be required to submit a proposal detailing how and when these items would be brought into compliance.
HRS filed motions to vacate the November 17 and November 27, 1989, orders and to dismiss the entire action for lack of subject matter jurisdiction, and contending inter alia that the order regarding restrictions on security personnel would force HRS to violate the Career Service Class Specifications promulgated by the Department of Administration.
After a hearing on December 18, 1989, the court denied HRS's motion to vacate and entered two orders, finding that HRS could place criminal court hold patients in SFSH only upon application and approval of the court on a case by case basis, and ordering that the present level of security staff was continued until further order of the court.
On January 4, 1990, the Broward County Public Defender filed a "Motion For Appointment of Experts; Motion To Expand Scope Of Judicial Inquiry To Include Discharge Planning, Policies And Procedures Together With Community Based Facilities," and the motion was set to be heard. HRS responded by filing before the court *1240 an emergency Petition for Writ of Prohibition, Quo Warranto and Common Law Certiorari, Emergency Motion For Immediate Stay Of Proceedings In Lower Tribunal, and Notice of Nonfinal Appeal.
Subject matter jurisdiction is a power that arises solely by virtue of law. Florida Export Tobacco Co., Inc. v. Dept. of Revenue, 510 So.2d 936 (Fla. 1st DCA), rev. denied, 519 So.2d 986, 987 (Fla. 1987). It is conferred upon a court by a constitution or a statute, State ex rel. Caraker v. Amidon, 68 So.2d 403 (Fla. 1953), and cannot be created by waiver, acquiescence or agreement of the parties. Amidon; Florida Export. The defense of lack of subject matter jurisdiction can be raised at any time. Marion Correctional Inst. v. Kriegel, 522 So.2d 45 (Fla. 5th DCA), rev. denied, 531 So.2d 1354 (Fla. 1988).
In State ex rel. HRS v. Nourse, 437 So.2d 221 (Fla. 4th DCA 1983), this Court granted a petition for writ of prohibition, holding that the circuit court had no jurisdiction to direct specific placement and treatment of a juvenile committed to HRS, since the court did not have jurisdiction to manage details of how HRS will attempt to rehabilitate juveniles. In State ex rel. HRS v. Sepe, 291 So.2d 108 (Fla. 3d DCA 1974), the Third District granted prohibition, holding that the circuit court was acting in excess of its jurisdiction in directing the method and duration of treatment to be provided to a criminal defendant committed to HRS. The Sepe court stated that the lower court's directions to HRS amounted to a usurpation of HRS's authority, as a division of the executive department, and was in derogation of the doctrine of separation of powers. In Depart. Of Health & Rehab. Serv. v. State, 338 So.2d 220 (Fla. 4th DCA 1976), this Court, in an appeal of a criminal contempt order, held that a circuit court is not empowered to direct a hospital to provide any certain method of medical treatment.
In our view, the above-cited cases are applicable here, and we conclude that the trial court exceeded and is continuing to exceed its jurisdiction by conducting a judicial inquiry into the conditions and quality of treatment at SFSH.
Respondents suggest that the trial court had subject matter jurisdiction pursuant to section 394.459(10), Florida Statutes (1989). We disagree. The record reflects that the public defender's ore tenus motion for a judicial inquiry was treated by the court as a petition for writ of habeas corpus pursuant to section 394.459(10). However, subsection (a) of section 394.459(10) clearly did not give the court subject matter jurisdiction, for that section concerns only the legality of a particular patient's detention; and Kathy Twyman, the defendant on whose behalf the public defender made the motion, had escaped and was at large, so there was no issue as to whether she was being improperly detained. The purpose of a writ of habeas corpus is to inquire into the legality of a prisoner's present detention. McCrae v. Wainwright, 439 So.2d 868 (Fla. 1983).
Subsection (b) of section 394.459(10) was also inadequate to give the court subject matter jurisdiction, for that section has been interpreted to require a petition filed by the patient himself, or a petition filed by the patient's guardian or representative, with the patient's authority and consent. See AMI Anclote Manor Hospital v. State ex rel. Weber, 553 So.2d 199 (Fla. 2d DCA 1989) (public defender and others lacked standing to bring petition for writ of habeas corpus on behalf of patients in asylum).
Respondents also contend that the trial court properly exercised jurisdiction pursuant to section 26.012(2)(d), Florida Statutes (1989), which gives the circuit courts jurisdiction over all felonies. They argue that since the court had jurisdiction over Kathy Twyman's robbery case, it therefore also had contempt power over the HRS executives who failed to prevent her escape. Accordingly, assert respondents, the court's inquiry into the staffing patterns, treatment modalities and general conditions at SFSH were merely a part of the lawful exercise of its contempt powers.
*1241 Section 38.22, Florida Statutes (1989) provides that every court may punish contempt committed against it, so the court in this case had the power to hold the HRS employees in contempt. See Rowe v. Wille, 415 So.2d 79 (Fla. 4th DCA 1982). However, the lower court's broad judicial inquiry into the general conditions at the forensic unit at SFSH far exceeded the narrow issues involved in the contempt proceeding. In the contempt proceeding, the question was whether the HRS employees were in contempt of court for failure to obey the court's order of commitment of Kathy Twyman; specifically, for permitting her to escape. Many issues that the court addressed, including square footage of floor space allotted to each patient, fire safety and food served to patients, were not relevant to the question of whether HRS employees improperly permitted Kathy Twyman to escape.
Based on the foregoing we conclude that the trial court did not gain subject matter jurisdiction to make its judicial inquiry pursuant to section 26.012 or section 38.22. Moreover, even if it is assumed that the lower court did have jurisdiction due to its contempt power, contempt cannot be used where its purpose and justification have expired. Price v. Price, 382 So.2d 433 (Fla. 1st DCA 1980). To monitor commitments of criminal mental patients to SFSH on a case by case basis, to require certain levels of security, and to make inquiry into general conditions at SFSH cannot, in our view, be justified by the escape of Kathy Twyman, which occurred over ten years ago.
Respondents further suggest that the trial court properly exercised jurisdiction because the court approved the stipulation of settlement, and therefore had authority to enforce the terms of the stipulation. It is true that courts have jurisdiction to enforce court-approved settlements of litigation. Buckley Towers Condominium, Inc. v. Buchwald, 321 So.2d 628 (Fla. 3d DCA 1975), dismissed, 327 So.2d 31 (Fla. 1976). However, since the court never had subject matter jurisdiction to conduct its inquiry in the first place, its subsequent approval of the stipulation was also without jurisdiction. It is true that HRS did not, until now, contend that the trial court lacked subject matter jurisdiction in this case. However, a court cannot exercise jurisdiction without proper authority simply because it was previously exercised without objection. See Florida Export Tobacco Co., Inc. v. Dept. of Revenue, 510 So.2d 936, 955 (Fla. 1st DCA 1987).
Also, as petitioner points out, a public defender's authority is narrowly limited to representing indigent criminal defendants. § 27.51, Fla. Stat. (1989). See also State ex rel. Smith v. Brummer, 426 So.2d 532 (Fla. 1982), cert. denied, 464 U.S. 823, 104 S.Ct. 90, 78 L.Ed.2d 97 (1983). The public defender is not authorized to act as a party in an action, or to undertake the representation of a class. Id. Accordingly, the public defender had no authority to "settle" the contempt action, no authority to enter into the stipulation with HRS, and no authority to enforce the stipulation.
In Brummer, a public defender appointed to represent a minor in an involuntary commitment proceeding also filed a lawsuit, on behalf of the minor and all others similarly situated, alleging violations of constitutional rights. The supreme court granted a petition for writ of quo warranto, holding, inter alia, that the public defender was not authorized to represent any persons other than those whom he was appointed to represent. Accordingly, the public defender in the instant case was not and is not authorized to represent any patients at SFSH in the present action.
We conclude that the trial court cannot properly exercise subject matter jurisdiction based on the stipulation of settlement. Moreover, even if the court could have so exercised jurisdiction, performance of the stipulation was completed when the forensic unit of SFSH closed in 1982, and the final report of the Review Group was *1242 submitted to the court without objection, so that exercise of jurisdiction was moot. Accordingly, there is no basis for concluding that the stipulation had retained or presently retains viability.
Respondents additionally argue that the trial court properly exercised jurisdiction under the "all writs" clause of the Florida Constitution. Art. V, § 5(b), Fla. Const. This clause gives the circuit courts power to issue those writs necessary or proper to the complete exercise of their jurisdiction. However, a petition filed under the "all writs" clause requires the court in which it is filed to initially determine if the petition, on its face, sets forth a claim within the jurisdiction and responsibility of the court. McCain v. Select Committee On Impeachment, 313 So.2d 722 (Fla. 1975). Here, the public defender's ore tenus motion, for a judicial inquiry into the conditions and quality of treatment at the forensic service unit at SFSH, did not, on its face, set forth a claim within the jurisdiction of the lower court.
Respondents further contend that the trial court had "inherent power" to conduct its judicial inquiry. However, courts only have inherent power "to do all things that are reasonably necessary for the administration of justice within the scope of [their] jurisdiction, subject to valid existing laws and constitutional provisions." Rose v. Palm Beach County, 361 So.2d 135, 137 (Fla. 1978) (emphasis added). Since the lower court lacked subject matter jurisdiction to conduct the judicial inquiry, it had no "inherent power" to proceed.
Respondents also assert that the question of whether the lower court has subject matter jurisdiction is not "ripe" for review. We disagree. At the December 18, 1989, hearing, the trial court, when its jurisdiction was challenged, reserved ruling on the question, stating that it wanted to visit SFSH with all counsel. The court then went on to enter the two orders that prevented placement of forensic patients at SFSH unless approved by the court on a case by case basis, and which required "institutional security specialists" to remain at SFSH until further order of the court. Also, the court evidently intended to entertain the Broward Public Defender's January 4, 1990, motion for appointment of experts and to expand judicial inquiry. Accordingly, we conclude that the trial court has impliedly denied petitioner's motion to dismiss for lack of subject matter jurisdiction, thereby making the question ripe for review.
Based on the foregoing we conclude that HRS is entitled to relief. With respect to preventing the trial court from exercising jurisdiction in the future to conduct a judicial inquiry into the treatment and care of patients at SFSH, prohibition is appropriate. See Nourse, 437 So.2d at 221; Sepe, 291 So.2d at 108. See also Florida Power & Light Co. v. Stewart, 468 So.2d 233 (Fla. 4th DCA 1984). With respect to preventing the Broward County Public Defender from exceeding the scope of his authority by making motions on behalf of SFSH patients whom he has not been appointed to represent, quo warranto is appropriate. See Brummer, 426 So.2d at 532.
The trial court, on November 17, 1989, entered a sua sponte order enjoining HRS from placing any forensic patients at SFSH until further order of the court, and on November 27, 1989, ordered HRS to maintain the current level of security personnel at SFSH through December 18, 1989. HRS moved to vacate these two injunctions, but on December 18, 1989, in two separate orders, the trial court denied the motion. The court refused to dissolve the injunctions, ruled that the forensic patients could be placed in SFSH only upon application to the court on a case by case basis, and stated that the November 27, 1989, order would be continued until further order of the court. Since Rule 9.130(a)(3)(B), Florida Rules of Appellate Procedure, permits appellate review of non-final orders which refuse to dissolve injunctions, the two December 18, 1989, orders are reviewable under *1243 this section. Review by certiorari, therefore, is not appropriate with respect to these two orders. As discussed earlier, we conclude that the trial court lacked jurisdiction to enter these two orders. Accordingly, we reverse these two orders.
In conclusion, we grant the petition for writ of prohibition and quo warranto deny the petition for writ of certiorari, and reverse the two non-final orders dated December 18, 1989.
DELL, J., concurs.
LETTS, J., concurs in conclusion only.
