California Welfare And Institutions Code Section 1769

(a) Every person committed to the Department of the Youth Authority by a juvenile court shall, except as provided in subdivision (b), be discharged upon the expiration of a two-year period of control or when the person reaches his or her 21st birthday, whichever occurs later, unless an order for further detention has been made by the committing court pursuant to Article 6 (commencing with Section 1800). (b) Every person committed to the Department of the Youth Authority by a juvenile court who has been found to be a person described in Section 602 by reason of the violation of any of the offenses listed in subdivision (b), paragraph (2) of subdivision (d), or subdivision (e) of Section 707, shall be discharged upon the expiration of a two-year period of control or when the person reaches his or her 25th birthday, whichever occurs later, unless an order for further detention has been made by the committing court pursuant to Article 6 (commencing with Section 1800).