
103 Cal.Rptr.2d 794 (2001)
86 Cal.App.4th 1061
In re FRANCISCO M, a Minor, on Habeas Corpus.
In re Jesus G, a Minor, on Habeas Corpus.
Nos. B146747, B146905.
Court of Appeal, Second District, Division Five.
January 31, 2001.
*797 Bruce A. Hoffman, Alternate Public Defender, Cynthia Kairys and Richard L. Sternfield, Deputy Alternate Public Defenders, for Petitioner Francisco M.
Law Offices of Luis A. Carrillo and Luis A. Carrillo, Montebello, for Petitioner Jesus G.
Consul of Protection and Human Rights and Fernando Herrera Rodriguez for Consulate General of Mexico as Amicus Curiae on behalf of Petitioner Jesus G.
No appearance on behalf of Respondent Superior Court.
Steve Cooley, District Attorney, George M. Palmer, Head Deputy District Attorney, and Juliet Schmidt, Deputy District Attorney, for Real Party in Interest.
WILLHITE, J.[*]
The law has long recognized that "[t]he duty to disclose knowledge of crime rests upon all citizens. It is so vital that one known to be innocent may be detained, in the absence of bail, as a material witness." (Stein v. New York (1953) 346 U.S. 156, 184, 73 S.Ct. 1077, 97 L.Ed. 1522, fn. omitted; see Barry v. United States ex rel. Cunningham (1929) 279 U.S. 597, 616-618, 49 S.Ct. 452, 73 L.Ed. 867.) In California, as applicable to witnesses deemed material for trial, this principle is embodied in Penal Code section 1332.[1] Under that section, on an appropriate sworn showing, a trial court may detain a material witness when it finds good cause to believe that the witness will not attend the trial and testify. However, the statute does not confer unfettered discretion to incarcerate a material witness. In article I, section 10, the California Constitution states in relevant part that "[witnesses may not be unreasonably detained."
In this case we consider petitions for writ of habeas corpus filed by two minors, declared material witnesses and detained under section 1332 in a special circumstance murder prosecution. They allege, among other things, that their detention violates their constitutional right under article I, section 10, not to be unreasonably detained. We will deny the petitions insofar as they demand immediate release. However, we will order the superior court to conduct hearings, forthwith, as to whether petitioners should remain in custody *798 in lieu of security, and to conduct those proceedings consistent with the views expressed in this opinion.

PROCEDURAL AND FACTUAL BACKGROUND
Petitioners Francisco M. (age 17) and Jesus G. (age 15)[2] have been declared material witnesses in the pending criminal prosecution of defendant Alfonso Aranda. Petitioner Francisco M. has been detained since November 22, 2000, a period of approximately ten weeks; petitioner Jesus G., since December 8, 2000, approximately eight weeks. Both have been required to post security of $100,000. After their detentions, the trial date was continued because counsel for defendant Aranda became medically unfit for trial. The trial is now scheduled to begin February 6, 2001, pending the medical fitness of defense counsel.
In the underlying prosecution, Aranda is charged by information with the murder of Israel Monge Reynoso (§ 187), and the attempted willful, deliberate murder of petitioner Francisco M. (§§ 664/187). The information alleges the special circumstance of murder by discharging a firearm from a motor vehicle (§ 190.2, subd. (a)(21)), and various enhancement allegations. The People theorize that that the killing and attempted murder resulted from a feud between two rival gangs, EL A 13 (to which the murder victim and both petitioners belong), and Breed Street (to which defendant Aranda belongs).
We summarize the series of events leading to our consideration of the habeas corpus petitions.

A. Detention of Petitioner Francisco M.
The People subpoenaed petitioner Francisco M. as a witness for the preliminary hearing of May 8, 2000. Although he appeared in court, he did so only under compulsion, having told police detectives assigned to the case that he would have to be dragged to court. The prosecution presented him in court handcuffed. Before being sworn as a witness, he informed the magistrate, "I ain't testifying for nothing." After being sworn, when asked by the prosecutor if he would make a solemn promise not to flee if the handcuffs were removed, he replied, "I make no promises." Finding that Francisco M. would not testify without being restrained, the magistrate ordered that he remain handcuffed during his testimony.
Francisco M. initially disclaimed any belief that he would be harmed if he testified. However, he later admitted that he had been labeled a "snitch" on the street, and that snitches get "handled," or "taken out." With considerable prodding by the prosecutor, he testified that he was a passenger in a car driven by Israel Reynoso when Reynoso was shot, and he described his observations of the killing.[3] He admitted telling the police that the gunman was Beaver, a member of the rival Breed Street gang. However, in court he testified that the defendant Aranda was not the shooter. Further, he testified that although he had selected Aranda's photograph, the police had pointed it out to him. He also denied identifying the driver of the car as Solo.
The prosecution impeached Francisco M. through testimony from the investigating officer, Detective Freddie Arroyo, who had surreptitiously tape recorded an interview with Francisco M. on June 24, 1999. In that interview, Francisco M. had named *799 as the shooter a Breed Street gang member, Beaver, who lived on Ficket Street. He had also selected defendant Aranda's photograph from a lineup as that of the shooter. Further, he had also named Solo as the driver of the car.
After the preliminary hearing, the magistrate held defendant Aranda to answer for the murder of Reynoso, and attempted murder of Francisco M. The superior court held various pretrial proceedings, ultimately setting the case for December 13, 2000, as day 5 of 10 for trial.
With the trial date approaching, the People filed an ex parte motion requesting the detention of petitioner Francisco M. as a material witness.
Filed November 21, the motion contained a declaration by Detective Arroyo which briefly described the crime and Francisco M.'s presence in the murder victim's car. It further stated that when detectives had arrived at Francisco M.'s residence to transport him to the preliminary hearing, he fled out the rear door. The detectives had found him at his girlfriend's house.[4] They transported him to the District Attorney's Office, where Francisco M. told Detective Arroyo he would not go to court, would not testify, and was afraid of "something" happening. The detective handcuffed Francisco M, and escorted him to court. After testifying at the preliminary hearing, Francisco M. expressed a fear of being killed if he testified. He said that if subpoenaed he would not come to court, and the police would have to find him.[5]
Based on Detective Arroyo's declaration, the superior court granted the ex parte motion. The court authorized a subpoena forthwith for Francisco M, and ordered that he be brought to court immediately. The next day, November 22, the prosecution produced Francisco M. in court, in custody. The court appointed counsel, and held a hearing in which counsel for Francisco M. moved to have Francisco M. released on his promise to appear, or in the alternative to set bail. The court denied the requests, tentatively ruling that it had no power to set bail for a minor. The court remanded Francisco M. without bail, but set the matter for review. After the appointment of new counsel, the matter was heard on November 28. On that date, the court deemed the proceeding to be a hearing on whether to detain Francisco M. under section 1332 as a material witness pending trial. Based on the declaration in support of the motion, the court found that Francisco M. fell within the provisions of section 1332, subdivision (a). Counsel for Francisco M. argued that the court must first order Francisco M. to enter a written undertaking promising to appear and testify. Only if he refused to enter such an agreement could the court commit him to custody in lieu of bail. The People argued that Francisco M. was not entitled to bail. The court ruled that it would set bail for the parents (Francisco M. being a minor) to post on his behalf. After hearing argument, the court set bail at $100,000, and remanded Francisco M. into custody.
As required by section 1332, subdivision (c), the commitment order was reviewed by another judge two days later, November 30. In that proceeding, the judge permitted Francisco M. to address the court. Under oath, Francisco M. said that he would return to court as ordered, and was willing to submit to house arrest. Weighing Francisco M.'s statement in light of his past behavior, the court denied the request for a release on his own recognizance or a reduction in bail. At the statutory ten-day review (§ 1332, subd. (d)) on December 11, the court likewise upheld the commitment order, finding no significant change in circumstances.


*800 B. Detention of Petitioner Jesus G.
On December 7, 2000, the People filed an ex parte motion seeking the detention of petitioner Jesus G. under section 1332. The motion was filed in the same court that had considered the Francisco M. motion, and was supported by a declaration from Detective Arroyo. The declaration stated that Jesus G., an ELA 13 gang member, had spoken to a police officer 45 minutes after the shooting, and had described his observations of the shooting.[6] Within days of the killing, Jesus G. had fled to Mexico, and was unwilling to come back to be interviewed. His mother would not disclose his precise whereabouts. The declaration further stated that on December 6, 2000, Detective Arroyo had located Jesus G. in Calexico. Although he had tried to contact his family, they were uncooperative. The detective had learned that family members of the defendant, themselves gang members, had tried to solicit the killing of witnesses who were cooperating with law enforcement in this case. He stated his belief that Jesus G. would not respond to a subpoena, and would flee to Mexico.
Based on Detective Arroyo's declaration, the court ordered the issuance of a subpoena forthwith for Jesus G. The court further ordered that the witness be brought to court immediately or on the next court day after his detention for a hearing on bail.
It appears that on December 8, 2000, Calexico police located Jesus G. That day Detective Arroyo transported him to Los Angeles. Late that evening, the prosecutor and Detective Arroyo interviewed him at the Hollywood Police Station. In the interview, Jesus G. stated that he had been "jumped into" the ELA 13 gang at age 14. After the shooting in the present case, he told his mother that he had spoken to the police. Two or three weeks later, she sent him to Mexico. He had lived there three to four weeks, then returned to Calexico. Under questioning by the prosecutor, Jesus G. described his observations of the shooting, although the description of his vantage point varied from his earlier statements. Jesus G. was initially equivocal when asked if he would appear in court. However, when pressed by the prosecutor, he expressed an unwillingness to appear and testify. He stated that if subpoenaed to court, he would not appear, for fear that the defendant's friends would kill him leaving court, or harm his family.[7]
On the next court day, December 11, the superior court held proceedings under section 1332 with respect to the detention of Jesus G. Jesus G. was present in court, represented by counsel. The court declared him a material witness, and set bail at $100,000.

C. Proceedings as to Both Petitioners
During these proceedings, the trial date in the underlying prosecution of defendant Aranda remained December 13 as day 5 of 10, making the last day for trial December 18. On December 18, the trial date was vacated. The next day, December 19, counsel for defendant Aranda moved for a continuance of the trial to February 6, *801 2001. Her declaration attached to her motion, supplemented by a doctor's letter, established that she was medically unfit to go to trial. She would not be available to work until February 1, and would not able to try the case until February 6. Over the People's objection, the court granted a continuance of the trial to February 6.
On December 21, proceedings as to both witnesses were held before the third judge to consider the matters. The court ordered the required bail amount to stand for both witnesses.
On January 2, 2001, the court held separate reviews of the custodial status of both petitioners. Counsel for Jesus G. represented that his client would submit to house arrest, although the cost might be prohibitive. The court asked if there had been any change in circumstance. Counsel stated that the witness's mother had presented him with a list of relatives with whom the witness could reside in the Los Angeles area pending the trial. Concerned that the witness's father and grandmother resided in Mexicali, the court found no material change in circumstances, and denied the request for release or a reduction in bail.
In the proceeding concerning petitioner Francisco M., counsel argued that the detention of his client to and beyond the new trial date of February 6 would be a violation of article I, section 10 of the California Constitution. The court found no change in circumstance, and denied the request for release or a reduction in bail.
On January 4, at the request of counsel for Jesus G, the court heard the Jesus G. matter again. Counsel represented that an unnamed benefactor, whose attorney was present in court, would finance electronic monitoring. The court stated that it viewed the relevant issue to be whether the witness would appear and whether security should be required. Jesus G.'s counsel asked the court to hear from his client. At the People's request, the court and counsel viewed in camera a video tape of Jesus G.'s interview on December 8, 2000. Thereafter, the hearing became heated. The subject of petitioner's addressing the court was not mentioned again. The court declined to modify the earlier order setting bail.
Jesus G. had filed a petition for writ of habeas corpus in the superior court, which was denied on December 22, 2000. On January 5, 2001, he filed a habeas corpus petition in this court. Francisco M. had filed a habeas corpus petition in this court on December 23, 2000. The People filed a combined informal response to both petitions. On January 19, 2001, this court issued an order to show cause "why this court should not order petitioners' immediate release or, in the alternative, why this court should not order that petitioners be examined conditionally, pursuant to Penal Code section 1336, subdivisions (a) and (b)." The People filed a return.
On January 22, 2001, before oral argument in this court, the superior court held further proceedings in the case, in which counsel for defendant Aranda represented that while still under a doctor's care, she intends to be ready for trial on February 6, assuming she is medically able.

DISCUSSION
Both petitioners argue that their continued detention under section 1332 violates article I, section 10 of the California Constitution. Their claims bring into focus issues largely ignored by California decisional law, issues framed by the tension between the state's right to compel a material witness to appear and testify, and a witness's right to be free from unreasonable restraint. We conclude that section 1332 is constitutional, but impose certain commonsense procedural safeguards to ensure that the interests of the state and the witness may be adequately heard and protected. We will remand the matter to the superior court to hold proceedings in accordance with the views expressed in this opinion.


*802 A. Facial Constitutionality of Section 1332
Petitioner Jesus G. contends that on its face, section 1332 violates article I, section 10 of the California Constitution, in so far as it permits the incarceration of material witnesses in lieu of bail.[8] However, we see nothing in section 1332 that runs afoul of our state Constitution.
The government's authority to arrest and imprison material witnesses was "the long established rule in English Law, in effect when the United States became a nation." (Bacon v. United States (9th Cir. 1971) 449 F.2d 933, 938-939.) The power developed as a necessary corollary to the establishment of compulsory process for the attendance of witnesses. (See Blair v. United States (1919) 250 U.S. 273, 279-280, 39 S.Ct. 468, 63 L.Ed. 979; see also Barry v. United States ex rel. Cunningham (1929) 279 U.S. 597, 617, 49 S.Ct. 452, 73 L.Ed. 867.) "[I]t is clearly recognized that the giving of testimony and the attendance upon court or grand jury in order to testify are public duties which every person within the jurisdiction of the Government is bound to perform upon being properly summoned...." (Blair v. United States, supra, 250 U.S. at p. 281, 39 S.Ct. 468.) Thus, "where suspicions exist that a witness may disappear, or be spirited away, before trial, in criminal cases, ... he may be held to bail to appear at the trial and may be committed on failure to furnish it...." (Barry v. United States ex rel. Cunningham, supra, 279 U.S. at p. 618, 49 S.Ct. 452.)
Material witness statutes are common among the states. Many, like California's, permit the incarceration of the witness if he either refuses or is unable to post bond as set by the court. (See Burke, New Jersey's New Material Witness Statute: Balancing the Rights of Prosecutors, Defendants, and Material Witnesses in Criminal Cases (1995) 19 Seton Hall Legis. J. 475 & fn. 2.) The federal government, too, has such a statute. (18 U.S.C. § 3144.)[9] Also, under the Uniform Act to Secure the Attendance of Witnesses From Without the State in Criminal Proceedings, a court may take a witness into custody and deliver him to representatives of the requesting state. (§ 1334.2.)
The general validity of material witness statutes under the federal constitution has long been accepted. (Hurtado v. United States (1973) 410 U.S. 578, 588, fn. 9, 93 S.Ct. 1157, 35 L.Ed.2d 508.) The Uniform Act has received constitutional approval from both the United States Supreme Court (New York v. O'Neill (1959) 359 U.S. 1, 8-12, 79 S.Ct. 564, 3 L.Ed.2d 585), and the California Supreme Court (Vannier v. Superior Court (1982) 32 Cal.3d 163, 170-173, 185 Cal.Rptr. 427, 650 P.2d 302). This is not to say that material witness statutes have enjoyed unanimous acclaim in their application. (See, e.g., State v. Misik (1989) 238 N.J.Super. 367, 569 A.2d 894 [imposing procedural safeguards on former New Jersey statute]; Application of Cochran (D.Neb.1977) 434 F.Supp. 1207 [prescribing procedures to be followed under former Nebraska statute]; United States v. *803 Linton (Nev.1980) 502 F.Supp. 878, 879 [ordering deposition and release of witness confined for two months]; People v. Warden of City Prison (N.Y.App.Div.1950), 277 A.D. 87, 98 N.Y.S.2d 173, 176 [ordering release of witness on posting of reduced bail]; Ex Parte Grzyeskowiak (1934) 267 Mich. 697, 255 N.W. 359 [ordering release of witness held four months]; compare People v. Sheriff of City of New York (N.Y.App.Div.1950) 277 A.D. 546, 101 N.Y.S.2d 271 [denying release of witness, himself suspected of crime, after 11-week detention].) Nonetheless, a witness' right under our state constitution not to be unreasonably detained does "not include a right to refuse to be a witness in judicial proceedings within the state." (Vannier v. Superior Court, supra, 32 Cal.3d at p. 171, 185 Cal.Rptr. 427, 650 P.2d 302.) Since section 1332 may be applied fairly, with adequate procedural safeguards, we see no reason to declare the statute unconstitutional on its face. (Vannier, at pp. 171-172, 185 Cal.Rptr. 427, 650 P.2d 302.)

B. Statutory Procedure
Petitioner Francisco M. contends that section 1332 requires the court to formally seek from the witness a written undertaking promising to appear. Without doing so, the court cannot set a bail and detain the witness. While we agree that the court must provide the opportunity for the witness to be heard concerning the circumstances of his proposed detention, that opportunity need not include a formal request from the court to enter a written undertaking.
The steps prescribed by section 1332 are straightforward. Subdivision (a) of section 1332 provides in relevant part that "when the court is satisfied, by proof on oath, that there is good cause to believe that any material witness for the prosecution or defense, whether the witness is an adult or a minor, will not appear and testify unless security is required, at any proceeding in connection with any criminal prosecution ... the court may order the witness to enter into a written undertaking to the effect that he or she will appear and testify at the time and place ordered by the court or that he or she will forfeit an amount the court deems proper." If the witness enters "into an undertaking to appear, upon his or her failure to do so the undertaking is forfeited in the same manner as undertakings of bail." (§ 1332, subd. (e).)
However, "[i]f the witness required to enter into an undertaking to appear and testify, either with or without sureties, refuses compliance with the order for that purpose, the court may commit the witness, if an adult, to the custody of the sheriff, and if a minor, to the custody of the probation officer or other appropriate agency, until the witness complies or is legally discharged." (§ 1332, subd. (b).) No more than two days later the detained witness "is entitled to an automatic review of the order requiring a written undertaking and the order committing the person, by a judge or magistrate having jurisdiction over the offense other than the one who issued the order." (§ 1332, subd. (c).) If the reviewing judge finds "that the witness must remain in custody, the witness is entitled to a review of that order after 10 days." (§ 1332, subd. (d).)
When interpreting a statute, the fundamental goal is to determine the intent of the legislature. (People v. Woodhead (1987) 43 Cal.3d 1002, 1007, 239 Cal. Rptr. 656, 741 P.2d 154; People v. Superior Court (Jans) (1990) 224 Cal.App.3d 1405, 1408, 274 Cal.Rptr. 586.) If the language of the statute is clear and unambiguous, the court need not engage in statutory construction. (Delaney v. Superior Court (1990) 50 Cal.3d 785, 798, 268 Cal. Rptr. 753, 789 P.2d 934; People v. Woodhead, supra, 43 Cal.3d at pp. 1007-1008, 239 Cal.Rptr. 656, 741 P.2d 154.) As to the authority of the court to detain a material witness, the language of section 1332 needs little explanation. On a proper showing under oath that the witness will not appear unless security is required, the court is empowered to do the following: *804 (1) require the witness to submit a written undertaking in which he promises to appear and testify, and further promises to forfeit the required security should he fail to appear; (2) set a reasonable bail amount as the required security; and (3) detain the witness if he refuses to enter such an undertaking.
Petitioner Francisco M. appears to contend that a "refusal" to comply with an order to enter the undertaking must follow a formal, on-the-record inquiry from the court. While this procedure may be pursued, it is not required. Whenever a person is remanded to custody in lieu of bail, he is implicitly ordered, should he desire his release, to submit a written undertaking in which he promises to appear or to forfeit the bail amount that must be posted. No express, on-the-record exchange between the court and the witness is required on that point. The witness' refusal to enter the undertaking, whether from of obstinacy or inadequate resources, is implicit from the failure to post the bail.
We do not mean to suggest that the court need not hear from the witness at all. As will be discussed below, the opportunity for the witness to be heard is an important aspect of the procedure to be followed under the statute. We mean only that the court need not formally seek a written undertaking as a necessary condition precedent to committing the witness in lieu of security.
Petitioner Jesus G. has repeatedly noted in his filing in this court, and in his oral argument, that his client was never subpoenaed. However, while a witness' prior disobedience to a subpoena may be an important factor in determining whether the witness is likely to appear at trial, it is not a prerequisite to invoking section 1332. Evidence that the witness is avoiding service, or other evidence that he will not appear if served, may supply "good cause to believe that [the] material witness ... will not appear and testify unless security is required." (§ 1332, subd. (a).) Service of a subpoena is the preferred method for obtaining a witness' attendance. However, section 1332 is available in the unusual case where typical compulsory process is inadequate.

C. Considerations Under the State Constitution
As previously noted, article I, section 10 of the California Constitution states in relevant part, "Witnesses may not be unreasonably detained." There is no authoritative interpretation of this provision in California law. In Ex Parte Dressier (1885) 67 Cal. 257, 7 P. 645, a one-paragraph opinion, the Supreme Court ordered the release of a witness under former article I, section 6, a predecessor of current article I, section 10. The court simply reasoned: "It appears that the witness has been detained ... for ninety days, and there have been several continuances in the case which are not satisfactorily accounted for." (Ex Parte Dressier, at p. 257, 7 P. 645.) In Vannier v. Superior Court, supra, 32 Cal.3d 163, 185 Cal. Rptr. 427, 650 P.2d 302, the California Supreme Court made fleeting reference to article I, section 10, in upholding the Uniform Act against a challenge that it violates a witness' liberty interests under the state Constitution. The court stated in relevant part: "A judicial system with power to compel attendance of witnesses is essential to effective protection of the inalienable rights guaranteed by [article I, section 1 of the California Constitution]. Our Constitution has provided for witness rights and duties in other specific provisions (art. I, §§ 2, subd. (b), 4, 10, 13, 15), and a restriction on the inalienable rights of article I, section 1 is the obligation to attend and give testimony." (Vannier, at p. 171, 185 Cal.Rptr. 427, 650 P.2d 302.)
The only other relevant California decision we have found is In re Jesus B. (1977) 75 Cal.App.3d 444, 142 Cal.Rptr. 197, to which the parties have cited us. In Jesus B., the Court of Appeal considered whether a minor had been deprived of due process by the People's failure to produce a *805 material witness at a rehearing before a juvenile court judge. The minor argued that the People should have sought incarceration of the witness under Penal Code sections 879, 881, and 882. In response the court stated: "We note in passing ... that in light of the provisions of article I, section 10, of the California Constitution, which provides in pertinent part that `[witnesses may not be unreasonably detained,' there is grave doubt an alien witness could constitutionally be held 18 days (the time between the release of Rangel [the witness] and the jurisdictional hearing) and certainly not as long as two months under these sections. In any event, because of the draconian nature of this procedure, we hold the police or prosecution do not have to invoke it in order to avoid the dismissal of an action for failure to make a witness available at trial." (Id. at pp. 451-452, 142 Cal.Rptr. 197.)
None of these authorities is particularly helpful. While the decision in Ex Parte Dressier demonstrates that prolonged incarceration because of unsupported continuances will violate the state constitution, it contains no analysis. The recognition in Vannier that a witness has no right to refuse to attend court and testify does not suggest what, if any, are the specific limitations on a court's power to detain a witness. Similarly, the "passing" mention of the point in Jesus B. is hardly an authoritative discussionunderstandably so, since the court was not deciding whether the continued incarceration of a witness was unconstitutional, but simply whether fundamental fairness required the prosecution to seek a witness's detention under section 881.[10]
We believe that an analysis of the purpose of section 1332, informed by common sense concerns implicated by the witness' right to be free from unreasonable restraint, suggests the proper procedure and substance of a section 1332 proceeding. A material witness is subject to detention not because he is suspected of a crime, but because he has knowledge of a crime, and because there is adequate doubt whether he will attend the trial. As we have noted, the historical underpinnings of the power to detain material witnesses rest on the long-recognized duty of citizens to testify if summoned. The power to detain is exercised not to punish the witness for his recalcitrance, but to secure his attendance. The goal is the presentation at trial of the material knowledge possessed by the witness. The unique posture of the material witness counsels special concern that the procedures leading to the determination whether he should be detained are fair. Certainly the witness' right under article I, section 10, not to be "unreasonably detained," requires procedural safeguards allowing the interests of the witness to be heard in conjunction with the interests of the state. Further, the question whether and how long to detain a witness consistent with this right cannot be determined according to mechanical rules. As with the scope of other constitutional provisions, the decision must be based on all the relevant circumstances of the particular case.
By its terms, section 1332, subdivision (a) clearly contemplates an initial hearing at which the witness is entitled to notice of the basis on which his detention is sought. This is the "proof on oath, that there is good cause to believe" that he is material, and will not appear and testify unless security is required. (§ 1332, subd. (a).) At this hearing, as the courts in the instant case recognized, the witness should have counsel, either retained or appointed. Further, he is entitled to controvert the allegations seeking his detention, and to be heard on all relevant issues, including whether he will agree to return if released and whether other alternatives to incarceration in lieu of security are feasible and adequate. On all relevant issues he is *806 entitled to present evidence on his behalf. We do not mean to imply that the hearing must take on the formal aspects of a trial, with the calling of witnesses and full cross-examination. The trial court retains discretion to limit the form and manner of proof as appropriate to the individual case. (See Vannier v. Superior Court, supra, 32 Cal.3d at pp. 172-173, 185 Cal.Rptr. 427, 650 P.2d 302 [given temporary nature of restriction on liberty imposed by Uniform Act, affidavit procedure does not violate state constitutional rights of witnesses].)
In considering whether to "order the witness to enter a written undertaking to the effect that he or she will appear and testify ... or ... forfeit an amount the court deems proper" (§ 1332, subd. (a)), the court should consider all the relevant circumstances implicated by the interests of the various partiesthe prosecution, the defendant in the underlying criminal case, and the witness. We do not purport to catalogue all the factors that may be considered. They may be as varied as the facts of any particular case permit. Nonetheless, the circumstances of the instant case certainly suggest the following.
(1) The nature of the charges in the underlying criminal prosecution. The more serious the charges, the weightier the state's interest in ensuring the witness' attendance.
(2) The nature of the witness' proposed testimony. We recognize that to conduct the hearing at all, the court will have already found, based on the state's sworn representations, that the witness is material. We also recognize that when conducting the hearing, the court generally will not have detailed knowledge of all the proposed evidence in the case. Nonetheless, not all material witnesses are equally "material." To the extent possible, the court should consider the importance of the individual witness to the prosecution case. (See People v. Cavanaugh (1968) 69 Cal.2d 262, 269-271, 70 Cal.Rptr. 438, 444 P.2d 110 [cumulative nature of witness' testimony is a relevant consideration under Uniform Act].)[11]
(3) The length of the proposed detention. It is true that a "[detention is not unreasonable ... merely because it may be prolonged." (People v. Sheriff of City of New York, supra, 101 N.Y.S.2d at p. 275.) However, the longer the expected detention, the greater the showing required by the state to justify it. The duration of the detentions in the instant case are substantial, and require an equally substantial justification.
(4) Evidence relevant to whether the witness will or will not appear and testify. Such considerations may include employment, residence, and other community ties. It may also include the witness' prior statements and conduct. The witness himself has the right to address the court, should he so desire.
(5) The age and maturity of the witness. Detention of a minor witness requires greater scrutiny than that of an adult. Of course, age cannot be viewed isolated from the minor's life experience. For instance, the witness' prior experience with the criminal justice system may be considered, as well as other aspects of his background.
(6) The harm to the witness and his family flowing from incarceration. If the witness is employed, he will suffer lost wages. If he regularly attends school, he will miss his usual classes. If he is infirm, he may not receive adequate care. There are perhaps countless ways incarceration may affect the witness. The purpose of detention is not to punish for a prior unwillingness to cooperate, though certainly the extent of unwillingness is an appropriate factor to consider, but to ensure that the witness will be present at trial. Punishment of the witness not being a factor, *807 the prejudice to the witness and his family must be considered.
(7) The witness' financial resources. Should security be required, the amount must be reasonable, calculated to secure the witness' appearance at trial. In making that determination, all the relevant circumstances must be considered, including the witness' financial resources.
(8) The circumstances of any continuance of the underlying prosecution that will prolong the incarceration. Under this factor, the court may consider which party requested the continuance, and the reason for the continuance. As indicated by Ex Parte Dressier, supra, prolonging a detention by a continuance of the trial without adequate cause might in itself violate article I, section 10 of the California Constitution.
(9) Whether steps short of incarceration are feasible and adequate to protect the interests of the prosecution, the witness, and the defendant in the underlying prosecution. Steps short of incarceration may include electronic monitoring, to be financed and arranged by the witness to the satisfaction of the court.[12] If the witness's security is threatened, the prosecution may be able to arrange protective custody. Further, the court may consider whether circumstances exist in which a conditional examination may be held under Penal Code section 1335 et seq.[13] It may well be that, because of currently existing rules, resorting to a conditional examination will prove problematic. There must first be an adequate showing justifying a conditional examination under sections 1335 and 1336. Also, in many instances, a detained material witness can be expected in his testimony to recant earlier statements allegedly given to law enforcement. If a conditional examination is conducted, only the witness would testify. With respect to use of the conditional examination at trial, the witness would be a hearsay declarant. If the witness, upon being confronted with the prior inconsistent statements at the conditional examination, adopted and reaffirmed them, the jury at the trial could consider the statements for their truth. (People v. Cudjo (1993) 6 Cal.4th 585, 616, 25 Cal. Rptr.2d 390, 863 P.2d 635.) However, if the witness denied the prior statements, any such statements later introduced at trial could be considered only as relevant to impeach the witness as a hearsay declarant. (Evid.Code, § 1202.) The statements could not be used to prove the truth of the matter asserted in the statements. (People v. Williams (1976) 16 Cal.3d 663, 668-669, 128 Cal.Rptr. 888, 547 P.2d 1000; People v. Hitchings (1997) 59 Cal.App.4th 915, 921-922, 69 Cal.Rptr.2d 484.) Since the inconsistent statements could not be considered to prove the guilt or innocence of the accused, use of a conditional examination may be inadequate to serve the interests of justice. The problem might be resolved if the Legislature were to amend the Evidence Code to permit a detained witness' prior inconsistent statements to be considered for their truth at trial, assuming the witness was properly confronted with them at the conditional examination under Evidence Code section 770, subdivision (a).[14]
*808 While not exclusive, the foregoing factors provide a foundation for the court's exercise of discretion in determining whether to require the witness to post security to secure his attendance at trial, and if so, the amount of security to be required. Further, at the two-day review under subdivision (c) of section 1332, and the ten-day review under subdivision (d) of section 1332, the court should consider any relevant change in circumstances in determining whether to continue the detention, including whether the witness credibly has changed his attitude toward appearing at trial, or toward accepting a lesser, feasible alternative to custody. Also, as the lower court in this case has recognized, section 1332, subdivision (d) must be construed to provide a review every ten days.

D. The Resolution of the Petitions
Viewing the entire record, the current posture of the case does not warrant this court's ordering the immediate release of the petitioners. The proceedings below have not been conducted in literal accord with the views of this opinion. We cannot expect such prescience by the lower court. However, the various judges involved have made reasonable attempts to apply section 1332 to a difficult case. In oral argument before this court, counsel for petitioner Jesus G. suggested remanding the matter to the superior court to conduct a hearing at which his client may be heard. We will adopt that suggestion. Both petitioners are entitled to a prompt hearing in accordance with the appropriate procedures and considerations as now established. We note, for instance, that other than the proceeding on November 30, 2000, when petitioner Francisco M. addressed the court, no court has heard from the petitioners themselves. What they will say, should they wish to speak, is not for us to determine. But they are entitled to be heard. The appellate court is not the proper forum to resolve all the various factors that must inform the decision whether to continue to detain petitioners in lieu of bail, or whether to reduce or eliminate the requirement of posting bail altogether.

DISPOSITION
Therefore, the petitions are denied in so far as they seek the petitioners' immediate release. The matters are remanded to the trial court, which is directed to conduct hearings, forthwith, as to both petitioners. The current trial date is February 6, 2001. The hearings must address the question whether to continue petitioner's detention in lieu of security to and including the time necessary for them to testify at trial, and to make this determination in accordance with the views expressed in this opinion.[15]
ARMSTRONG, Acting P.J., and GODOY PEREZ, J., concur.
NOTES
[*]   Judge of the Los Angeles County Superior Court, assigned by the Chief Justice pursuant to article VI, section 6 of the California Constitution.
[1]  Unless otherwise indicated, all further statutory references are to the Penal Code.

Section 1332 provides: "(a) Notwithstanding the provisions of Sections 878 to 883, inclusive, when the court is satisfied, by proof on oath, that there is good cause to believe that any material witness for the prosecution or defense, whether the witness is an adult or a minor, will not appear and testify unless security is required, at any proceeding in connection with a wardship petition pursuant to Section 602 of the Welfare and Institutions Code, the court may order the witness to enter into a written undertaking to the effect that he or she will appear and testify at the time and place ordered by the court or that he or she will forfeit an amount the court deems proper. [¶] (b) If the witness required to enter into an undertaking to appear and testify, either with or without sureties, refuses compliance with the order for that purpose, the court may commit the witness, if an adult, to the custody of the sheriff, and if a minor, to the custody of the probation officer or other appropriate agency, until the witness complies or is legally discharged, [¶] (c) When a person is committed pursuant to this section, he or she is entitled to an automatic review of the order requiring a written undertaking and the order committing the person, by a judge or magistrate having jurisdiction over the offense other than the one who issued the order. This review shall be held not later than two days from the time of the original order of commitment, [¶] (d) If it is determined that the witness must remain in custody, the witness is entitled to a review of that order after 10 days. [¶] (e) When a witness has entered into an undertaking to appear, upon his or her failure to do so the undertaking is forfeited in the same manner as undertakings of bail."
Sections 879, 881, and 882 apply to material witnesses at the preliminary hearing or grand jury. In this case we do not deal with these sections.
[2]  There is some confusion in the record as to petitioner Jesus G.'s age. However, in an interview with the police he gave his birthday as March 17, 1985, which would make him 15 years old.
[3]  Francisco M. testified that he was the sole passenger in a car driven by Reynoso. They were stopped at a corner, and Reynoso was talking to someone on the street. Francisco M. heard a voice scream, "Watch out Little Man." A small, gray, two-door car was next to them. He saw two occupants, a nine-millimeter handgun, and heard shots. He ducked, but saw Reynoso bleeding from the head. When he looked up, the gray car was gone.
[4]  At the preliminary hearing, Francisco M. testified that he had left the house to go to school, and had stopped at his girlfriend's house, which was on the way.
[5]  According to a declaration by the trial prosecutor filed with this court, there is indeed a threat against Francisco M.'s life, allegedly issued by gang members with ties to defendant Aranda.
[6]  We have ordered the record of Jesus G.'s statements to the police sealed. Since it is unnecessary for our decision, we do not discuss the statements in detail. We note, however, that the characterization of those statements contained in the allegations of the Jesus G. habeas corpus petition is inaccurate. We can only surmise that when the petition was filed, counsel for Jesus G. was misinformed as to the nature of his client's statements. The prosecution has clearly shown that Jesus G. is a material witness, and we need not discuss the point further.
[7]  We feel compelled to note, again, mischaracterizations in the allegations of the Jesus G. petition. The petition states that the minor has "no gang ties," and that "there is absolutely no evidence that the minor would not cooperate." The record belies these assertions. Perhaps counsel means to argue that the evidence on these points does not rise to the level required to detain his client. However, such an argument should be based on the evidence actually presented to the lower court.
[8]  Counsel for Jesus G. presented this argument for the first time at oral argument on the order to show cause. He provided us with no authority.
[9]  Title 18 United States Code section 3144 provides: "If it appears from an affidavit filed by a party that the testimony of a person is material in a criminal proceeding, and if it is show that it may become impracticable to secure the presence of the person by subpoena, a judicial officer may order the arrest of the person and treat the person in accordance with the provisions of section 3142 of this title [governing conditions of release applicable to persons awaiting trial]. No material witness may be detained because of inability to comply with any condition of release if the testimony with of such witness can adequately be secured by deposition, and if further detention is not necessary to prevent a failure of justice. Release of a material witness may be delayed for a reasonable period of time until the deposition' of the witness can be taken pursuant to the Federal Rules of Criminal procedure."
[10]  We note, also, that under section 881, subdivision (e), a material witness cannot be held in custody longer than ten days. Section 1332 has no such limiting provision.
[11]  Not infrequently, the witness may be expected to recant at trial prior statements made to law enforcement. Thus, in determining the witness' importance at trial, the court may have to rely in part on impeaching statements previously made by the witness.
[12]  We do not mean to approve an arrangement like that proposed by counsel for petitioner Jesus G. to the court below. Permitting the involvement of an unnamed third party in the arranging and financing of electronic monitoring may well preclude the establishment of adequate safeguards to ensure the witness' attendance at trial. We note that in a declaration filed after oral argument, the trial prosecutor states that the attorney for the benefactor had informed him that his client did not wish to be subjected to any background check, and had withdrawn his offer.
[13]  The federal material witness statute, title 18 United States Code section 3144, states that "[n]o material witness may be detained because of inability to comply with any condition of release if the testimony of such witness can adequately be secured by deposition, and if further detention is not necessary to prevent a failure of justice."
[14]  We recognize, however, that even such a change in the law would not make the use of a conditional examination wise in every case in which a material witness is detained. The People have a significant interest in having the witness personally appear before the jury. Moreover, the defendant has the right to confront and cross-examine the witness in the presence of the jury. Even were a conditional examination feasible, these interests might well counsel against its use. Also, there is a further practical problem. Use of a conditional examination at trial is only permitted if the witness is unavailable within the meaning of Evidence Code section 240. (Pen.Code, § 1345.) This provision is required to protect the defendant's right to confront and cross-examine witnesses. (People v. Louis (1986) 42 Cal.3d 969, 983, 232 Cal.Rptr. 110, 728 P.2d 180.) Thus, if the conditional examination is conducted, and the witness released, the state will still be required to make reasonable efforts to obtain the attendance of the witness for trial.
[15]  We order that this opinion shall be immediately final as to this court. (Cal. Rules of Court, rule 24(d)(2).)
