
33 Cal.Rptr.3d 172 (2005)
132 Cal.App.4th 18
In re ALEX N., A Person Coming Under the Juvenile Court Law.
The People, Plaintiff and Respondent,
v.
Alex N., Defendant and Appellant.
No. H027720.
Court of Appeal, Sixth District.
August 22, 2005.
*173 Bill Lockyer, Attorney General of the State of California, Robert R. Anderson, Chief Assistant Attorney General, Gerald A. Engler, Senior Assistant Attorney General, Martin S. Kaye, Supervising Deputy Attorney General, Michael E. Banister, Deputy Attorney General, Attorneys for Respondent.
Laura D. Pedicini By Appointment of the Sixth District Appellate Program, Attorney for Appellant.
MIHARA, J.
Appellant Alex N. was found to have committed first degree burglary (Pen.Code, §§ 459, 460) and committed to the California Youth Authority (CYA). The juvenile court aggregated his previously sustained petitions and identified his maximum time of confinement as 13 years and 10 months. On appeal, Alex contends that the juvenile court failed to exercise its discretion with respect to the aggregation of his previously sustained petitions and the setting of his maximum term of physical confinement. We agree and remand the matter for the court to exercise its discretion.

I. Background
Alex, who is now 18 years old, has been a ward of the juvenile court since March 2001. His wardship was initially based on his admissions that, at the age of 13, he committed second degree burglary (Pen.Code, §§ 459, 460), first degree burglary (Pen.Code, §§ 459, 460), lewd conduct with a minor (Pen.Code, § 288, subd. (a)) and oral copulation with a minor (Pen.Code, § 288a, subd. (b)(1)). He also admitted giving away dexedrine (Health & Saf.Code, § 11352, subd. (a)). In 2001, he was committed to the Ranch, but he escaped from the Ranch and later refused to return to the Ranch. Alex had performed poorly at the Ranch. Alex admitted escape allegations and was then placed in a private institution. He performed poorly at this institution too. In February 2002, Alex absconded from the private institution.
While he was on the lam, Alex committed misdemeanor petty theft (Pen.Code, §§ 484, 488), two misdemeanor batteries (Pen.Code, §§ 242, 243, subd. (a)) and first degree burglary (Pen.Code, §§ 459, 460). He was arrested in April 2002, and he admitted the theft and battery allegations in May 2002. Alex contested the burglary allegation. At the contested jurisdictional hearing, the juvenile court found the burglary allegation true. Alex performed poorly in juvenile hall while the contested jurisdictional and dispositional hearings were pending. In October 2002, Alex was committed to the CYA.
Alex performed poorly at the CYA. His efforts were "marginal" in the CYA programs *174 to which he was assigned. He had difficulty interacting with both peers and staff. Alex was the subject of numerous "Level 1 Behavior Reports" and 12 "Level 2 Behavior Reports" with the last "Level 2" report occurring on December 2, 2003. He also received two "Level 3 Behavior Reports," with the last one occurring on October 2, 2003, and these "Level 3" reports resulted in three months of time being added to his parole consideration date. Alex was on a waiting list for a sex offender counseling program.
In August 2003, this court reversed the juvenile court's order and remanded the matter for reconsideration of the jurisdictional finding on the burglary allegation. On remand, the juvenile court again found the burglary allegation true. It scheduled a contested dispositional hearing. Alex was returned to Juvenile Hall from the CYA in January 2004, and he behaved well in Juvenile Hall between then and the May 2004 conclusion of the dispositional hearing. He received no negative behavior reports during that period. Alex was referred to all available CYA alternative placements, and they all rejected him due to his prior sex offenses and escapes. The juvenile court was unwilling to consider a general placement given Alex's history.
Alex's trial counsel conceded that a CYA commitment was appropriate. However, he asked the court to either dismiss the sex offense counts that Alex had admitted in 2001 or to make the CYA commitment solely on the burglary count in order to avoid Alex being required to register as a sex offender.
The court made it clear that it would be committing Alex to the CYA. The court acknowledged that it had the authority to dismiss the sex offense counts "under either 1385 or under 775," but it declined to do so because "I don't think it's appropriate" and "the interest of justice would not be best served by doing so." "I think it's inappropriate to dismiss something of a serious nature that occurred, that was admitted."
Although the court wanted to find a way to avoid Alex having to register as a sex offender, the court stated "I don't think that I have that jurisdiction or authority." "I think that under the totality of the circumstances of this particular case, given the age of the, the, of the ward at the time of the [sex] offense and given the fact that there has been no subsequent sexual misconduct, I think to require him to register as a result of something that happened when he was thirteen, for the rest of his life, is cruel and unusual punishment." "I'm almost sure if I make an order the Youth Authority may not require him to register, that's going to be null and void."
Alex's trial counsel asked the court officer "what he believes the max time to be in this case." The court officer replied "Thirteen years, ten months." Alex's trial counsel asserted that this figure was incorrect because it included the time for the sex offenses, and the prosecutor had asserted that Alex was only being committed for the current theft, battery and burglary counts. The court replied that "under 726 there's agg[reg]ation." It went on to say "I'm without jurisdiction or authority to do as you request. If I had that discretion I might engage both counsel in additional discussions and I might have exercised that discretion. I believe I do not have discretion." The court officer, not the court, thereafter stated that Alex's maximum period of confinement was 13 years and 10 months. Alex filed a timely notice of appeal.

II. Discussion

A. Aggregation and Sex Offender Registration
Alex asserts that the juvenile court failed to exercise its discretion to commit *175 him to the CYA solely on the current allegations rather than aggregating all of the previously sustained petitions. He argues that a CYA commitment solely on non-sexual offenses would not have resulted in his being required to register as a sex offender under Penal Code section 290.
"Any person who, on or after January 1, 1986, is discharged or paroled from the Department of the Youth Authority to the custody of which he or she was committed after having been adjudicated a ward of the juvenile court pursuant to Section 602 of the Welfare and Institutions Code because of the commission or attempted commission of any offense described in paragraph (3) [which includes Penal Code section 288 offenses and Penal Code section 288a, subdivision (b)(1) offenses] shall be subject to registration under the procedures of this section." (Pen.Code, § 290, subd. (d)(1), emphasis added.)
The Attorney General focuses on the word "after" in subdivision (d)(1) and posits that a person who is committed to the CYA for an offense other than a sex offense is nevertheless required to register as a sex offender so long as the CYA commitment occurred "after" a previous sex offense adjudication. While this is not an implausible interpretation of the isolated language of this subdivision, we are convinced that it is not the appropriate reading of this language.
"As in any case involving statutory interpretation, our fundamental task here is to determine the Legislature's intent so as to effectuate the law's purpose. We begin by examining the statute's words, giving them a plain and commonsense meaning. We do not, however, consider the statutory language `in isolation.' Rather, we look to the entire substance of the statute ... in order to determine the scope and purpose of the provision.... That is, we construe the words in question in context, keeping in mind the nature and obvious purpose of the statute.... We must harmonize the various parts of a statutory enactment ... by considering the particular clause or section in the context of the statutory framework as a whole." (People v. Murphy (2001) 25 Cal.4th 136, 142, 105 Cal.Rptr.2d 387, 19 P.3d 1129, internal citations and quotation marks omitted.)
When we examine Penal Code section 290 as a whole and harmonize its various provisions, it is clear that subdivision (d)(1) was intended to apply only to persons who were committed to the CYA "because of" a sex offense. Penal Code section 290, subdivision (a)(2) provides the main listing of those who are subject to lifelong sex offender registration. Subdivision (a)(2)(B) requires registration by any person "released, discharged, or paroled from a penal institution where he or she was confined because of the commission or attempted commission of [a specified sex offense]." Subdivision (d)(2), which is the companion to subdivision (d)(1), provides: "Any person who is discharged or paroled from a facility in another state that is equivalent to the Department of the Youth Authority, to the custody of which he or she was committed because of [a specified sex offense] shall be subject to registration under the procedures of this section." (Pen.Code, § 290, subd. (d)(2), emphasis added.)
Both of these subdivisions explicitly restrict the registration requirement to persons confined "because of" the commission of a sex offense, and neither of them require a person to register simply because the person was confined "after" the commission of a sex offense that did not result in the confinement. Subdivision (d)(2) is particularly illuminating. It is inconceivable that the Legislature intended to impose a lifelong sex offender registration requirement on a person confined in the *176 CYA "because of" a non-sex offense but "after" a sex offense, while omitting a registration requirement for a person confined in an out-of-state facility equivalent to the CYA"because of" a non-sex offense even if that confinement occurred after a prior sex offense.
The only rational interpretation of the words in subdivision (d)(1) is that the "after" and "because of" language is conjunctive rather than disjunctive. That is, a person is required to register as a sex offender only if the person has been "discharged or paroled" from the CYA and the CYA commitment was both after and because of a sex offense adjudication. If Alex is committed to the CYA only for non-sex offenses, subdivision (d)(1) will not apply and he will not be required to register as a sex offender even though he has previously been adjudicated a ward for sex offenses.
Alex asserts that the juvenile court erred in failing to exercise its discretion to not aggregate his previously sustained sex offense petition as part of the CYA commitment. The Attorney General does not deny that the juvenile court had the discretion to not aggregate Alex's previously sustained petitions. He argues only that the juvenile court "clearly exercised its discretion to not remove the sex offenses from the dispositional order through termination of wardship or dismissal of the earlier petition." (Emphasis added.)
The Attorney General's argument does not answer Alex's assertion. It is true that the juvenile court expressly declined to dismiss the prior sex offense petition, but it does not follow that this decision encompassed an exercise of discretion regarding aggregation.[1] When Alex's trial counsel asserted that the maximum time of confinement should include only the current offenses and not the sex offenses, the court replied that "under 726 there's agg [reg]ation" "I'm without jurisdiction or authority to do as you request. If I had that discretion I might engage both counsel in additional discussions and I might have exercised that discretion. I believe I do not have discretion."
The juvenile court's remarks reflect that it erroneously believed Welfare and Institutions Code section 726 mandated aggregation and that it lacked the discretion to not aggregate.[2] Although the court refused to dismiss the sex offenses in order to avoid Alex being required to register as a sex offender, it expressed its willingness to exercise any discretion it had to accomplish that result through other means. The court's erroneous belief that it lacked the discretion to not aggregate deprived it of the opportunity to attempt to accomplish this result by electing *177 to not aggregate Alex's previously sustained sex offense petition.
The Attorney General's argument suggests that a decision to not aggregate a previously sustained petition necessarily means that either wardship under that petition must be terminated or that petition must be dismissed. We disagree. By granting the juvenile court the discretion to not aggregate previously sustained petitions, the Legislature implicitly permitted the juvenile court to utilize appropriate procedures to modify the prior disposition for a previously sustained petition and impose any appropriate disposition. It is not our role to suggest what disposition the juvenile court should or could select for Alex's previously sustained sex offense petition if it exercised its discretion to not aggregate, but its options are not limited to dismissal.[3] We will remand the matter to the juvenile court to give it the opportunity to exercise its discretion to not aggregate.

B. Maximum Time of Physical Confinement
Alex also contends that the juvenile court failed to exercise its discretion to set his maximum time of physical confinement at less than the maximum term of imprisonment to which an adult convicted of his offenses could have been subjected. His contention requires us to harmonize Welfare and Institutions Code section 726, subdivision (c) and Welfare and Institutions Code section 731, subdivision (b). We conclude that the First District and Fifth District were correct when they resolved this issue in favor of the minor in In re Sean W. (2005) 127 Cal.App.4th 1177, 26 Cal.Rptr.3d 248, and in In re Carlos E. (2005) 127 Cal.App.4th 1529, 26 Cal.Rptr.3d 551 (rev. denied 6/22/05).
"If the minor is removed from the physical custody of his or her parent or guardian as the result of an order of wardship made pursuant to Section 602, the order shall specify that the minor may not be held in physical confinement for a period in excess of the maximum term of imprisonment which could be imposed upon an adult convicted of the offense or offenses which brought or continued the minor under the jurisdiction of the juvenile court. [¶] As used in this section and in Section 731, `maximum term of imprisonment' means the longest of the three time periods set forth in [Penal Code section 1170]. [¶] If the court elects to aggregate the period of physical confinement on multiple counts or multiple petitions, including previously sustained petitions adjudging the minor a ward within Section 602, the `maximum term of imprisonment' shall be the aggregate term of imprisonment specified in [Penal Code section 1170.1]." (Welf. & Inst.Code, § 726, subd. (c), emphasis added.)
"A minor committed to the Department of the Youth Authority may not be held in physical confinement for a period of time in excess of the maximum period of imprisonment which could be imposed upon an adult convicted of the offense or offenses which brought or continued the minor under the jurisdiction of the juvenile court. A minor committed to the Department of the Youth Authority also may not be held in physical confinement for a period of time in excess of the maximum term of physical confinement set by the court based upon the facts and circumstances of *178 the matter or matters which brought or continued the minor under the jurisdiction of the juvenile court, which may not exceed the maximum period of adult confinement as determined pursuant to this section. This section does not limit the power of the Youth Authority Board to retain the minor on parole status for the period permitted by Section 1769." (Welf. & Inst.Code, § 731, subd. (b), emphasis added.)
We encounter no difficulty in interpreting the plain and unambiguous language of these two statutes. Section 726 provides the general rule. A minor may not be held in confinement for a period longer than the "maximum period of imprisonment" (which we will refer to as the MPI) to which an adult convicted of the minor's offenses would be subjected. Section 731 provides an additional rule that applies only to CYA commitments and is potentially more restrictive. The length of a minor's confinement in the CYA is restricted by both the MPI and the "maximum term of physical confinement set by the court based upon the facts and circumstances" of the minor's offenses (which we will call the MTPC).
Here, Alex was committed to the CYA. The record reflects that the court erroneously believed it had no discretion to set an MTPC that was different from the MPI. We will remand this matter to permit the court to exercise its discretion to set an appropriate MTPC based on the facts and circumstances of those of Alex's offenses upon which it chooses to impose a CYA commitment.[4]

III. Disposition
The juvenile court's order is reversed. The matter is remanded to the juvenile court to permit the court to exercise its discretion (1) whether or not to aggregate Alex's previously sustained petitions and (2) to set a maximum term of physical confinement based on the facts and circumstances of those of Alex's offenses upon which it chooses to impose a CYA commitment.
BAMATTRE-MANOUKIAN, Acting P.J., and McADAMS, J., concur.
NOTES
[1]  The record does not reflect that the juvenile court explicitly considered or rejected termination of wardship on, as opposed to dismissal of, the previously sustained sex offense petition. The juvenile court did not want to eliminate the sex offense adjudication from Alex's record, but termination of wardship would not have had that effect.
[2]  As the Attorney General implicitly concedes, a juvenile court has discretion to aggregate or not. "If the court elects to aggregate the period of physical confinement on multiple counts or multiple petitions, including previously sustained petitions adjudging the minor a ward within Section 602, the `maximum term of imprisonment' shall be the aggregate term of imprisonment specified in subdivision (a) of Section 1170.1 of the Penal Code...." (Welf. & Inst.Code, § 726, subd. (c).) Obviously this statute permits the juvenile court to elect not to aggregate the period of physical confinement on a previously sustained petition. "Aggregation is not mandatory or automatic, but rests within the sound discretion of the juvenile court." (In re Adrian R. (2000) 85 Cal.App.4th 448, 454, 102 Cal.Rptr.2d 173; In re Richard W. (1979) 91 Cal.App.3d 960, 982, 155 Cal.Rptr. 11.)
[3]  The juvenile court may, in an appropriate case, elect to impose probation, a stayed juvenile hall commitment or even possibly a stayed CYA commitment for the previously sustained sex offense petition. None of these dispositional options would necessarily result in Alex being required to register as a sex offender.
[4]  If the court chooses not to aggregate, the MPI will also change. Obviously, the MTPC, like the MPI, should not be based on any non-aggregated offenses for which a CYA commitment is not imposed.
