
490 S.W.2d 649 (1973)
Ex parte Leo James KENT, Petitioner.
No. 58046.
Supreme Court of Missouri, En Banc.
February 12, 1973.
As Modified on Denial of Rehearing March 14, 1973.
*650 Joseph Langworthy, Pacific, for petitioner, Leo James Kent.
John C. Danforth, Atty. Gen., Daniel P. Card II, Asst. Atty. Gen., Jefferson City, for respondent.
DONNELLY, Judge.
The question presented is whether petitioner is being deprived of his liberty without due process of law (Art. I, § 10, Const. of Mo., V.A.M.S.).
On March 2, 1971, petitioner was charged in the Circuit Court of the City of St. Louis with robbery in the first degree by means of a dangerous and deadly weapon. On April 15, 1971, at the request of petitioner's counsel, the trial court ordered a psychiatric examination under V.A.M.S. § 552.020. The report of the psychiatric examination revealed (1) that petitioner lacked capacity to understand the proceedings against him or to assist in his own defense, and (2) that, at the time of the alleged criminal conduct, petitioner did not know or appreciate the nature, quality, or wrongfulness of his alleged conduct and was incapable of conforming his conduct to the requirements of the law.
On December 6, 1971, petitioner's counsel requested permission to withdraw a plea of not guilty and to enter a joint plea of not guilty and not guilty by reason of mental disease or defect excluding responsibility. On December 7, 1971, the request was denied, the psychiatric report was introduced and considered, the State stipulated to its accuracy and "accepted" the defense of not guilty by reason of mental disease or defect excluding responsibility, and the trial court ordered "the defendant be acquitted of the charge herein on the ground of mental disease or defect excluding responsibility" and that "the defendant be ordered to the custody of the Director of Division of Mental Diseases for care and treatment in a state mental hospital and not to be released therefrom except on order from this Court upon a determination as provided by law." Petitioner is now detained, pursuant to said order, at State Hospital No. 1, at Fulton, Missouri.
On July 24, 1972, counsel for petitioner filed a petition for writ of habeas corpus in this Court. A return was ordered and was filed. The case was argued in this Court on October 3, 1972. The final portion of the transcript of the proceedings in the trial court was filed in this Court on December 29, 1972.
V.A.M.S. § 552.020, which deals with the question of an accused's mental fitness to proceed, reads, in part, as follows:
"1. No person who as a result of mental disease or defect lacks capacity to understand the proceedings against him or to assist in his own defense shall be tried, convicted or sentenced for the commission of an offense so long as the incapacity endures."

* * * * * *
"8. If the charges against any accused person are dismissed either by the state or by the court and if he is then in custody of the director of the division of mental diseases, he shall not be retained in such custody or in any hospital unless proper proceedings have been instituted and held as provided in sections 202.783 to 202.875, RSMo, in which case these sections and no others shall be applicable to his continued retention, hospitalization and discharge."
V.A.M.S. § 552.030, which deals with the plea of not guilty based on the defense of mental disease or defect at the time of the alleged offense, reads, in part, as follows:
"1. A person is not responsible for criminal conduct if at the time of such conduct as a result of mental disease or defect he did not know or appreciate the nature, quality or wrongfulness of his conduct or was incapable of conforming his conduct to the requirements of law.
"2. Evidence of mental disease or defect excluding responsibility shall not be admissible at trial of the defendant unless *651 the defendant at the time of entering his plea to the charge pleads not guilty by reason of mental disease or defect excluding responsibility, or unless within ten days after a plea of not guilty or at such later date as the court may for good cause permit, he files a written notice of his purpose to rely on such defense. Such a plea or notice shall not deprive the defendant of other defenses. The state may accept a defense of mental disease or defect excluding responsibility, whether raised by plea or written notice, if the defendant has no other defense and files a written notice to that effect. Upon the state's acceptance of the defense of mental disease or defect excluding responsibility, the court shall proceed to order the commitment of the defendant as provided in section 552.040 in cases of persons acquitted on the ground of mental disease or defect excluding responsibility, and further proceedings shall be had regarding the confinement and release of the defendant as provided in that section."
V.A.M.S. § 552.040, which deals with commitment after acquittal based on mental disease or defect, reads, in part, as follows:
"1. When a defendant is acquitted on the ground of mental disease or defect excluding responsibility, the court shall order such person to be committed to the director of the division of mental diseases for custody, care and treatment in a state mental hospital. No person shall be released from such commitment until it is determined through the procedures provided in this section that he does not have and in the reasonable future is not likely to have a mental disease or defect rendering him dangerous to the safety of himself or others or unable to conform his conduct to the requirements of law."
On the record before the trial court on December 7, 1971, petitioner was unfit to proceed and should have been committed under V.A.M.S. § 552.020. The trial court, upon the State's "acceptance" of the defense of mental disease or defect excluding responsibility, ordered petitioner committed under V.A.M.S. § 552.040, even though petitioner had not filed a written notice to the effect he had no other defense (V.A. M.S. § 552.030), but, on the contrary, had urged the right to rely on other defenses. The matter must be remanded for further proceedings in the trial court. Petitioner is being restrained of his liberty on the basis of an invalid order.
We suggest the following procedure in subsequent proceedings in the trial court:
(1) In Jackson v. Indiana, 406 U. S. 715, 738, 92 S.Ct. 1845, 1858, 32 L.Ed.2d 435 (1972), the United States Supreme Court held that "a person charged by a State with a criminal offense who is committed solely on account of his incapacity to proceed to trial cannot be held more than a reasonable period of time necessary to determine whether there is a substantial probability that he will attain that capacity in the foreseeable future. If it is determined that this is not the case, then the State must either institute the customary civil commitment proceeding that would be required to commit indefinitely any other citizen, or release the defendant."
The trial court, upon its own motion, should order a psychiatric examination and should proceed so as to comply with V.A. M.S. § 552.020, and so as to comply with Jackson v. Indiana, supra, to ascertain whether there is a substantial probability that petitioner will attain the capacity to proceed to trial in the foreseeable future.
(2) If it is determined that petitioner is mentally fit to proceed, the criminal proceedings may be resumed.
(3) If petitioner is not mentally fit to proceed, and there is not a substantial probability that petitioner will attain such capacity in the foreseeable future, the charges against petitioner should be dismissed "and if he is then in custody of the director of the division of mental diseases, he shall not be retained in such custody or *652 in any hospital unless proper proceedings have been instituted and held as provided in sections 202.783 to 202.875 RSMo, in which case these sections and no others shall be applicable to his continued retention, hospitalization and discharge" (V.A. M.S. § 552.020, Subsec. 8).
(4) If petitioner is not mentally fit to proceed but there is a substantial probability that petitioner will be able to stand trial in the foreseeable future, the trial court should enter the necessary orders to assure that petitioner's "continued commitment * * * [is] justified by progress toward that goal." (Jackson v. Indiana, supra, 406 U.S. 715, 738, 92 S.Ct. 1845, 1858.)
(5) We anticipate, in view of the record before us, that petitioner's counsel may again assert in the trial court that petitioner, even while he remains incompetent, is nevertheless entitled to attack the criminal charge on its merits.
The question posed for "the defendant who, although perhaps conceded to be incompetent, has valid grounds for attacking the criminal charge on the merits" (Foote, A Comment on Pre-Trial Commitment of Criminal Defendants, 108 U.Pa.L. Rev. 832, 841), is pointed up by Professor Foote as follows:
"This question might arise in three different types of situations. The first is the instance * * * where the defendant can show that the prosecution is barred as a matter of law; another example would be an indictment which on its face discloses that the statute of limitations has run. Second are cases where the defendant alleges that he can show an intrinsic defect in the prosecution's factual case which will prevent conviction, for example, that essential evidence was obtained by an unlawful search and seizure or that the prosecution's evidence shows entrapment as a matter of law. Third, counsel for an incompetent defendant may wish to assert an affirmative defense which can be established without participation of the defendant. In a robbery prosecution based on identification evidence, for example, counsel may be able to establish from employment records and the testimony of third parties that the defendant was at work in another city at the time of the crime. In all of these situations present law appears to say to the defendant: `Wait. You can't raise this until and if you have recovered. In the meantime we'll detain you with the criminally insane, where you will have to live under the cloud of an accusation from which we will not allow you to exculpate yourself.'"
In Massachusetts, the problem has been recognized and treated definitively by statute (Mass.Gen.Laws c. 123, § 17 (1972 Supp.)):
"If either a person or counsel of a person who has been found to be incompetent to stand trial believes that he can establish a defense of not guilty to the charges pending against the person other than the defense of not guilty by reason of mental illness or mental defect, he may request an opportunity to offer a defense thereto on the merits before the court which has criminal jurisdiction. The court may require counsel for the defendant to support the request by affidavit or other evidence. If the court in its discretion grants such a request, the evidence of the defendant and of the commonwealth shall be heard by the court sitting without a jury. If after hearing such petition the court finds a lack of substantial evidence to support a conviction it shall dismiss the indictment or other charges or find them defective or insufficient and order the release of the defendant from criminal custody."
In Missouri, the problem can be dealt with to a limited extent. Our Rule 25.06, V.A.M.R., reads as follows:
"(a) Any defense or objection which is capable of determination without the trial of the general issue may be raised before trial by motion.
"(b) Defenses and objections based on defects in the institution of the prosecution or in the indictment or information other *653 than that it fails to show jurisdiction in the court or to charge an offense may be raised only by motion before trial. Failure to present such defenses or objections constitutes a waiver thereof, but the court for good cause shown may grant relief from such waiver. Lack of jurisdiction or the failure of an indictment or information to charge an offense may be noticed by the court at any time during the pendency of the proceeding.
"(c) Any defense or objection to be raised by motion shall be made before the plea is entered or thereafter, and within such time before trial, as the court may fix.
"(d) The court may determine before trial the defenses and objections raised by motion except where issues of fact are involved which are required by the constitution or by the laws of the state to be tried by a jury.
"(e) Any motion filed under the provisions of these Rules shall specify clearly the defense or grounds of objection relied upon by the defendant and unless it does so it shall be disregarded by the court."
In the circumstances presented in this case, we believe petitioner's counsel may assert "any legal objection to the prosecution which is susceptible of fair determination prior to trial and without the personal participation of the defendant." (Model Penal Code § 4.06.) If petitioner's counsel requests a trial by the court or by a jury on the question whether petitioner committed the crime charged, the request must be denied (V.A.M.S. § 552.020, Subsec. 1). However, until our General Assembly speaks directly to the problem, we believe due process requires that a trial judge, if so requested, should satisfy himself that there is substantial evidence available to support a conviction. If he finds a lack of such evidence, he should dismiss the charges under the provisions of V.A. M.S. § 552.020, Subsec. 8.
The psychiatric report shows that petitioner should be held in custody at Fulton "pending determination of the issue of mental fitness to proceed" (V.A.M.S. § 552.020, Subsec. 5), and other issues which may or may not be raised in the trial court; and that he should not be discharged by order of this Court.
The trial court is directed to set aside its order of December 7, 1971, and to proceed in a manner not inconsistent with this opinion.
All concur except HOLMAN, J., not participating.
