The superior court, any district court and any juvenile court may place on probation in the care of its probation officer any person before it charged with an offense or a crime for such time and upon such conditions as it deems proper, with the defendant's consent, before trial and before a plea of guilty, or in any case after a finding or verdict of guilty; provided, that, in the case of any child under the age of 18 placed upon probation by the superior court, he may be placed in the care of a probation officer of any district court or of any juvenile court, within the judicial district of which such child resides; and provided further, that no person convicted under section twenty-two A, 22B, 22C, 24B or subsection (b) of section 50 of chapter two hundred and sixty-five or section thirty-five A of chapter two hundred and seventy-two shall, if it appears that he has previously been convicted under said sections and was eighteen years of age or older at the time of committing the offense for which he was so convicted, be released on parole or probation prior to the completion of five years of his sentence.
Mass. Gen. Laws ch. 276, § 87