41-5-1413. Right to counsel -- assignment of counsel. In all proceedings following the filing of a petition alleging that a youth is a delinquent youth or youth in need of intervention, the youth and the parents or guardian of the youth must be advised by the court or, in the absence of the court, by its representative that the youth may be represented by counsel at all stages of the proceedings. If counsel is not retained or if it appears that counsel will not be retained for the youth, the court shall order the office of state public defender, provided for in 2-15-1029, to assign counsel for the youth pursuant to the Montana Public Defender Act, Title 47, chapter 1, unless the right to counsel is waived by the youth and the parents or guardian. Neither the youth nor the youth's parents or guardian may waive the right to counsel after a petition has been filed if commitment to the department for a period of more than 6 months may result from adjudication.