
192 A.2d 267 (1963)
Lee Thompson KIMBALL
v.
John J. PELOSI, M.D., Acting Superintendent, State Hospital for Mental Diseases.
M. P. No. 1542.
Supreme Court of Rhode Island.
June 28, 1963.
Moore, Virgadamo, Boyle & Lynch, Joseph R. Fogarty, for petitioner.
J. Joseph Nugent, Attorney General, Corinne P. Grande, Special Counsel, for respondent.
JOSLIN, Justice.
This is a petition for a writ of habeas corpus directed to the acting superintendent of the state hospital for mental diseases. *268 The petitioner, a person awaiting trial on six criminal indictments, was confined in the criminal insane ward of said hospital at the time of the filing of his petition pursuant to an order of the presiding justice of the superior court entered under G.L. 1956, §§ 26-4-3 and 26-4-4. Said sections provide for detention in such ward of any person awaiting trial or imprisoned who after examination is found by such justice to be insane or idiotic.
The petitioner alleges that he is unable to stand trial under the six indictments by reason of such detention, which he contends is in violation of the fourteenth amendment to the constitution of the United States and art. I of the constitution of this state.
It appears from the instant petition for habeas corpus and the records of this court that pursuant to G.L. 1956, § 26-3-5, petitioner filed a statutory petition alleging that he was unjustly deprived of his liberty and praying that a commission be appointed to inquire into his condition. Such petition was referred by the chief justice to an associate justice of this court who, in accordance with the provisions of § 26-3-5, issued a commission to three psychiatrists, each of whom, as directed therein, conducted an independent examination of petitioner and thereafter filed a joint report with the said associate justice. After consideration thereof the associate justice dismissed the petition and ordered that petitioner remain under detention at the hospital until discharged therefrom according to law.
Thereupon petitioner filed the instant petition for a writ of habeas corpus and we ordered the writ to issue. Prior to the return day the parties stipulated that depositions be taken of the three psychiatrists previously appointed by the associate justice to examine petitioner. In each deposition the respective doctor stated in substance that in his opinion petitioner was not insane and that his going at large would not be dangerous to public safety.
The petition for habeas corpus came on for hearing on May 3, 1963, at which time respondent moved for a continuance on the ground that steps had been initiated which would render the matter moot and upon such representations the case was continued to May 15, 1963. At the hearing on that date respondent agreed as to the correctness of the facts stated in the petition and in addition brought to the attention of the court both orally and in a written memorandum that petitioner had on May 9, 1963 been released from the hospital and returned to the adult correctional institutions to await trial on the pending indictments. Based on the foregoing, respondent contended that the petition be dismissed because the matter had become moot. The petitioner, however, while agreeing that he is no longer being illegally detained, contended in oral argument that he is entitled to have this court pass on the issue of his sanity.
Orderly procedure on habeas corpus proceedings requires a return by the person having custody of the petitioner, such return being a response to the writ itself and not an answer to the petition. The necessity therefor is prescribed by statute. G.L. 1956, § 10-9-7. After the filing of the return the petitioner has the opportunity to raise issues of fact or law thereon by appropriate pleadings. G.L. 1956, § 10-9-17; 25 Am. Jur., Habeas Corpus, §§ 142 and 143, p. 243.
While here deprived of the required pleadings which would focus the scope of our inquiry to the issues of law or fact raised thereby, we shall, in the interests of a final disposition of this matter, treat respondent's memorandum and oral statement as though together they constituted a return and petitioner's oral argument before us as an appropriate pleading in response thereto.
We shall first consider whether the transfer of petitioner from the custody of respondent prior to the hearing before *269 us renders the matter moot. The function of habeas corpus is to provide a means for the discharge of persons who are unlawfully restrained, Petition of Doyle, 16 R.I. 537, 540, 18 A. 159, 5 L.R.A 359, and a method whereby the legality of the detention of one detained by another can be judicially determined. McNally v. Hill, 293 U.S. 131, 55 S.Ct. 24, 79 L.Ed. 238. It is admitted that in the instant case petitioner, while he was in the custody of respondent at the time application for the writ was made, was not detained by him at the time the case was heard by us and therefore there is now no question of the legality of any restraint or detention to which we can address our attention. This court will not proceed to adjudicate where there is no subject matter on which its judgment can operate nor will it spend its time in deciding a moot case. In Re Lincoln, Petitioner, 202 U.S. 178, 26 S.Ct. 602, 50 L.Ed. 984; Ex Parte Baez, 177 U.S. 378, 20 S.Ct. 673, 44 L.Ed.813. Unless the contention of petitioner which we shall now discuss is controlling, the case is moot and the petition should be dismissed.
It is petitioner's contention that this court pursuant to G.L. 1956, § 26-3-10, is required to inquire and determine as to the sanity or insanity of one confined at the state hospital for mental diseases at the time of the application for the writ but released from such confinement prior to its return. Although the section is unambiguous and does not readily admit to the construction thereof suggested by petitioner, we will, though not required so to do, refer to its precedents in order to ascertain whether anything can there be found which will support his contention.
In Petition of Doyle, supra, which was decided in 1889, a petition for habeas corpus was filed by the guardian of the person and estate of one restrained for his delivery from confinement in the Butler Hospital for the Insane, such person having been committed by his wife prior to the appointment of the petitioner as his guardian and having been there detained under public statutes 1882, chap. 74, secs. 11 and 12. Those sections provided that an insane person might be placed in a curative hospital by certain persons named therein and there "lawfully received and detained" until discharged in one of the modes provided in chap. 74.
Such modes did not include any which could be resorted to by the person confined on his own behalf, but were dependent on the will or action of third persons. They included a provision for the appointment of a commission by a justice of this court to inquire into the question of sanity and to report thereon for action by the justice, but application for such appointment could be made only by a stranger and not by the person confined as now provided in § 26-3-5. Also included was the remedy of habeas corpus, but the petition for such writ could be made only by a person acting in behalf of the one confined and not by the person confined as now provided in § 26-3-10.
The court in Petition of Doyle held that chap. 74 violated the due process of law clause of the fourteenth amendment to the constitution of the United States in that it made no provision for some legal procedure by which the person committed had an opportunity to initiate and pursue one of the modes for discharge therein provided.
Twenty-four days after the delivery of the opinion in Petition of Doyle the general assembly, as stated by the court in In re Petition of Crosswell, 28 R.I. 137, 141, 66 A. 55, 57, "recognizing the necessity of providing for the restraint of the insane, passed an act in amendment of said chapter 74, Pub.Laws [1889], cap. 819, intended to obviate the objections to the validity of chapter 74." Public laws 1889, chap. 819, was further amended by P.L. 1891, chap. 935, and the changes and additions so made in and to the relevant portions of P.S. 1882, chap. 74, as it stood at the time of the decision in Petition of Doyle are substantially embodied in §§ 26-3-5 and 26-3-10 as they stand today.
*270 In In re Petition of Crosswell, the court in upholding the constitutionality of the statute as it then existed found in substance that subsequent to Petition of Doyle two statutory methods had been provided whereby the person confined could himself invoke action of the highest judicial authority in order to determine the propriety of his restraint and that the reason for the holding in Petition of Doyle no longer existed. Such two methods, as we have already indicated, are now available. See § 26-3-5 and 26-3-10.
The brief review which we have made of the statutory antecedents to § 26-3-10 leads inevitably to the conclusion that the sole reason for the enactment of what is now § 26-3-10 was to provide a means whereby a person confined because of alleged mental illness might upon his own initiative ssek a judicial determination by habeas corpus of the legality of his defendant. It was not intended to nor does it by its terms provide a procedure for judicial determination of the mental condition of a person confined at the time of the application for the writ, and not confined at the time of the hearing thereon; it was intended to and it does by its terms provide for a judicial determination as to applicant's mental condition only when he is confined by another.
For the reasons expressed, the petition for the writ of habeas corpus is denied and dismissed, the writ heretofore issued is quashed, and the petitioner is remanded to custody in accordance with law.
