delivered the opinion of the court:
These consolidated cases present the issue of the right to release from custody of minors charged with delinquency, pending the State’s appeal of an order of the juvenile court denying the State’s motion to allow prosecution as an adult.
In cause No. 55050, a petition for adjudication of wardship was filed in the interest of Michael Davis in the juvenile division of the circuit court of Cook County on January 28, 1981. The petition charged Michael, then 15V2 years old, with two counts of murder in the shooting deaths of Vincent and Gregory Jackson on January 26,1981.
At a hearing on January 28, 1981, the juvenile court determined that there was probable cause to believe that Michael was a delinquent minor. It further found that immediate and urgent necessity existed for Michael to be detained pending further proceedings, and ordered that he be held in the custody of the Cook County Juvenile Detention Center (Audy Home). (Section 3 — 5 of the Juvenile Court Act provides that a detention hearing must be held within 36 hours for any minor taken into custody for alleged delinquent acts. (Ill. Rev. Stat. 1979, ch. 37, par. 703—5.) If, at the detention hearing, the court determines that probable cause exists to believe the minor is delinquent, then the court must make a further determination whether “it is a matter of immediate and urgent necessity for the protection of the minor or *** of another” (Ill. Rev. Stat. 1979, ch. 37, par. 703—6(2)) that the minor be detained in a suitable place designated by the court. If the court finds the existence of probable cause and immediate and urgent necessity, it may order detention (secure custody in physically restricting facilities (Ill. Rev. Stat. 1979, ch. 37, par. 701—9)) or shelter care (care in physically unrestricting facilities (Ill. Rev. Stat. 1979, ch. 37, par. 701—17)). If probable cause exists but there is no finding of immediate and urgent necessity for detention, the minor must be released. Ill. Rev. Stat. 1979, ch. 37, par. 703-6(2).)
Also at the January 28 hearing, the State’s Attorney filed a motion pursuant to section 2 — 7(3) of the Juvenile Court Act (Ill. Rev. Stat. 1979, ch. 37, par. 702—7(3)) to prosecute Michael as an adult. The court continued the hearing on this motion until February 18, and ordered a social investigation and psychological and psychiatric evaluations of Michael to be conducted to assist it in determining whether to allow the motion to transfer. These reports were not completed until February 28, 1981.
On March 3 and April 14-15, the juvenile court again held hearings at which additional evidence was presented as to the factors listed in section 2 — 7(3)(a). At the conclusion of the April 14-15 hearing, the court denied the State’s motion to prosecute Michael as an adult, and set the case for adjudicatory hearing on April 29, 1981.
On April 29, Michael answered ready to proceed to adjudication. However, the State filed a notice of appeal from the juvenile court’s order denying the motion to transfer. Michael then moved for release to his mother’s custody pending decision of the appeal. The juvenile court denied this motion, but on its own motion set bail at $100,000. Michael was unable to post bail.
On May 4 and 13, Michael moved the juvenile court to reconsider its order denying release, asserting that bail was not contemplated in proceedings under the Juvenile Court Act, and that under section 4 — 2 of the Act Michael was entitled to be released without bail. Section 4 — 2 provides, in pertinent part:
“Date for adjudicatory hearing. When a petition has been filed alleging that the minor is a person described in Section 2 — 2 or 2 — 3 [delinquent minor or minor in need of supervision], it shall be set for an adjudicatory hearing within 30 days. In the case of a minor ordered held in detention or shelter care, however, the petition must be set for hearing within 10 judicial days from the date of the order of the court directing detention or shelter care or the earliest possible date in compliance with Sections 4— 3 and 4 — 4 [concerning summons and notice]. Whenever a minor is held in detention or shelter care and the petition alleges that he or she committed a crime of violence, the State’s Attorney may by motion before the date set for the adjudicatory hearing, request that the adjudicatory hearing be postponed. *** For good cause in support of such a motion, which may include, but is not limited to, delay in obtaining medical or other scientific evidentiary reports or similar evidence or the unavailability of witnesses, the court may postpone the adjudicatory hearing up to 20 judicial days from the date of the order of the court directing detention or shelter care. ***” Ill. Rev. Stat. 1979, ch. 37, par. 704—2.
On May 22, the juvenile court reduced bail to $50,000 and on June 12 the court vacated its previous bail order and ordered Michael released without bond to the custody of his mother.
Prior to his release, Michael had filed in this court, on June 5, 1981, a motion for leave to file a petition for writs of mandamus and habeas corpus. The petition challenged the authority of the juvenile court to hold Michael to bail pending the State’s pre-adjudication appeal, and asked for his immediate release. The State, on June 19, filed its answer to Michael’s June 5 petition and also cross-petitioned for leave to file for a writ of mandamus to compel the juvenile court to vacate its order of June 12 releasing Michael. The State also moved to stay the June 12 order. Leave to file the petition, answer, and cross-petition was granted by this court in an order of July 2,1981.
On July 20, this court denied the State’s motion to stay the juvenile court’s June 12 order releasing Michael without bond, and also denied the State’s alternative motion to set bail in the amount of $100,000. However, this court, on its own motion, vacated the juvenile court’s June 12 order and reinstated the order of April 29 that set $100,000 bail, pending the disposition of the mandamus proceedings.
Pursuant to this court’s July 20 order, Michael was returned to the custody of the Juvenile Detention Center on July 21,1981. He has remained there since that time.
On July 21, 1981, the State moved pursuant to Supreme Court Rule 302(b) (73 Ill. 2d R. 302(b)) to transfer to this court the appeal of the juvenile court’s denial of the State’s motion to prosecute Michael as an adult. The Rule 302(b) motion was denied on July 24, 1981.
In cause No. 55365, Loma Ortiz was charged with the armed robbery and murder on December 13, 1980, of Anthony Hopfner in a delinquency petition filed in the juvenile division of the circuit court of Cook County on December 16, 1980. At a hearing on the same date, the juvenile court found probable cause to believe that Loma was a delinquent minor and also found that her detention was a matter of immediate and urgent necessity. Loma was ordered detained in the Cook County Juvenile Detention Center.
The State filed a motion under section 2 — 7(3) to prosecute Loma, then 15, as an adult. After a hearing held on January 28 and 29, 1981, the juvenile court denied the State’s motion. On January 30, the State filed a notice of appeal from the juvenile court’s ruling. Loma remained in the custody of the Juvenile Detention Center.
On April 29, 1981, the juvenile court, apparently on its own motion, entered an order setting bail at $100,000. After a subsequent motion by Loma for her release from the Juvenile Detention Center, the juvenile court on May 11 reduced bail to $50,000. Loma was unable to post bail.
On June 18, 1981, Lorna again moved the juvenile court for release from the Juvenile Detention Center or for placement in a residential treatment facility, pursuant to section 7—3(3) of the Act. (Ill. Rev. Stat. 1979, ch. 37, par. 707—3(3).) The ground for the motion was the asserted statutory and Federal constitutional right of minors subject to the Juvenile Court Act to receive necessary care and treatment. After a hearing on the same date, the juvenile court ordered the State’s Attorney to file a neglect petition in Lorna’s interest, and also ordered the Department of Children and Family Services to find an appropriate placement for her, both within one week.
On June 25, the State filed a motion in this court for a stay of proceedings in the juvenile court, pending the disposition of the State’s motion to file a petition for a writ of mandamus and exercise of supervisory authority, filed the same day. This court granted the motion to stay further proceedings in the juvenile court, and on August 14, 1981, granted the State’s motion for leave to file for a writ of mandamus and exercise of supervisory authority. By order of August 18, 1981, we consolidated Loma’s case with that of Michael Davis for argument.
The State’s interlocutory appeal in Michael Davis’ case is currently in the briefing stage in the appellate court. In the appeal in Loma Ortiz’ case, the appellate court affirmed the denial of transfer in a Rule 23 order dated November 24, 1981 (1st Dist. No. 81 — 256). The State filed a petition for rehearing on December 4, 1981.
The Juvenile Court Act makes no provision either for interlocutory appeals or for bail. The issue presented by these cases is a consequence of this court’s holding, in People v. Martin (1977), 67 Ill. 2d 462, that the State may take an interlocutory, pre-adjudication appeal from a juvenile court’s order denying a motion to prosecute a minor as an adult. Prior to People v. Martin it had been held that rulings on transfer motions, not being final orders, were not appealable. (People v. Jiles (1969), 43 Ill. 2d 145; People v. Boclaire (1975), 33 Ill. App. 3d 534.) In People v. Taylor (1979), 76 Ill. 2d 289, this court reaffirmed the holding in Jiles that the minor has no right to an immediate appeal of an order permitting transfer to adult court. (76 Ill. 2d 289, 308.) Taylor also held that the appellate court’s role in reviewing transfer orders is to determine whether the juvenile judge has abused his discretion in evaluating the evidence in the’ light of the criteria set forth in section 2 — 7(3). (76 Ill. 2d 289, 301-02.) This standard had previously been applied by the appellate court in several cases, in view of this court’s holding in People v. Rahn (1974), 59 Ill. 2d 302, that the ultimate decision on transfer is a judicial one. See, e.g., In re Burns (1978), 67 Ill. App. 3d 361 (affirming denial of transfer).
In Martin this court recognized that delay of the adjudication — the fundamental purpose of the proceedings— would be the inevitable consequence of allowing such appeals. (67 Ill. 2d 462, 466.) In the cases before us, the juvenile court attempted to ameliorate one of the problems of delay by setting bail, so that the minors could obtain their release from custody during the foreseeably lengthy pendency of the interlocutory appeals, The issue for this court, therefore, is the propriety of the orders setting bail for Michael Davis and Loma Ortiz. We note that questions concerning the amount or conditions of bail are not before us; rather, the issue is whether the juvenile court had the authority to require the minors in these cases to post bail as a condition of their release from custody pending the decision of the State’s appeals.
The specific policy of the Juvenile Court Act favors leaving minors subject to the Act in the custody of their parents or in a family-like setting wherever possible, even after an adjudication of delinquency. (Sections 1—2(1) and 5-2 (Ill. Rev. Stat. 1979, ch. 37, pars. 701-2(1), 705-2).) Section 1—2(1) provides:
“(1) The purpose of this Act is to secure for each minor subject hereto such care and guidance, preferably in his own home, as will serve the moral, emotional, mental, and physical welfare of the minor and the best interest of the community; to preserve and strengthen the minor’s family ties whenever possible, removing him from the custody of his parents only when his welfare or safety or the protection of the public cannot be adequately safeguarded without removal; and, when the minor is removed from his own family, to secure for him custody, care and discipline as nearly as possible equivalent to that which should be given by his parents ***.” Ill. Rev. Stat. 1979, ch. 37, par. 701—2(1).
The Act as a whole evidences a legislative policy that detention of minors be limited. “Detention” is specifically defined as “the temporary care of a minor alleged or adjudicated as a person described in Section 2 — 2 [delinquent minor] who requires secure custody for his own or the community’s protection in physically restricting facilities pending disposition by the court ***.” (Emphasis added.) (Ill. Rev. Stat. 1979, ch. 37, par. 701—9.) Several sections of the Act place definite time limits on the period for which a minor may be held in detention, both prior to and after an adjudication of delinquency.
Section 3 — 5(4) provides that a minor taken into custody for allegedly committing a delinquent act may be detained for no more than 36 hours before being brought before a judicial officer for a detention hearing. Ill. Rev. Stat. 1979, ch. 37, par. 703-5(4).
Section 4 — 2 provides that when a petition has been filed alleging a minor to be delinquent or a minor in need of supervision, the juvenile court shall set the petition for hearing within 30 days of the date the petition was filed. If, however, the minor is being held in detention or “shelter care” (care in a physically nonrestricting setting, such as a foster family home or other facility (Ill. Rev. Stat. 1979, ch. 37, par. 701—17)), the petition must be set for adjudicatory hearing within 10 days of the date the minor was ordered held in detention or shelter care. The section provides that the State may move for postponement of the adjudicatory hearing, in cases where the minor is charged with a “crime of violence.” The court may grant the postponement “for good cause shown,” principally the unavailability of evidence or witnesses, but the postponement may be for no more than 20 days from the date of the court’s order directing detention or shelter care. Ill. Rev. Stat. 1979, ch. 37, par. 704-2.
Section 5 — 1(4) provides that if after the adjudicatory hearing the juvenile court continues the dispositional hearing, it may order either detention or release of a minor adjudicated delinquent, pending the decision on a suitable disposition; but “[i]n the event the court shall order detention hereunder, the period of the continuance shall not exceed 15 court days. At the end of such time, the court shall release the minor from detention.” The State is permitted under the section to move for a further continuance of the dispositional hearing and for continued detention, but the extension can be for no more than 15 additional court days, and at the end of the extended period “the court shall release the minor from detention if a further continuance is granted.” Ill. Rev. Stat. 1979, ch. 37, par. 705—1(4).
Under section 5 — 3(4), a minor on probation or conditional discharge after adjudication may be detained on a charge of violating the conditions of his release, but detention pending a hearing on the alleged violation is limited to 15 days. Ill. Rev. Stat. 1979, ch. 37, par. 705—3(4).
It is plain that detention is the exception, and release to a custodian who will provide appropriate care, guidance, discipline and protection is the rule under the Act. Accord, Doe v. State (Alaska 1971), 487 P.2d 47, 52-53; In re M. (1970), 3 Cal. 3d 16, 26, 473 P.2d 737, 743-44, 89 Cal. Rptr. 33, 39-40; Fulwood v. Stone (D.C. Cir. 1967), 394 F.2d 939, 943-44.
This court considered the meaning of section 4—2 in In re Armour (1974), 59 Ill. 2d 102. In that case a 17-year-old had been charged in a delinquency petition with attempted robbery and murder. The juvenile court ordered the minor released to his parents’ custody and set the adjudicatory hearing for a date 32 days from the date the delinquency petition was filed. There were numerous continuances of the hearing on motions by both sides and on the court’s own motion, and the hearing was not actually concluded until some six months later. (Since the minor had been released pending the hearing, the issue of detention did not arise.) The court found the minor delinquent and committed him to the Department of Corrections, Juvenile Division.
Armour appealed the adjudication of delinquency on the ground that the juvenile court lost jurisdiction over him by its failure to set the petition for hearing within 30 days, as required by section 4 — 2, and that he was therefore entitled to be discharged. The appellate court held that the juvenile court’s jurisdiction was not affected by its failure to comply exactly with the 30-day requirement. In re Armour (1973), 15 Ill. App. 3d 529.
This court affirmed, agreeing with the appellate court that the statutory requirement that the juvenile court “shall” set the petition for hearing within 30 days was directory, not jurisdictional. The court referred to the remedial aims of the Juvenile Court Act and concluded that the legislature did not intend that a minor not receiving an adjudicatory hearing within precisely 30 days “should be discharged or be abandoned, as it were, and that society’s effort to correct, to rehabilitate and to guide should come to a halt.” In re Armour (1974), 59 Ill. 2d 102, 105.
We conclude that section 4 — 2 establishes a maximum period of time that a minor can be detained pending judicial action on the merits of his case. Section 4 — 2 mandates not discharge, but release when the statutory period has been exceeded. This construction comports with the manifest legislative purpose to expedite proceedings in which minors are held in detention, and to prevent minors from being held in custody and separated from their families for lengthy and indefinite periods, pending action by the court. Sections 5—1(4) and 5 — 3(4) require the release from detention of minors who have been adjudicated delinquent if the court has not acted within a specified brief period. It would be incongruous to hold that minors who are merely alleged to be delinquent could be detained indefinitely.
We note that the appellate court has given this interpretation to section 4 — 2 and to parallel sections of the Act. (In re Armour (1973), 15 Ill. App. 3d 529; People v. Dean (1977), 52 Ill. App. 3d 383; In re Daniels (1976), 37 Ill. App. 3d 975.) Our conclusion is further supported by consideration of the commentary to section 4 — 2 by the Council on the Diagnosis and Evaluation of Criminal Defendants, which drafted section 4 — 2 in connection with the 1973 revision of the Juvenile Court Act and the enactment of the Unified Code of Corrections. It states:
“Former law was unclear whether the minor was to be released from custody or discharged if the hearing [sic] was not set for hearing within 10 days. This amendment clearly states that he will only be released from custody and not discharged.” Ill. Ann. Stat., ch. 37, par. 704—2, Council Commentary at 140 (Smith-Hurd Supp. 1981).
Michael Davis contends that under section 4 — 2 of the Juvenile Court Act, quoted above, a minor is entitled to be released from custody without bail if no adjudicatory hearing is held within the time prescribed by that section. We believe that this construction of the statute is the correct one.
Our conclusion that minors detained on a charge of delinquency must be released if no adjudicatory hearing has been held within the period prescribed in section 4 — 2 does not, however, dispose of the cases before us, as we do not believe section 4 — 2 was intended to apply in the circumstances of these cases. Section 4 — 2 was enacted in 1973, prior to People v. Martin (1977), 67 Ill. 2d 462, at a time when interlocutory appeals of transfer orders were not permitted. It is unreasonable to suppose that, had the General Assembly contemplated the possibility of such appeals, it would have required that they be completed within the maximum 30-day period provided in section 4 — 2. When the State is appealing the juvenile court’s denial of a motion to prosecute a minor as an adult, therefore, we hold that section 4 — 2 does not require the minor’s release without bail.
Where the State appeals the denial of a motion to transfer, there arises the possibility that the minor may be subjected to the consequences of prosecution and conviction as an adult offender. Had the juvenile court granted the motion to transfer, no one would doubt that the minors would be entitled to release upon the giving of security for their appearance at trial. We believe that under the circumstances of these cases, a minor should have at least the same rights as an adult accused of crime. Ill. Rev. Stat. 1979, ch. 37, par. 701—2(3)(a); In re Beasley (1977), 66 Ill. 2d 385, 391.
Article I, section 9, states: “All persons shall be bailable by sufficient sureties, except for capital offenses where the proof is evident or the presumption great.” (Emphasis added.) (Ill. Const. 1970, art. I, sec. 9.) The Constitution does not draw a distinction based on the age of the accused. (Trimble v. Stone (D.D.C. 1960), 187 F. Supp. 483, 486.) Since both juveniles here were under 18 years of age at the time the offenses were committed, neither can be sentenced to death, so the exception above relating to capital offenses is not applicable here (Ill. Rev. Stat. 1979, ch. 38, par. 9—1(b)). Moreover, the Juvenile Court Act, whose basic purpose is to provide juvenile offenders greater protection and solicitude than afforded by the adult criminal justice system, should not be interpreted as depriving minors of their constitutional rights. (State v. Franklin (1943), 202 La. 439, 443, 12 So. 2d 211, 213.) This court has held that juveniles have the same right to be released on bail pending an appeal of an adjudication of delinquency as adults have to release on bail pending appeal of a criminal conviction. In re Pulido (1978), 69 Ill. 2d 393.
The function of the trial court is to determine the amount of bail to be required and to accept the bond or recognizance of the person being admitted to bail. (People ex rel. Gendron v. Ingram (1966), 34 Ill. 2d 623, 625-26; Lewis v. People (1885), 18 Ill. App. 76, 77.) The court may take into account, in fixing the amount of bail, the character and criminal record, if any, of the accused, as well as the existence of a doubt as to his guilt and the probability of his appearing for trial. (In re McGarry (1942), 380 Ill. 359, 365; People ex rel. Sammons v. Snow (1930), 340 Ill. 464, 467.) But, “excessive bail is not to be required for the purpose of preventing the prisoner from being admitted to bail.” (People ex rel. Sammons v. Snow (1930), 340 Ill. 464, 467; People ex rel. Hemingway v. Elrod (1975), 60 Ill. 2d 74, 81.) Although preventive detention of an accused for the purpose of protecting the public is not contemplated by the Constitution, this court has approved the imposing of restrictive conditions on release as a means of “balanc[ing] the right of an accused to be free on bail against the right of the general public to receive reasonable, protective consideration by the courts.” People ex rel. Hemingway v. Elrod (1975), 60 Ill. 2d 74, 81.
We hold that the minors in these cases were entitled to be admitted to bail, and that the juvenile court therefore had authority to set bail in an appropriate amount, to release on recognizance, and/or to impose conditions on their release, as discussed in People ex rel. Hemingway v. Elrod (1975), 60 Ill. 2d 74. Our Rule 604 is applicable to interlocutory appeals by the State of orders denying transfer of minors to adult court. (People v. Martin (1977), 67 Ill. 2d 462.) We draw attention to subdivision (aX3) of that rule, which provides: “Release of Defendant Pending Appeal. A defendant shall not be held *** to bail during the pendency of an appeal by the State *** unless there are compelling reasons for his *** being held to bail.” (73 Ill. 2d R. 604(a)(3).) When the State is appealing a transfer order, therefore, it is incumbent on the State to show the “compelling reasons” that necessitate holding the minor to bail before bail can be required.
The case of Loma Ortiz presents a further issue. In May 1981, when Loma had been in the custody of the Juvenile Detention Center for approximately iVz months, she filed a motion in the juvenile court requesting placement in a facility where she could receive necessary educational services. Loma has a learning disability, dyslexia, that requires special training not available at the Juvenile Detention Center. The motion also averred, on the basis of the sworn testimony of a psychiatrist who examined Loma, that her extended stay in the Detention Center had become detrimental to her mental and emotional well-being, and that in Loma’s best interest she should be transferred to a residential treatment facility.
As grounds for the motion, Loma asserted a statutory right, as a minor subject to the Juvenile Court Act, to receive necessary care and services. (Ill. Rev. Stat. 1979, ch. 37, par. 701—2(3)(b).) She also asserted a right to treatment based on the eighth and fourteenth amendments to the Federal Constitution. Nelson v. Heyne (7th Cir. 1974), 491 F.2d 352; Collins v. Bensinger (N.D. Ill. 1974), 374 F. Supp. 273, affd (1974), 506 F.2d 1405.
In response to Loma’s motion, the juvenile court — apparently in the belief that it could not act to secure necessary educational services for Loma until she had been adjudicated a ward of the court — on June 18, 1981, ordered the State’s Attorney to file a neglect petition in Loma’s behalf, and ordered the Department of Children and Family Sevices to locate an appropriate placement for her. The statutory basis for the order directed to the State’s Attorney is section 4 — 1 of the Juvenile Court Act, which provides:
“(1) Any adult person, any agency or association by its representative may file, or the court on its own motion may direct the filing through the State’s Attorney of a petition in respect of a minor under this Act.” Ill. Rev. Stat. 1979, ch. 37, par. 704-1(1).
The State’s Attorney, in his petition for mandamus, contends that the juvenile court’s order was void, as the statutory section purporting to authorize the court to direct the State's Attorney to file a petition is an unconstitutional attempt to vest a court with power belonging exclusively to the executive branch, in violation of the constitutional principle of separation of powers. Ill. Const. 1970, art. II, sec. 1.
We find the State’s contention unpersuasive. The filing of a petition in respect of a minor under the Juvenile Court Act is not a matter within the exclusive executive discretion of the State’s Attorney. Any responsible adult having knowledge of the circumstances may file a petition under section 4 — 1 alleging a minor to be delinquent, dependent, neglected, or a minor in need of supervision. In addition, the Act authorizes probation officers to investigate and evaluate an allegation that a minor is delinquent, and to see to the filing of a petition where this is indicated. (Ill. Rev. Stat. 1979, ch. 37, par. 706—1(2)(a).) The aim of section 4 — 1 is to provide a number of avenues of access to the juvenile court for minors in need of its services. The petition is simply the means by which the juvenile court acquires official cognizance of the situation of the minor. (People v. Piccolo (1916), 275 Ill. 453, 455.) A person filing a petition is merely an “agent of the court in bringing the facts of the case to the attention of the court.” In re Brown (1904), 117 Ill. App. 332, 336.
The decision to file a petition, therefore, is not like the decision whether to initiate a criminal prosecution or what offense to charge, which are functions within the exclusive discretion of the State’s Attorney; and the cases to this effect, cited by the State, are inapposite. (People ex rel. Carey v. Cousins (1979), 77 Ill. 2d 531; People v. Ruiz (1979), 78 Ill. App. 3d 326; People v. Rotramel (1972), 5 Ill. App. 3d 196.) A petition under section 4 — 1 need not specify any proposed disposition of the minor; moreover, specific provision is made for two or more petitions being filed in respect of the same minor at the same time. (Ill. Rev. Stat. 1979, ch. 37, pars. 704—1(3), 704—1(6).) We hold that section 4—1’s authorization of the juvenile court to direct the filing of a petition in respect of a minor through the State’s Attorney does not authorize an impermissible exercise by the judicial branch of powers belonging exclusively to the executive, and does not violate article II, section 1, of the Illinois Constitution.
Since this case will be remanded, it is appropriate to note that it is not necessary that a petition be filed before the juvenile court can act to secure necessary care, treatment and services for a minor held in custody under the Act. Section 3 — 6(2) authorizes the court at the detention hearing to “enter such *** orders related to the temporary custody as it deems fit and proper,” and generally to order appropriate placement of a minor who has been taken into custody on a charge of delinquency. (Ill. Rev. Stat. 1979, ch. 37, par. 703—6(2).) The placement chosen by the juvenile court should, of course, be that which, in the court's judgment, will “serve the moral, emotional, mental, and physical welfare of the minor” and secure the minor’s “right to services necessary to his proper development, including health, education and social services.” Ill. Rev. Stat. 1979, ch. 37, pars. 701-2(1), 701-2(3)(b).
Under section 7 — 3(3), the juvenile court can order a minor subject to the Act placed in a hospital, institution or agency for treatment or special care “when the health or condition of [the minor] requires it.” (Ill. Rev. Stat. 1979, ch. 37, par. 707—(3).) The section extends to minors who are in the custody of juvenile authorities and is not limited to minors who have been adjudicated wards of the court, or in respect to whom a petition has been filed, and section 3 — 7 (authorizing the court to consent to medical and dental treatment of the minor “[a]t all times during temporary custody, detention or shelter care” (Ill. Rev. Stat. 1979, ch. 37, par. 703—7)) indicates that it was not intended to be so limited. The question of what care, services and treatment are necessary and appropriate is for the juvenile court to determine in the first instance. However, we agree that a different and higher standard of care is required for juveniles held in custody than for adult detainees, both by the Juvenile Court Act and by the Federal Constitution. Swansey v. Elrod (N.D. Ill. 1975), 386 F. Supp. 1138, 1143; Nelson v. Heyne (7th Cir. 1974), 491 F.2d 352, 358-60.
Summarizing our disposition of these cases, we hold that minors detained on a charge of delinquency have the right to bail when the State appeals an order of the juvenile court denying a motion to prosecute them as adults. The juvenile court therefore had authority to set bail for the minors in these cases. Michael Davis’ petition requesting the issuance of a writ of mandamus to compel the juvenile court to vacate its bail order of April 29, 1981, and for habeas corpus, must therefore be denied. The juvenile court’s order of June 12 releasing Michael without bail was vacated by this court’s order of July 20, 1981; consequently the State’s petition that mandamus issue to vacate that order is denied. Cause No. 55050 is remanded to the juvenile court for further proceedings consistent with this opinion.
Since we hold that the juvenile court had authority to order the State’s Attorney to file a petition under section 4 — 1 in behalf of Loma Ortiz, the petition of the State’s Attorney for a writ of mandamus is denied. Cause No. 55365 is remanded for further proceedings consistent with this opinion.
55050 — Writs denied; cause remanded.
55365 — Writ denied; cause remanded.