
552 So.2d 175 (1989)
William R. FERGUSON
v.
STATE.
3 Div. 56.
Court of Criminal Appeals of Alabama.
September 29, 1989.
Arthur Elsner, Montgomery, and Garth A. Corbett and Edward H. Stevens of Alabama Disabilities Advocacy Program, Tuscaloosa, for appellant.
Don Siegelman, Atty. Gen., and Kenneth S. Nunnelley, Asst. Atty. Gen., for the State.
G.R. Trawick, Montgomery, for State Dept. of Mental Health & Mental Retardation.
*176 McMILLAN, Judge.
This appeal arises out of the denial of the appellant's habeas corpus petition by the Montgomery County Circuit Court. The appellant, who was in the custody of the Montgomery County Sheriff's Department when the petition was filed,[1] alleges that he is presently and indefinitely being unlawfully confined by the Department of Mental Health and that the trial court, therefore, erred in denying his petition. For the reasons set forth below, we agree with the appellant's argument. It is therefore the opinion of this Court that the judgment of the trial court is due to be reversed, and this cause remanded.
The record shows that the appellant, William R. Ferguson, was arrested in August 1986, on a charge of burglary in the second degree. The appellant is profoundly deaf. He functions in the mild mental retardation range and cannot speak, read, or write, or otherwise communicate except through limited sign language.
In November 1986, by order of the trial court, the appellant was committed to the custody of the Taylor Hardin Secure Medical Facility for a comprehensive pretrial evaluation regarding his competency to stand trial. At that time, Dr. Joe W. Dixon, a Taylor Hardin certified forensic examiner at the facility, administered the "Competency to Stand Trial Assessment Instrument" ("CAI") to the appellant. The results of this test revealed that the appellant had no appreciation of his alleged criminal act and that he had a very limited understanding of the judicial process. Moreover, because of the appellant's low intelligence and poor communication skills, it was determined that he would not be able to assist in his own defense. Dr. Dixon's final diagnosis further showed that the appellant was not mentally ill. After this evaluation, the appellant was returned to the Montgomery County jail.
Eight months later, in July 1987, the trial court ordered a second assessment of the appellant's competency to stand trial. The results of this evaluation by Dr. Frieda Meacham showed that it would be extremely difficult, if not impossible, for the appellant to assist his attorney in the preparation of his defense, even if he were provided with an interpreter. As did the prior competency report, the evaluation of Dr. Frieda Meacham concluded that the appellant was not competent to stand trial. Dr. Meacham's report further concluded that it was very unlikely that the appellant would be competent to stand trial in the foreseeable future.
Following Dr. Meacham's evaluation, the appellant's attorney filed a motion for determination of competency to stand trial and for commencement of civil commitment process. After a hearing on this motion, on March 4, 1988, the trial court found that the appellant was, in fact, unable to assist in his own defense and ordered him committed to the custody of the Department of Mental Health "until he is restored to his right mind and able to comprehend the nature of the proceedings and charges against him." The court further ordered that the appellant "be treated and cared for as any and all other civilly committed persons. The Department of Mental Health is authorized to place the defendant in any theraputic [sic] setting or community environment that it deems appropriate and advisable for continued treatment and training." The appellant, however, was returned to the Taylor Hardin Secure Medical Facility.
Tests administered during the appellant's readmission to the Taylor Hardin Facility in March 1988 yielded a final diagnosis of Antisocial Personality Disorder, mutism, and partial deafness. The recommendations of the staff of the Taylor Hardin Facility as to the appellant's placement were identical to its previous placement assessment. The Alabama Institute for the Deaf and Blind and the Southwest Alabama Regional School for the Deaf were among the institutions recommended for the appellant's care; no mental health facility *177 was considered appropriate. In June 1988, three months after his reassessment evaluation, the appellant was once again transferred to the Montgomery County jail.
Also, in June 1988, the appellant filed the habeas corpus petition now before this court. A hearing on the merits of the appellant's claims was held, and on September 2, 1988, the trial court denied his petition, and ordered him to be recommitted to the custody of the Department of Mental Health. Appeal was then made to this court, during the pendency of which the Department of Mental Health was joined as a party to this litigation. In October 1988, the Department of Mental Health filed a motion with the trial court seeking classification of its September 2, 1988, order. The Department of Mental Health argues in its motion that reconfining the appellant at the Taylor Hardin Facility would be violative of the Supreme Court's holding in Jackson v. Indiana, 406 U.S. 715, 92 S.Ct. 1845, 32 L.Ed.2d 435 (1972), in that he would not be competent to stand trial in the foreseeable future and did not appear to meet the criteria for involuntary commitment under Alabama civil law. The trial court nevertheless remanded the appellant to the custody of the Department of Mental Health, which recommitted him to the Taylor Hardin Facility, where he remains confined.
In December 1988, the Director of the Taylor Hardin Facility instituted involuntary commitment proceedings against the appellant in the Tuscaloosa County Probate Court, pursuant to §§ 22-52-10 and 22-52-31, Code of Alabama (1975). On January 5, 1989, that court denied this petition, finding that the appellant failed to meet the criteria for involuntary commitment set forth by statute. Immediately thereafter, the district attorney moved to withdraw the indictment against the appellant.
In Jackson, supra, a case involving facts remarkably similar to those of the present case, the Supreme Court set forth the criteria for determining whether the due process rights of an incompetent criminal defendant have been violated. The Jackson 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 the 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."
Id. at 738, 92 S.Ct. at 1858 (emphasis supplied).
In the case sub judice, any real question as to the appellant's capacity to stand trial in the foreseeable future was put to rest by the second competency evaluation performed in July 1987. Although the State was required at that time by the plain language of Jackson either to release the appellant or to begin civil commitment proceedings against him, it had not taken any action at the time his habeas corpus petition was filed, nearly eleven months later.
The State concedes in its brief that it is unlikely that the appellant will become competent to stand trial in the foreseeable future and that he also failed to satisfy the criteria for civil commitment under § 22-52-10, Code of Alabama (1975). The State argues, however, that the trial court was unaware that the appellant failed to satisfy the criteria for civil commitment under § 22-52-10, Code of Alabama (1975) when it denied appellant's petition, that the court did not rule on this issue, and that the trial court cannot be placed in error based upon a matter which it did not decide. City of Rainbow City v. Ramsey, 417 So.2d 172 (Ala.1982). The State therefore contends that the appellant's remedy lies in the prosecution of a petition for writ of habeas corpus based upon the facts which have now been developed, rather than the pursuit of this appeal.
Although we note that the State's argument is technically correct, to affirm the trial court's judgment on that basis, under the facts of this case, would be an elevation *178 of form over substance, especially where the mandates of Jackson, supra, have so clearly been ignored. The judgment of the trial court is therefore due to be reversed and this cause remanded with the direction that the trial court enter an order requiring the immediate release of the appellant.
REVERSED AND REMANDED.
All the Judges concur.
NOTES
[1]  Following the denial of the petition sub judice, the trial court transferred the appellant to the custody of the Department of Mental Health. The appellant is presently confined at the Taylor Hardin Secure Medical Facility.
