
550 P.2d 346 (1976)
R. M., Petitioner,
v.
The DISTRICT COURT IN AND FOR the TENTH JUDICIAL DISTRICT, State of Colorado, and the Honorable Richard Robb, one of the District Judges in and for the Tenth Judicial District, State of Colorado, Respondents.
No. 27111.
Supreme Court of Colorado, En Banc.
June 1, 1976.
*347 Rollie R. Rogers, Colorado State Public Defender, James F. Dumas, Jr., Chief Deputy State Public Defender, Denver, Robert E. West, Deputy State Public Defender, Dennis Maes, Deputy State Public Defender, Pueblo, for petitioner.
J. E. Losavio, Jr., Dist. Atty., Tenth Judicial Dist., Ted Malouff, Deputy Dist. Atty., Tenth Judicial Dist., Pueblo, for respondents.
KELLEY, Justice.
Petitioner instituted this original proceeding under C.A.R. 21 to challenge the jurisdiction of the respondent district court in a juvenile delinquency proceeding. Petitioner specifically alleges three areas in which the respondent district court exceeded its jurisdiction: (1) the delinquency petition should have been dismissed ab initio because petitioner was committed to a state mental hospital at the time the petition was filed, section 19-3-107(3), C.R.S.1973; (2) the respondent court should have granted petitioner's motion for the appointment of a psychiatrist to examine the petitioner, section 19-3-107(1) (a); and (3) the respondent court should have granted petitioner's motion to suspend the delinquency proceedings pending a report by the appointed psychiatrist. Section 19-3-107(1), (2) and (4), C.R.S.1973. We stayed the delinquency proceedings and issued a rule to show cause on each of the three issues raised by petitioner. We now make the rule absolute on the dismissal issue and discharge the rule as to the other two issues.
On April 24, 1975, the respondent court ordered petitioner to a short-term involuntary hospitalization at the Colorado State Hospital for the purpose of "examination, diagnosis, care and treatment for a period not to exceed three months unless extended by order of Court." Section 27-9-105, C. R.S.1973. On May 17, 1975, petitioner escaped from the state hospital, and on May 30, 1975, he was allegedly involved in a theft of property. He was returned to the state hospital on the following day.
On June 23, 1975, the district attorney filed a petition of delinquency against the petitioner. On that date, petitioner was still committed to the state hospital under the short-term involuntary hospitalization order issued by the respondent. On July 7, 1975, petitioner was advised by the respondent court of his constitutional and legal rights, C.R.J.P. 8, and on July 18, 1975, petitioner, who was assisted by counsel, entered a plea of denial to the petition. See C.R. J.P. 15. On July 24, 1975, petitioner was discharged from the state hospital upon the expiration of the respondent's short-term involuntary hospitalization order issued three months earlier.
The adjudicatory hearing[1] on the delinquency petition was originally set for August 14, 1975, but was later rescheduled for February 10, 1976. Several days prior to the rescheduled hearing, petitioner filed motions for the appointment of a psychiatrist to examine petitioner, and for the suspension of the adjudicatory hearing. On February 10, 1976, the respondent conducted a hearing on petitioner's motions and denied them. However, respondent granted petitioner's motion for a continuance. Prior to the continued hearing date, this original proceeding was commenced.

I.
Petitioner first argues that the petition of delinquency should have been dismissed ab initio by respondent, because at the time the delinquency petition was filed, petitioner was committed to a state hospital. Section 19-3-107(3). We agree.
Section 19-3-107(3), C.R.S.1973, provides:
"The court shall dismiss the original petition when a child is committed to a state hospital or state home and training school under article 9 or 10 of title 27, C.R.S.1973." (Emphasis added.)
*348 The issue in this case is whether this statute mandates that a delinquency petition be dismissed when the child has already been committed to a state hospital at the time the petition is filed. In interpreting this statute, we are guided by the general rule that provisions of the Children's Code should be liberally construed to accomplish the purpose and to effectuate the intent of the legislature. Section 19-1-102(2), C.R.S.1973; Briones v. Juvenile Court, Colo., 534 P.2d 624 (1975); People in the Interest of M.K.A., 182 Colo. 172, 511 P.2d 477 (1973); Denver v. Juvenile Court, 182 Colo. 157, 511 P.2d 898 (1973).
Section 19-3-107 reflects a dual legislative purpose. First, it protects a juvenile who is "mentally ill" or "mentally deficient" from having to respond to the delinquency petition in an adversary setting, fully recognizing the impairment to the juvenile's competence which is the result of the child's youth and mental condition. Briones v. Juvenile Court, supra. Second, the statute provides an affirmative avenue of relief through medical treatment for such juveniles as an alternative to the ordinary juvenile delinquency proceeding. Id.
In light of the liberal construction required of provisions of the Children's Code to accomplish the above stated legislative purposes, we hold that section 19-3-107(3), C.R.S.1973, mandates that a delinquency petition which is filed while the juvenile is committed to a state hospital under a previous court order must be dismissed ab initio. The dismissal is mandated by the statute. The respondent judge here was the same judge who ordered petitioner to be hospitalized. Petitioner was actually confined under respondent's hospitalization order at the time of the filing of the petition. The respondent's failure to dismiss the petition ab initio, when it appeared that petitioner was committed under his order, was judicial action in excess of respondent's power and authority. The petition should now be dismissed.
However, the district attorney is not without recourse. The dismissal is without prejudice, and a new petition may be filed based upon the same allegations if petitioner is not committed at the time of the new filing.

II.
The dismissal of the petition, of course, moots petitioner's two remaining contentions. Thus, as to them, the rule is discharged. However, it should be noted that if the district attorney files a new delinquency petition, the court should adhere to section 19-3-107(1), C.R.S.1973, which provides:
"if it appears from the evidence presented at an adjudicatory hearing that the child may be mentally ill or mentally deficient, as these terms are defined in section 27-9-102, C.R.S.1973, the court shall suspend the hearing on the petition and shall either:
"(a) Order that the child be examined by a physician, psychiatrist, or psychologist, and may place the child in a hospital or other suitable facility for the purpose of examination; or
"(b) Proceed as provided in section 27-9-105 or 27-9-106, C.R.S.1973." (Emphasis added.)
We have held that this statute permits the presentation of evidence regarding the juvenile's mental condition as soon as the court first "acquires initial jurisdiction" over the petition of delinquency. Briones v. Juvenile Court, supra. Thus, the court may take evidence regarding the child's mental condition as early as the filing of the new petition.
The proper test under this statute is not whether the juvenile is in fact "mentally ill" or "mentally deficient." Rather, the proper test is whether the juvenile may be "mentally ill" or "mentally deficient" as of the time of the hearing on the new petition.
We have read the report of Dr. VanDePolder relied upon by the court in entering the challenged order. This report was prepared while petitioner was under respondent's hospitalization order. The report does not specifically offer a diagnosis *349 of petitioner's mental condition. It is, at most, equivocal as to the petitioner's mental state and not sufficient, as a matter of law, to sustain the respondent's order.
In any event, the report is dated May 13, 1975, which is several days prior to petitioner's escape, and some nine months prior to the hearing on petitioner's mental condition. It has dubious probative value regarding petitioner's "present" mental condition.
The rule is made absolute as to the issue relating to the dismissal of the delinquency petition, and is discharged as to the remaining issues.
NOTES
[1]  Defined in section 19-103(1), C.R.S.1973; see also section 19-3-106, C.R.S.1973.
