A child between 12 and 18 years of age, held by the court for further examination, trial or continuance, or for indictment and trial, may at the discretion of the court be referred to the department of youth services, any court clinic, or the department of mental health, with its consent, and with the consent of the parents or guardian, for diagnostic study on an inpatient or outpatient basis; and, upon completion of such study, the department of youth services, court clinic or department of mental health, as the case may be, shall forward a report and recommendations to the court. In default of bail, any such child may be committed by the court to the department of youth services for a period not to exceed thirty days while undergoing diagnostic study. At the expiration of such period, such child shall be returned to the court, together with the report and recommendations to the department of youth services.
Mass. Gen. Laws ch. 119, § 68A