A person indicted for a crime shall not be convicted thereof except by confessing his guilt in open court, by admitting the truth of the charge against him by his plea or demurrer or by the verdict of a jury accepted and recorded by the court or, in any criminal case other than a capital case, by the judgment of the court. Any defendant in a criminal case other than a capital case, whether begun by indictment or upon complaint, may, if he shall so elect, when called upon to plead, or later and before a jury has been impanelled to try him upon such indictment or complaint, waive his right to trial by jury by signing a written waiver thereof and filing the same with the clerk of the court. If the court consents to the waiver, he shall be tried by the court instead of by a jury, but not, however, unless all the defendants, if there are two or more charged with related offenses, whether prosecuted under the same or different indictments or complaints shall have exercised such election before a jury has been impanelled to try any of the defendants; and in every such case the court shall have jurisdiction to hear and try such cause and render judgment and sentence thereon. Except where there is more than one defendant involved as aforesaid, consent to said waiver shall not be denied in the district court or the Boston municipal court if the waiver is filed before the case is transferred for jury trial to the appropriate jury session, as provided in section twenty-seven A of chapter two hundred and eighteen.
Mass. Gen. Laws ch. 263, § 6