A petition having heen filed on behalf of Bobert Bernard Hedberg, alleging that he was improperly restrained by the Sheriff of Los Angeles County at the request of the Adult Authority of this state, we issued an order to show cause why a writ of habeas corpus should not issue as prayed. It further appearing that there was danger that the relator might be removed by the prison authorities to an institution outside of our territorial jurisdiction, prior to the time we could determine the issues raised by the petition and the return thereto, we issued an interim order restraining his removal from the County of Los Angeles. For reasons hereinafter set forth, we conclude that the relator is lawfully held under the orders of the Adult Authority and that we should not interfere with the prompt execution of those orders.
Petitioner was charged by information filed by the District Attorney of Los Angeles County on December 16, 1957, number 197363, with the crime of grand theft in count I and burglary in count II. A plea of not guilty was entered as to each count and the trial thereon was set in Department Pomona B of the superior court on January 21, 1958, and further continuances for trial were had until April 22, 1958. On the latter date the trial judge directed the sheriff to file a mental illness petition against petitioner in Department 54, then designated as the Psychiatric Department of the Superior Court of Los Angeles County.
Trial of the criminal action was postponed until May 26, 1958. The minutes of the trial court show that on May 26, 1958, the criminal action was placed off calendar for the reason that the defendant (petitioner) had been committed in Department 54 to the Department of Mental Hygiene for placement in Camarillo State Hospital. The minutes of the trial court further show that on September 23, 1958, the sheriff was directed to return petitioner from Camarillo State Hospital to the trial court and the criminal action was then set for trial for October 6, 1958. After a further continuance, and on October 29, 1958, action number 197363 was consolidated with criminal action number 202111 and both cases were continued to November 3, 1958, for resetting. After a further continuance, and on November 7,1958, petitioner withdrew his plea of not guilty to count I of information number 197363 ' (grand theft) and entered a plea of guilty thereto. Petitioner eventually was sentenced to state prison on the charge of *730grand theft and the other counts against him in both informations were dismissed.
The record further shows that, on May 5, 1958, pursuant to the directions of the trial court, the sheriff filed a petition, number 171951, to have the defendant adjudged a mentally ill person under provisions of sections 5040 et seq. of the Welfare and Institutions Code. Three psychiatrists were appointed to examine defendant and report their findings to the court. The petition was duly served upon the defendant and the record shows that no demand for a hearing thereon was made as provided by section 5050.8 of the Welfare and Institutions Code. The court, after having considered the petition and the reports of the three psychiatrists, did, on May 23, 1958, adjudge the defendant to be a mentally ill person as defined in section 5040 of the Welfare and Institutions Code and ordered him committed to the Department of Mental Hygiene for placement at Camarillo State Hospital. (We'lf. & Inst. Code, § 5100, subd. (b).) This was the basis for the order made on May 26, 1958, in Department Pomona B, placing the criminal action off calendar.
On September 18, 1958, the superintendent and medical director of the state hospital at Camarillo advised the trial court by letter that the defendant’s case had been reviewed by the medical staff and in their opinion he was in suitable condition for a return to court to dispose of the pending matter, and requested that the necessary order issue to effect such return. The certificate of the Superintendent of Camarillo State Hospital met the requirements of section 1372 of the Penal Code.
The record discloses that the judge who accepted petitioner’s plea of guilty and who pronounced judgment and sentence in the criminal action was the same judge who held petitioner to be a mentally ill person, and ordered him committed to the state hospital at Camarillo. This circumstance was brought about by the fact that the judge who was assigned to sit part time in Department Pomona B where the criminal action was assigned for trial was also assigned to sit part time in Department 54, then designated as the psychiatric department of the court.
Eventually petitioner was released from state prison and is now on parole under the sentence pronounced upon his plea of guilty to the crime hereinbefore referred to. While on parole he was charged with and entered a plea of guilty to a violation of section 11500 of the Health and Safety Code, *731for which he was placed on probation, one of the conditions being that he serve a term in the Los Angeles County Jail. The Division of Adult Paroles has placed a hold with the Sheriff of Los Angeles County seeking custody of petitioner, presumably as a parole violator. Petitioner seeks his release from custody asserting that the judgment and sentence on the charge of grand theft, upon which petitioner is now on parole, is based upon a void judgment for the reason that he was denied due process of law by the trial court in its failure to give him a hearing on the issue of his sanity pursuant to the provisions of section 1368, Penal Code.
If at any time during the pendency of an action and prior to judgment, a doubt arises as to the sanity of the defendant, the court must order the question as to his sanity to be determined by a trial by the court without a jury, or with a jury if a trial by jury is demanded. (Pen. Code, § 1368.) The trial judge having expressed such a doubt, it becomes his duty to comply with the mandate of Penal Code, section 1368, and to try that issue. (People v. Westbrook, 62 Cal.2d 197, 204 [41 Cal.Rptr. 809, 397 P.2d 545].)
While it may not be improper, where the issue of present sanity is raised under section 1368, to transfer that issue to the psychiatric department of the court for determination, the trial thereof must contain all of the elements of due process required by that section. (People v. Westbrook, supra.)
In Westbrook the trial judge appointed psychiatrists to examine the defendant and they reported back to the court. It did not appear that there had been any trial or hearing of the issue of present sanity in the psychiatric department of the court. The Supreme Court held that it was no answer that the trial judge may have resolved his previously expressed doubt upon receipt of those reports. (People v. Westbrook, supra.) In the instant ease, full opportunity to be heard was afforded petitioner before the psychiatric department of the court. He had the right, upon request, to be tried by the court sitting without a jury (Welf. & Inst. Code, § 5050.9), or if after such a hearing he was dissatisfied with the order of commitment he could have demanded that the question of his mental illness be tried by a jury of the superior court of the county in which he was committed. (Welf. & Inst. Code, § 5125.)
Just what additional benefits and protection petitioner would have received had the trial court proceeded in strict *732compliance with the mandates of section 1368 of the Penal Code, over what he did receive, is not apparent. If, after a trial under the foregoing section, petitioner had been found sane, the court would have accepted his plea of guilty. If he had been found insane, he would have been sent, just as he was here, to a state hospital for the mentally ill, until certified back as sane. (Pen. Code, §§ 1370, 1372.) Upon his return from the state hospital, the criminal trial which would have been suspended during the period of his stay in the state hospital would have resumed, as it did here.
“A person cannot be tried, adjudged to punishment, or punished for a public offense, while he is insane.” (Pen. Code, § 1367.) Sections 1368 et seq. of the Penal Code, provide safeguards and procedures to implement the rule laid down in section 1367. Had petitioner been found not to be a mentally ill person, and then had been adjudged and punished for the crime to which he entered a plea of guilty, assuming the procedure followed here would not meet with the mandate of section 1368 of the Penal Code, then petitioner might assert that the doubt as to his then sanity had not been properly resolved. The record is barren of any claim on the part of petitioner that he was at any time a mentally ill person. This issue, according to the record, was raised by the trial judge. Petitioner does not complain that he was sent to the state hospital as a mentally ill person or that his trial on the criminal charge was suspended during his stay in the hospital and until he was certified by the superintendent as sane and released for further proceedings in the criminal action. As heretofore pointed out, had petitioner demanded and received a jury trial on the issue of his then sanity and had the jury found that he was then insane within the meaning of section 1368 of the Penal Code, the same procedure would have followed with respect to his commitment to a state hospital, his subsequent release upon certification of the superintendent and the resumption of the proceedings under the criminal action then pending.
There is an additional circumstance here that was not present in Wesñrook, that is, petitioner was committed to a state hospital and was returned therefrom upon the certificate of the superintendent showing him to have recovered his sanity. (Pen. Code, § 1372.) A person discharged from a state hospital is presumed to have legal capacity (Civ. Code, § 40) and where, as here, the superintendent has acted, no further judicial action is required to determine whether the person so discharged is sane or insane. (People v. Puter, *73385 Cal.App.2d 348, 351-352 [193 P.2d 23].) Under the circumstances here shown, the petitioner was sane at the time of entry of his plea of guilty. To have required the trial court, upon his return from the state hospital, to proceed with a trial under the provisions of sections 1368 et seq. of the Penal Code, in order to determine the question of petitioner’s sanity at the time of the entry of his plea, would have been to compel the trial court to perform a useless act.
To hold under the circumstances of this case that petitioner has been deprived of a constitutional right to due process would be to exalt form over substance.
The petition is denied; the restraining order heretofore entered is vacated as of the date this opinion is filed.
Files, P. J., and Kingsley, J., concurred.
A petition for a rehearing was denied March 22, 1965, and petitioner’s application for a hearing by the Supreme Court was denied May 5, 1965.
Assigned by the Chairman of the Judicial Council.