This case arose in this court by way of a letter written by the petitioner, dated December 16, 1963, in which he charges, that he is being illegally detained in the-South Florida State Hospital, and that his mental condition does not justify his being so detained. We treated his letter as a petition for writ of habeas corpus and issued a rule to show cause to the respondent. The respondent has now answered and we have examined the record.
It appears from the record that the petitioner was indicted for the crime of murder in the first degree and found not guilty by reason of insanity. On November 17, 1961, the Honorable James H. Walden, Circuit Judge of the Fifteenth Judicial Circuit in and for Broward County, ordered that petitioner be committed to the Florida State Hospital at Chattahoochee, pursuant to Sec. 919.11, Fla.Stat., F.S.A. He was later transferred to the South Florida State Hospital at Hollywood. On June 14, 1962, the petitioner filed an instrument in the Circuit Court entitled “Motion *550for Order of Discharge of Defendant from Commitment.” Judge Walden, on June 15, 1962, ordered that the petitioner be examined by seven psychiatrists and that their report be submitted to the court. On October 2, 1962, after a hearing, the lower court denied the petitioner’s motion, remanding him to the custody of the respondent. In his order, Judge Walden said, in part:
“The opinion testimony received at the instant hearing was conflicting to a considerable degree and the Court as trier of the fact has carefully assayed it according to accepted criteria. It is the finding and view of the Court that there has been no material change in the condition of the Defendant since his initial commitment to the State Hospital and that his condition remains the same as was stated in the Court’s Amended Order of Commitment dated November 27, 1961. Stated repetitively and with equal conviction, the Court is still of the opinion under the provisions of F.S.A. § 919.11 that the discharge or going at large by the Defendant will be manifestly dangerous to the peace and safety of the people as well as to the Defendant, and the Court is further of the opinion under the circumstances that the Defendant should be cared for as an insane person by being committed to a hospital for the insane, and not otherwise.”
On April 3, 1963, a letter addressed to Judge Walden was received by the committing court and was construed as an “application for re-examination and discharge.” This application was denied by an order dated April 16, 1963.
It must be kept in mind that the sole function of a habeas corpus proceeding is to test the legality of the petitioner’s detention. Sneed v. Mayo, Fla.1953, 66 So.2d 865. And habeas corpus may not be used as a substitite for an appeal. Collingsworth v. Mayo, Fla.1948, 37 So.2d 696. Nor may it be used where there was a remedy by appeal. Boyd v. Cochran, Fla. 1960, 118 So.2d 627.
In view of the extensive examinations of the petitioner and the fact that the trial court has found that there is a conflict of opinion as to petitioner’s sanity, and after our further analysis of the record, we find no merit in the petition for habeas corpus. Therefore, the rule must be and it is hereby discharged, and the petition for writ of habeas corpus is denied.
It is so ordered.
SMITH, C. J., and SHANNON and KANNER (ret.), JJ., concur.