
173 Cal.App.4th 1455 (2009)
___ Cal.Rptr.3d ___
V.C., Petitioner,
v.
THE SUPERIOR COURT OF SACRAMENTO COUNTY, Respondent;
THE PEOPLE, Real Party in Interest.
No. C059050.
Court of Appeals of California, Third District.
May 19, 2009.
As modified June 2, 2009.
*1458 Paulino G. Durán, Public Defender, Arthur L. Bowie and Reuben Moreno, Assistant Public Defenders, for Petitioner.
No appearance for Respondent.
Edmund G. Brown, Jr., Attorney General, Dane R. Gillette, Chief Assistant Attorney General, Michael P. Farrell, Assistant Attorney General, Catherine Chatman and Ryan B. McCarroll, Deputy Attorneys General, for Real Party in Interest.

OPINION
CANTIL-SAKAUYE, J. 
After the minor's alleged unsatisfactory performance of the conditions of his probation arising from his plea bargain on a 2007 sustained petition, the juvenile court, pursuant to Welfare and Institutions Code[1] section 782, dismissed the minor's 2007 sustained petition in order to make him eligible for commitment to the Department of Corrections and Rehabilitation, Division of Juvenile Facilities (DJF) under the revised terms of section 733, subdivision (c) (section 733(c)). Section 733(c) limits the commitment of a minor to DJF to cases where the minor has been, or is adjudged to be, a ward of the juvenile court pursuant to section 602 and the minor's "most recent offense alleged in any petition and admitted or found to *1459 be true by the court" is an offense listed in section 707, subdivision (b), or a sex offense listed in Penal Code section 290.008, subdivision (c).[2]
(1) Here, the juvenile court dismissed V.C.'s most recently sustained petition, a 2007 Penal Code section 314 offense, which does not qualify for a DJF commitment, to cause an earlier sustained petition, a 2005 Penal Code section 288a, subdivision (b)(1) offense, which does qualify for a DJF commitment, to be the most recent offense for purposes of section 733(c). Based on the facts of this case, we conclude the court abused its discretion under section 782 when it dismissed the 2007 petition. Thus, we need not reach the other issues raised by the parties.
We shall issue a writ of mandate requiring the respondent juvenile court to (1) vacate its order of May 7, 2008, dismissing the petition filed on November 8, 2007; (2) dismiss the May 9, 2008, notice of violation of probation; and (3) reinstate the February 29, 2008, notice of violation of probation.

FACTUAL AND PROCEDURAL BACKGROUND
In 2005, a petition was filed alleging V.C. came within the provisions of section 602 based on his commission of a lewd and lascivious act upon a child under the age of 14 in violation of Penal Code section 288, subdivision (a). V.C. admitted felony oral copulation of a minor in violation of Penal Code section 288a, subdivision (b)(1), as a reasonably related offense (the 2005 petition). The juvenile court declared V.C. a ward of the court and placed him in the "Youth Center."
A petition to modify and change V.C.'s placement was granted in 2006 and V.C. was committed to the care of the probation officer for "suitable Level `A' placement." Special conditions of probation were imposed, including that V.C. participate in a sexual offender treatment program.
On September 1, 2007, the Legislature amended former section 733. (Stats. 2007, ch. 175, § 22.) The new legislation limits eligibility for commitment to DJF to minors found to have committed the criminal offenses listed *1460 in section 707, subdivision (b) and the sex offenses listed in Penal Code section 290, former subdivision (d)(3). (§ 733(c).)[3]
In November 2007, the district attorney filed a subsequent petition alleging V.C. committed three new criminal offenses in October 2007: a lewd and lascivious act upon the body of a child under the age of 14 (Pen. Code, § 288, subd. (a)); misdemeanor indecent exposure (Pen. Code, § 314, subd. 1); and misdemeanor child molestation (Pen. Code, § 647.6, subd. (a)(1)). The juvenile court approved a negotiated plea bargain resolution under which V.C. admitted the charge of indecent exposure and the court dismissed the two remaining allegations in the interests of justice (the 2007 petition). The court continued V.C. as a ward of the court and again committed him to the care of the probation officer for "suitable Level `A' placement." The special conditions of probation again required V.C. to participate in a sexual offender treatment program.
In February 2008, the district attorney filed a section 777 notice alleging V.C. violated probation by failing to participate in a sexual offender treatment program and failing to obey the directives of the group home staff. The notice recommended the consequence of the violations be a commitment to DJF. However, under the terms of section 733(c) as amended, V.C. was not eligible for such commitment.[4] The court detained V.C. in juvenile hall.
The district attorney moved to dismiss the prior 2007 petition (the § 314 offense) in the interests of justice pursuant to section 782. The district attorney argued that if the court dismissed the 2007 petition, DJF commitment would be appropriate under section 733(c) because the "most recent offense alleged in any petition" would then be the 2005 oral copulation of a minor, Penal Code section 288a, offense.[5] (§ 733(c).) V.C. opposed the request, responding that dismissal of the 2007 petition would violate the Legislature's intent in amending section 733. He also maintained that dismissal in these circumstances would lead to absurd results and frustrate the will of the Legislature because the prosecution "could dismiss each petition, ad infinitum, until the `most recent' petition made the minor eligible for placement at DJF."
*1461 The juvenile court granted the district attorney's motion under section 782 to dismiss the 2007 petition in the interests of justice and based on the lack of awareness by the court and the parties of "the nuances of the newest law." In its written order, the court explained it granted the dismissal because: The change in the law determining DJF eligibility occurred midyear; neither the court nor the lawyers were aware that allowing V.C. to admit the section 314 violation would make him DJF ineligible; the court had warned V.C. he was headed to DJF if his behavior did not improve; the purpose of the new law was to divert nonviolent, nonserious offenders; V.C.'s "entire delinquent history" could not be characterized as nonviolent or nonserious; the juvenile court was authorized and obligated in carrying out its duties to weigh and consider both the interests of the juvenile and the interests of society; and V.C.'s "predatory offenses and abysmal adjustment to the Sex Offender group home suggest DJF is a viable option [for] treatment of [V.C.] and the protection of society." The court orally stated that since DJF commitment could not "occur without the dismissal, it appears that both . . . the interest[s] of justice and the welfare of the minor support a dismissal of the petition." The juvenile court emphasized that in its view all it did in dismissing the 2007 petition was "give the sentencing judge some options." The court denied it was prejudging what happened on the alleged probation violations, but indicated DJF "appears to be an appropriate option for the sentencing court to have." The court acknowledged that the district attorney's most recent notice of probation violation was based on orders that, after the dismissal, were no longer in effect and indicated "[w]e are definitely going to have to go back and fix things, but it doesn't mean that he's not in violation of the Court's orders."
Two days later, the district attorney moved inter alia to modify the prior orders, specifically, "[t]hat the Court adopt all prior conditions and orders from the sustained PC 288a(b)(1) offense from 11-30-2005 [the 2005 petition], in addition to including the superseded conditions and modifications; thus continuing all orders, conditions and modifications in full force and effect." On the same date, the district attorney filed a new section 777 notice of hearing on the two counts of violating probation and requested that V.C. be committed to DJF. The court set a hearing on the district attorney's motions.
V.C. filed his petition for writ of mandate prior to such hearing. We stayed all further proceedings in the juvenile court and issued an alternative writ.


*1462 DISCUSSION

I.

V.C.'s Claims Are Justiciable in a Petition for Writ of Mandate
Citing Code of Civil Procedure section 1086, the People contend writ relief is inappropriate because V.C. has a plain, speedy and adequate remedy through the normal appellate process.[6] The People maintain that "the minor may obtain immediate appellate review of his claim that the juvenile court abused its discretion under section 782 by dismissing the supplemental petition" because the order of dismissal is a "subsequent order" within the meaning of section 800.[7]
V.C. argues principally that the remedy of ordinary appeal from the order dismissing the section 314 petition is inadequate. He asserts that writ relief is necessary to rectify the juvenile court's error before he is forced to go to the hearing on the pending alleged violations of probation and to contest the People's recommendation of DJF placement at any dispositional hearing. (See Maine v. Superior Court (1968) 68 Cal.2d 375, 378 [66 Cal.Rptr. 724, 438 P.2d 372]; Conway v. Municipal Court (1980) 107 Cal.App.3d 1009, 1015-1016 [166 Cal.Rptr. 246].)
(2) "Generally, a judgment that is immediately appealable is not subject to review by mandate or other extraordinary writ. [Citations.] Mandate is available to review an appealable judgment only when the remedy by appeal would be inadequate or the issues presented are of great public importance and must be resolved promptly." (Powers v. City of Richmond (1995) 10 Cal.4th 85, 112-113 [40 Cal.Rptr.2d 839, 893 P.2d 1160].)
V.C. has met his burden as petitioner to show the issue raised in this writ proceeding meets the test for an exception to the general rule precluding writ review. (Powers v. City of Richmond, supra, 10 Cal.4th at p. 113; Phelan v. Superior Court (1950) 35 Cal.2d 363, 370 [217 P.2d 951].) The question of *1463 whether a juvenile court may use its dismissal authority under section 782 to dismiss a sustained petition of a DJF ineligible offense to make an earlier sustained petition of a DJF eligible offense the "most recent offense" for purposes of section 733(c) is one of first impression. Writ review is appropriate to provide guidance to the bench and bar earlier than would be normal on an appeal. (See Litmon v. Superior Court (2004) 123 Cal.App.4th 1156, 1166 [21 Cal.Rptr.3d 21]; People v. Superior Court (Howard) (1999) 70 Cal.App.4th 136, 147 [82 Cal.Rptr.2d 481]; Anderson v. Superior Court (1989) 213 Cal.App.3d 1321, 1328 [262 Cal.Rptr. 405]; see also Apple Computer, Inc. v. Superior Court (2005) 126 Cal.App.4th 1253, 1264 [24 Cal.Rptr.3d 818] ["`generally extraordinary writs are determined more speedily than appeals'"].) Writ review also resolves the issue before needless time and effort is expended on the pending probation violation proceedings and potential dispositional hearings, which are predicated on the juvenile court's dismissal of the section 314 petition. (Maine v. Superior Court, supra, 68 Cal.2d at p. 378.)

II.

The Juvenile Court Abused Its Discretion Under Section 782 in Dismissing the 2007 Petition
(3) Juvenile courts have long had the authority to dismiss juvenile matters at the disposition stage of proceedings. (In re W.R.W. (1971) 17 Cal.App.3d 1029, 1036 [95 Cal.Rptr. 354].) Such authority was statutorily expressed between 1915 and 1961. (Ibid.) When the entire juvenile court law was repealed and recodified in 1961, without enactment of a general dismissal provision, the reviewing court in In re W.R.W. concluded juvenile courts nevertheless properly continued the practice of exercising discretion to dismiss juvenile matters. (Ibid.) It noted: "The [juvenile] court is accorded great discretion in its disposition of juvenile matters. It may at any time modify or vacate a dispositional order and may entirely terminate its jurisdiction when it is satisfied that further supervision is unnecessary [citations]. It would be inconsistent with the liberal termination provisions and the general thrust of the juvenile court law to hold that the referee, at the time of original disposition, could not dismiss the case if he felt that court supervision would be unnecessary and perhaps harmful." (Id. at p. 1037, fns. omitted.)[8] Shortly after the decision in In re W.R.W., "the Legislature drafted section 782, *1464 restoring to the juvenile law the clear power of the court to dismiss juvenile petitions in the interests of justice." (Derek L. v. Superior Court (1982) 137 Cal.App.3d 228, 232 [186 Cal.Rptr. 870] (Derek L.).) Section 782 is a general dismissal statute for juvenile matters. (Derek L. at p. 232.)
Section 782 provides, in relevant part, that: "A judge of the juvenile court in which a petition was filed, at any time before the minor reaches the age of 21 years, may dismiss the petition or may set aside the findings and dismiss the petition if the court finds that the interests of justice and the welfare of the minor require such dismissal, or if it finds that the minor is not in need of treatment or rehabilitation." (§ 782, italics added.) That is, as applicable here, section 782 authorizes dismissal when it is both in "the interests of justice" and "the welfare of the minor require[s it]."
(4) In considering the first prong of whether a dismissal is in "the interests of justice," we agree with Derek L., supra, 137 Cal.App.3d at page 233, that Penal Code section 1385 (section 1385), the dismissal statute applicable to adult criminal proceedings, is analogous and provides an appropriate analytical framework for consideration of dismissals under section 782. (Accord, In re Juan C. (1993) 20 Cal.App.4th 748, 752 [24 Cal.Rptr.2d 573].) As explained by Derek L., "Although certain distinctions exist between the goals and purposes of the criminal justice system on the one hand and the juvenile justice system on the other, those distinctions are not material for purposes of the resolution of this issue [interpreting whether a dismissal is in the interests of justice]. In connection with dismissal of adult criminal proceedings, the Supreme Court has determined that furtherance of justice requires consideration of both the rights of the accused and the interests of society represented by the People. (People v. Orin (1975) 13 Cal.3d 937, 945 [120 Cal.Rptr. 65, 533 P.2d 193].) Similarly, . . . [¶] . . . the juvenile court is not only authorized, but obligated, in carrying out its duties under the Juvenile Court Law, to weigh and consider both the interests of the juvenile and the interests of society. The clear parallel with those joint obligations in criminal court proceedings persuades us that a dismissal which is not `in furtherance of justice' in an adult criminal proceeding is unlikely to be `in the interests of justice' in juvenile court." (Derek L., supra, 137 Cal.App.3d at p. 233.)[9]
*1465 (5) We turn to consider whether the juvenile court's dismissal of V.C.'s 2007 petition was "in the interests of justice" as required by section 782. In this inquiry we are guided by case law concerning whether a particular dismissal is "`in furtherance of justice'" under Penal Code section 1385. (Derek L., supra, 137 Cal.App.3d at pp. 232-233.) In connection with such Penal Code section 1385 dismissals in adult criminal proceedings, the California Supreme Court has stated that a "trial court's power to dismiss an action under section 1385, while broad, is by no means absolute." (People v. Orin, supra, 13 Cal.3d at p. 945.) "Paramount . . . is the rule `that . . . "furtherance of justice," requires consideration both of the constitutional rights of the defendant, and the interests of society represented by the People . . . .'" (Ibid., italics omitted.) The same is true for section 782. (Derek L., supra, at pp. 232-233.)
(6) Here the constitutional rights of V.C. include his due process right to the benefit of his plea bargain in the 2007 petition. (People v. Mancheno (1982) 32 Cal.3d 855, 860 [187 Cal.Rptr. 441, 654 P.2d 211].) Under the due process clause, "when a plea rests in any significant degree on a promise or agreement of the prosecutor, so that it can be said to be part of the inducement or consideration, such promise must be fulfilled." (Santobello v. New York (1971) 404 U.S. 257, 262 [30 L.Ed.2d 427, 433, 92 S.Ct. 495].)
Here the 2007 petition originally alleged V.C. had committed three criminal offenses; one felony and two misdemeanors. The felony (lewd and *1466 lascivious conduct in violation of Pen. Code, § 288, subd. (a)) was a DJF eligible offense under the new terms of section 733(c).[10] The record reflects the prosecutor agreed V.C. could admit only the misdemeanor indecent exposure (Pen. Code, § 314) count, a DJF ineligible offense, and his disposition would be level A placement. V.C. accepted such offer, waived his constitutional rights, and admitted the indecent exposure offense. The juvenile court accepted V.C.'s admission and dismissed the other counts in the interests of justice. Although the juvenile court expressed some reservations about the placement recommendation, warning V.C. that "[i]f there is any more of this type of miss behavior [sic], certainly, if there is another victim," he would likely be sent to DJF, the juvenile court committed V.C. to the care of the probation officer for suitable level A placement. V.C. was apparently placed in accordance with this order of disposition. His plea agreement was thus a fully executed agreement.[11]
Months later V.C. was alleged to have violated the terms of his probation, not by further criminal sexual misbehavior, but by failing to participate in an ordered sexual offender treatment program and to follow directions of the group home staff. Wanting to argue for DJF placement and realizing the effect of section 733(c), the district attorney moved for dismissal of the 2007 petition. The juvenile court found a basis for granting the dismissal in the fact that "[n]either the Court nor the lawyers were aware of the ramifications of allowing an admission to 314.1 [sic] PC, as opposed to the other counts . . . ."
The record before us does not support the juvenile court's finding that both the prosecutor and defense counsel were unaware of section 733(c). The transcript of the hearing at which V.C. was offered, and accepted, the plea bargain does not reflect any misunderstanding of the law by V.C.'s counsel, who was largely silent during the proceedings. The juvenile court did not warn the minor "that he was headed to DJF if his behavior didn't improve" as the juvenile court later found in its order dismissing the 2007 petition. Rather the court's statement to V.C. at the time of his admission that "[i]f there is any more of this type of miss behavior [sic], certainly, if there is another victim," he would likely be sent to DJF, can reasonably be understood as warning V.C. that he could be subject to a DJF placement if he committed any new eligible sexual offense under the terms of section 733(c).
*1467 However, even if we accept the juvenile court's apparent finding of a mutual mistake of law,[12] principles of equity preclude rescission of the plea bargain on such basis. (See, e.g., American Psychometric Consultants, Inc. v. Workers' Comp. Appeals Bd. (1995) 36 Cal.App.4th 1626, 1647 [43 Cal.Rptr.2d 254] [modern doctrine emphasizes the importance of equitable factors such as detrimental change of position, hardship, the implementation of some important public policy or transactional stability in determining remedy for mistakes of law and fact].) Allowing a trial court to rescind a plea bargain that has been accepted and fully executed, because it was unaware of a change in the law in existence at the time of a defendant's admission that if known by it and the parties would have changed the terms or acceptance of the proposed plea, would clearly introduce unacceptable instability in the practice of plea bargaining. No bargain would ever truly be secure.
We conclude the juvenile court's dismissal was not in the interests of justice in light of the constitutional rights of V.C. to his plea bargain in this case. This conclusion is confirmed by consideration of the interests of society, which in this case have been expressed by the Legislature in section 733(c).
(7) Section 733(c) prohibits commitment to the DJF in cases where "[t]he ward has been or is adjudged a ward of the court pursuant to Section 602, and the most recent offense alleged in any petition and admitted or found to be true by the court is not described in subdivision (b) of Section 707, unless the offense is a sex offense set forth in subdivision (c) of Section 290.008 of the Penal Code." (Italics added.)
(8) "`"As in any case involving statutory interpretation, our fundamental task is to determine the Legislature's intent so as to effectuate the law's purpose." (People v. Murphy (2001) 25 Cal.4th 136, 142 [105 Cal.Rptr.2d 387, 19 P.3d 1129].)' (People v. Cole (2006) 38 Cal.4th 964, 974 [44 Cal.Rptr.3d 261, 135 P.3d 669].) Statutory interpretation begins with an analysis of the statutory language. (Beal Bank, SSB v. Arter & Hadden, LLP (2007) 42 Cal.4th 503, 507 [66 Cal.Rptr.3d 52, 167 P.3d 666].) `If the statute's text evinces an unmistakable plain meaning, we need go no further.' (Id. at p. 508.) If the statute's language is ambiguous, we examine additional sources of information to determine the Legislature's intent in drafting the *1468 statute. (Ibid.; People v. Cole, supra, 38 Cal.4th at p. 975.)" (Olson v. Automobile Club of Southern California (2008) 42 Cal.4th 1142, 1147 [74 Cal.Rptr.3d 81, 179 P.3d 882].) Here, neither the language nor the legislative history of section 733(c) demonstrates the intent of the Legislature to allow commitment of minors to DJF who are not currently serious or violent offenders.
(9) The language of section 733(c) allows commitment to DJF only when "the most recent offense alleged in any petition and admitted or found to be true by the court" (italics added) is an eligible offense. The statute does not focus on the overall or entire delinquent history of the minor or on whether the minor may be generally considered a serious, violent offender. The language looks to the minor's "most recent offense." The Legislature has specifically determined it is the minor's most recent offense that determines the minor's eligibility for DJF commitment. Dismissal of the most recent petition to reach back to an earlier petition containing a DJF qualifying offense would be contrary to the unmistakable plain language of section 733(c). It would frustrate the legislative policy expressed by the language of section 733(c). Such a dismissal cannot be in the interests of justice. (See People v. Hernandez (1979) 97 Cal.App.3d 451, 455 [158 Cal.Rptr. 742] [where Legislature specifically determined in Pen. Code, § 1382 that 10 days is a reasonable time in which to bring to trial a defendant who has consented to a postponement beyond the original 60-day period, dismissal within the 10-day period is not in furtherance of justice under Pen. Code, § 1385].)
Although we need go no further than the plain meaning of the language, we reach the same conclusion when we consider the legislative history for section 733(c). The Senate floor analysis for section 733(c) explains "[t]his bill will stop the intake of youthful offenders adjudicated for non-violent, non-serious offenses . . . to the [DJF] on September 1, 2007." (Sen. Rules Com., Off. of Sen. Floor Analyses, Unfinished Business Analysis of Sen. Bill No. 81 (2007-2008 Reg. Sess.) as amended July 19, 2007, p. 2.) The Assembly floor analysis of Senate Bill No. 81 similarly states the legislation "[p]rohibits the intake of youthful offenders adjudicated for non-violent, non-serious offenses . . . to the [DJF] on September 1, 2007." (Assem. Com. on Budget & Fiscal Review, Off. of Sen. Floor Analyses, 3d reading analysis of Sen. Bill No. 81 (2007-2008 Reg. Sess.) as amended July 19, 2007, p. 1.) The import of these analyses seems clear; the Legislature intended only currently violent or serious juvenile offenders to be sent to DJF starting September 1, 2007.
Like the court in In re N.D. (2008) 167 Cal.App.4th 885, 891-892 [84 Cal.Rptr.3d 517], we also find it helpful background to realize section 733(c) was enacted as part of chapter 175 of the Statutes of 2007 in order to make *1469 "necessary statutory changes to implement the Budget Act of 2007 . . . ." (Stats. 2007, ch. 175, § 38.) According to the court in In re N.D., "[a] report of the California Little Hoover Commission explains the budget impact. To settle a lawsuit brought on behalf of inmates of state juvenile facilities, the state entered into a consent decree in November of 2004. The cost of compliance with the consent decree proved to be high: `Realizing the state could not afford to comply with the . . . consent decree, in 2007, policy-makers acted to reduce the number of youth offenders housed in state facilities by enacting realignment legislation which shifted responsibility to the counties for all but the most serious youth offenders. . . .' [Citation.]" (In re N.D., supra, at pp. 891-892.)
In light of the legislative history and budgetary context for section 733(c), it would obstruct the Legislature's purpose for us to construe section 782 as allowing a juvenile court to dismiss a minor's most recently sustained petition for a noneligible offense so that it could have the option of committing the minor to DJF for an eligible offence in an earlier petition. This would not restrict the intake of juvenile offenders to DJF to those who are currently serious or violent offenders. The use of section 782 to reach such a result cannot be "in the interests of justice."
(10) Since the juvenile court could not have found the dismissal of the 2007 petition in this case to be "in the interests of justice," as analyzed under V.C.'s constitutional due process right to the benefit of his plea bargain and as analyzed under the interests of society as expressed in section 733(c)it is unnecessary to consider whether the welfare of V.C. otherwise required the dismissal. The juvenile court abused its discretion in granting dismissal under section 782, which mandates, as we have noted, that any dismissal be based on a finding "that the interests of justice and the welfare of the minor require such dismissal." (Italics added.) The dismissal must be vacated and the parties restored to their prior positions.

DISPOSITION
Let a peremptory writ of mandate issue commanding the respondent Sacramento County Superior Court to enter an order in this case (1) vacating its order of May 7, 2008, dismissing the section 314 petition, (2) dismissing the May 9, 2008, notice of violation of probation, and (3) reinstating the February 29, 2008, notice of violation of probation. The alternative writ is discharged. The stay issued by this court shall remain in effect pending issuance of the remittitur.
Davis, J.,[*] concurred.
*1470 SCOTLAND, P. J., Concurring. 
This is one of those times when a court must divine what the Legislature intended when it enacted a statute susceptible to two reasonable, but conflicting, interpretations.
In this case, a ward of the juvenile court was charged with sex crimes, including indecent exposure and child molestation, while he was on probation for committing a lewd and lascivious act on a child under the age of 14. In a plea bargain, he admitted the charge of indecent exposure and was reinstated on probation. Probation was later revoked when the minor failed to participate in a sex offender treatment program and disobeyed the staff of the group home where he was placed.
The juvenile court concluded a commitment to the Department of Corrections and Rehabilitation, Division of Juvenile Facilities (DJF) (formerly CYA) was in the best interests of the minor and was necessary to protect the public. However, Welfare and Institutions Code section 733 precluded the court from imposing a DJF commitment for indecent exposure.[1] (Further section references are to the Welfare and Institutions Code unless otherwise specified.)
To avoid the preclusion of section 733, the juvenile court set aside its findingbased on the negotiated pleathat the minor committed indecent exposure, and the court dismissed the petition charging that offense. The court then committed the minor to DJF for his lewd and lascivious act on a child under 14 (Pen. Code, § 288, subd. (a)), an offense listed in section 707, subdivision (b). The court still had jurisdiction over that offense because it was one basis for the minor's status on probation, which the court later revoked after the indecent exposure.
The court concluded section 782 gave it the authority to set aside the indecent exposure adjudication and dismiss the petition charging that offense and others. Section 782 states: "A judge of the juvenile court in which a petition was filed, at any time before the minor reaches the age of 21 years, *1471 may dismiss the petition or may set aside the findings and dismiss the petition if the court finds that the interests of justice and the welfare of the minor require such dismissal, or if it finds that the minor is not in need of treatment or rehabilitation. The court shall have jurisdiction to order such dismissal or setting aside of the findings and dismissal regardless of whether the minor is, at the time of such order, a ward or dependent child of the court." (Italics added.)
To justify its use of section 782 to set aside the indecent exposure adjudication and dismiss that petition, the juvenile court found the minor continued to commit sex offenses after having been adjudicated a ward for committing a lewd and lascivious act on a child under the age of 14; he remained "a risk to society"; he was in need of intensive treatment and had shown that he could not get such treatment in the group home setting; and, thus, a commitment to DJF would be "in the interest of justice and the welfare of the minor . . . ."
The plain language of section 782 is reasonably susceptible to the interpretation applied by the juvenile court. Separated by the word "or," the statute's phrases "the interests of justice and the welfare of the minor require such dismissal" and "the minor is not in need of treatment or rehabilitation" necessarily have different meanings. It is not a stretch by any means to conclude that the words "the interests of justice and the welfare of the minor require such dismissal" encompass what the juvenile court did in this case. Where, as here, a minor needs an intensive treatment program for sex offenders, which he cannot get in a group home but can be provided in a DJF facility, the "welfare of the minor" and the "interests of justice" are best served by committing him to DJF, where necessary treatment is available to help him cease being a risk to himself and to society.
In other words, the plain language of the statute supports an interpretation that a juvenile court can use section 782 to commit a minor to DJF when section 733 would otherwise preclude a DJF commitment.
On the other hand, the language of section 782 reasonably can be interpreted as providing a juvenile court with nothing more than the authority to terminate jurisdiction over a minor by dismissing a pending petition or by setting aside findings that were made on a petition and then dismissing the petition.
This interpretation of section 782 would preclude a juvenile court from using section 782 to avoid section 733's limitation on the dispositions available to the court when the most recent crime committed by a minor is not an offense for which a term in DJF can be imposed, but the minor had committed an earlier crime qualifying him or her for confinement in DJF.
*1472 When presented with a statute susceptible to more than one reasonable interpretation, courts may turn to legislative history to ascertain the meaning of the statute. (Diamond Multimedia Systems, Inc. v. Superior Court (1999) 19 Cal.4th 1036, 1055 [80 Cal.Rptr.2d 828, 968 P.2d 539]; Kaufman & Broad Communities, Inc. v. Performance Plastering, Inc. (2005) 133 Cal.App.4th 26, 29-30 [34 Cal.Rptr.3d 520] [courts may take judicial notice of cognizable legislative history] (hereafter Kaufman & Broad).)
The legislative history of section 782 quickly reveals that the statute was intended only as a vehicle for a juvenile court to terminate jurisdiction over a minor. Section 782 was enacted in 1971 as Senate Bill 461 of that session. The enrolled bill report, dated August 10, 1971, states that the new statute was intended to "provide the court with the alternative to terminate jurisdiction at an earlier date [before the minor reaches the age of 21] if the court felt that this was in the best interest of the minor," and the statute even includes language to allow a juvenile court the "option of setting aside wardship" "regardless of whether the minor is, at the time of dismissal, a ward or dependent of the court." (See Elsner v. Uveges (2004) 34 Cal.4th 915, 934, fn. 19 [22 Cal.Rptr.3d 530, 102 P.3d 915] [enrolled bill reports are cognizable legislative history; but see Kaufman & Broad, supra, 133 Cal.App.4th at pp. 41-42 [criticizing the California Supreme Court's holding that enrolled bill reports are cognizable legislative history].)
Because the sole purpose of section 782 is to allow the court to terminate juvenile court jurisdiction over a person under the circumstances specified in the statute, it was error for the court in this case to apply section 782 as a way to avoid the limitation of section 733 in order to commit the minor to DJF.
Thus, I concur in the disposition of the majority opinion. The fact that this result may not be in the best interests of the minor and public safety is not necessarily the fault of the statutory scheme, but of the prosecutor's failure to recognize the potential effects of the plea bargain extended to the minor. That "[n]either the Court nor the lawyers were aware of the ramifications of allowing an admission to [indecent exposure], as opposed to the other counts" does not permit a court to misapply the statutes to accomplish a result not permitted by law, even if the result would be better for the minor and the public. Courts are guided by statutes not results. To the extent there may be a flaw in the legislative scheme, it is up to the Legislature, not the courts, to correct it. (In re Brent F. (2005) 130 Cal.App.4th 1124, 1130 [30 Cal.Rptr.3d 833]; Knight v. Superior Court (2005) 128 Cal.App.4th 14, 19 [26 Cal.Rptr.3d 687]; People v. Hunt (1999) 74 Cal.App.4th 939, 948 [88 Cal.Rptr.2d 524]; Souza v. Lauppe (1997) 59 Cal.App.4th 865, 874 [69 Cal.Rptr.2d 494]; *1473 In re Marriage of Fisk (1992) 2 Cal.App.4th 1698, 1702 [4 Cal.Rptr.2d 95]; Squaw Valley Ski Corp. v. Superior Court (1992) 2 Cal.App.4th 1499, 1515 [3 Cal.Rptr.2d 897]; City of Victorville v. County of San Bernardino (1991) 233 Cal.App.3d 1312, 1322 [233 Cal.Rptr. 1312, 285 Cal.Rptr. 206]; Williams v. County of San Joaquin (1990) 225 Cal.App.3d 1326, 1334 [275 Cal.Rptr. 302]; Neighbours v. Buzz Oates Enterprises (1990) 217 Cal.App.3d 325, 334 [265 Cal.Rptr. 788].)
NOTES
[1]  Hereafter, undesignated statutory references are to the Welfare and Institutions Code.
[2]  Section 733 reads in relevant part: "A ward of the juvenile court who meets any condition described below shall not be committed to the Department of Corrections and Rehabilitation, Division of Juvenile Facilities: [¶] . . . [¶] (c) The ward has been or is adjudged a ward of the court pursuant to Section 602, and the most recent offense alleged in any petition and admitted or found to be true by the court is not described in subdivision (b) of Section 707, unless the offense is a sex offense set forth in subdivision (c) of Section 290.008 of the Penal Code. This subdivision shall be effective on and after September 1, 2007." (Italics added.)
[3]  The Legislature enacted a new Penal Code section 290, effective October 13, 2007, listing the sex offenses for which registration is required in subdivision (c). (Stats. 2007, ch. 579, § 8.) The provisions of Penal Code former section 290, subdivision (d)(3) (Stats. 2006, ch. 337, § 11) were restated as Penal Code section 290.008. (Stats. 2007, ch. 579, § 16.)
[4]  Indecent exposure in violation of Penal Code section 314 is not an offense listed in section 707, subdivision (b), or one of the sex offenses set forth in Penal Code former section 290, subdivision (d)(3).
[5]  Penal Code section 288a, subdivision (b)(1), is one of the sex offenses listed in Penal Code former section 290, subdivision (d)(3), as requiring sex offender registration. (Stats. 2006, ch. 337, § 11.)
[6]  Code of Civil Procedure section 1086 provides: "The writ [of mandate] must be issued in all cases where there is not a plain, speedy, and adequate remedy, in the ordinary course of law. It must be issued upon the verified petition of the party beneficially interested."
[7]  Section 800 reads in relevant part: "(a) A judgment in a proceeding under Section 601 or 602 may be appealed from, by the minor, in the same manner as any final judgment, and any subsequent order may be appealed from, by the minor, as from an order after judgment. Pending appeal of the order or judgment, the granting or refusal to order release shall rest in the discretion of the juvenile court. The appeal shall have precedence over all other cases in the court to which the appeal is taken." (Italics added.)
[8]  In re Richard D. (1972) 23 Cal.App.3d 592, 594 [100 Cal.Rptr. 351], distinguished In re W.R.W., supra, 17 Cal.App.3d 1029, on the basis that In re W.R.W. involved a dismissal ordered at the disposition hearing. The court in In re Richard D. stated it knew "of no provision in the Juvenile Court Act for the `dismissal' of a section 602 proceeding after a finding of wardship has been made and entered, a disposition hearing held, and rehabilitative disposition order made." (Richard D., supra, at p. 594.)
[9]  In the portion of the opinion that we have deleted, the court in Derek L., supra, 137 Cal.App.3d at p. 233, quotes the former provisions of section 202 to demonstrate that the overall purposes of the juvenile court law require consideration of both the interests of the minor and society. (Stats. 1977, ch. 910, § 1, p. 2782.) The current provisions of section 202 continue this dual emphasis, providing in relevant part: "(a) The purpose of this chapter is to provide for the protection and safety of the public and each minor under the jurisdiction of the juvenile court and to preserve and strengthen the minor's family ties whenever possible, removing the minor from the custody of his or her parents only when necessary for his or her welfare or for the safety and protection of the public. . . . [¶] (b) . . . minors under the jurisdiction of the juvenile court as a consequence of delinquent conduct shall, in conformity with the interests of public safety and protection, receive care, treatment, and guidance that is consistent with their best interest, that holds them accountable for their behavior, and that is appropriate for their circumstances. This guidance may include punishment that is consistent with the rehabilitative objectives of this chapter. . . . [¶] . . . [¶] (e) As used in this chapter, `punishment' means the imposition of sanctions. . . . Permissible sanctions may include any of the following: [¶] . . . [¶] (5) Commitment of the minor to [DJF]."

Given the parallel between Penal Code section 1385 dismissals in the "furtherance of justice" and the "interests of justice" prong of section 782, it is interesting to note that section 1385 vests in the courts the common law power of "nolle prosequi." (People v. Superior Court (Howard) (1968) 69 Cal.2d 491, 503 [72 Cal.Rptr. 330, 446 P.2d 138]; People v. Valenti (1957) 49 Cal.2d 199, 208 [316 P.2d 633], disapproved on other grounds in People v. Sidener (1962) 58 Cal.2d 645, 647 [25 Cal.Rptr. 697, 375 P.2d 641].) "Nolle prosequi" refers to an abandonment by the prosecutor of further prosecution or a dismissal of some part or all of the case. (Black's Law Dict. (8th ed. 2004) p. 1074, cols. 1-2.) Not surprisingly, therefore, it has been said dismissal pursuant to section 1385 "runs only in the immediate favor of a defendant, i.e., by cutting off an action or a part of an action against the defendant." (People v. Hernandez (2000) 22 Cal.4th 512, 524 [93 Cal.Rptr.2d 509, 994 P.2d 354], italics omitted; accord, People v. Ceja (2003) 106 Cal.App.4th 1071, 1082 [131 Cal.Rptr.2d 601].) Given this understanding of the court's power of dismissal under section 1385, and by parity of reasoning section 782, it is troubling at the outset that the juvenile court here used its authority under section 782 for the purpose of increasing the range of potential sanctions (DJF commitment is considered a sanction under § 202, subd. (e)(5)) to which V.C. was subject if found in violation of the terms of his probation.
[10]  Penal Code section 288 is one of the sex offenses listed in Penal Code former section 290, subdivision (d)(3), as requiring sex offender registration. (Stats. 2006, ch. 337, § 11.)
[11]  In re J.L. (2008) 168 Cal.App.4th 43 [85 Cal.Rptr.3d 35], is distinguishable on this basis. The juvenile court in In re J.L. set aside the minor's admissions and dismissed the section 602 petition at the disposition hearing, not after it. (In re J.L., supra, at pp. 52-54.)
[12]  A plea bargain is interpreted in accordance with the rules of contract. (People v. Toscano (2004) 124 Cal.App.4th 340, 344 [20 Cal.Rptr.3d 923].) Once the court accepts the plea (see People v. Mack (1986) 178 Cal.App.3d 1026, 1032 [224 Cal.Rptr. 208] [the trial court is presumed to know and apply the correct statutory and case law]), subsequent interpretations of the plea bargain contract must be based on an objective standard in which the defendant's reasonable beliefs control. (People v. Toscano, supra, at p. 345.) Ambiguities in the agreement are construed in favor of the defendant. (Ibid.) Both parties must abide by the terms of the agreement. (People v. Walker (1991) 54 Cal.3d 1013, 1024 [1 Cal.Rptr.2d 902, 819 P.2d 861]; Pen. Code, § 1192.5.)
[*]  Retired Associate Justice of the Court of Appeal, Third Appellate District, assigned by the Chief Justice pursuant to article VI, section 6 of the California Constitution.
[1]  Welfare and Institutions Code section 733 states in pertinent part: "A ward of the juvenile court who meets any condition described below shall not be committed to [DJF]: [¶] . . . [¶] (c) The ward has been or is adjudged a ward of the court pursuant to Section 602, and the most recent offense alleged in any petition and admitted or found to be true by the court is not described in subdivision (b) of Section 707, unless the offense is a sex offense set forth in subdivision (c) of Section 290.008 of the Penal Code."

Indecent exposure (Pen. Code, § 314, subd. 1) is an offense not described in either Welfare and Institutions Code section 707, subdivision (b) or Penal Code section 290.008.
