(a) Joinder of Offenses.(1) Related Offenses. Two of more offenses are related offenses if they are based on the same criminal conduct or episode or arise out of a course of criminal conduct or series of criminal episodes connected together or constituting parts of a single scheme or plan.(2) Joinder of Related Offenses in Complaint or Indictment. If two or more related offenses are of the same or similar character, they may be charged in the same indictment or complaint, with each offense stated in a separate count.(3) Joinder of Related Offenses for Trial. If a defendant is charged with two or more related offenses, either party may move for joinder of such charges. The trial judge shall join the charges for trial unless he determines that joinder is not in the best interests of justice.(4) Joinder of Unrelated Offenses. Upon the written motion of a defendant, or with his written consent, the trial judge may join for trial two or more charges of unrelated offenses upon a showing that failure to try the charges together would constitute harassment or unduly consume the time or resources of the parties. The trial judge shall join the charges for trial unless he determines that joinder is not in the best interests of justice.(b) Joinder of Defendants. Two or more defendants may be joined in the same indictment or complaint if the charges against them arise out of the same criminal conduct or episode or out of a course of criminal conduct or series of criminal episodes so connected as to constitute parts of a single scheme, plan, conspiracy or joint enterprise. The defendants may be charged separately or together in one or more counts; all of the defendants need not be charged in each count.(c) Consolidation of Offenses or Defendants on Motion of Court. The trial judge may order two or more indictments or complaints to be tried together if the offenses and the defendants, if more than one, could have been joined in a single indictment or complaint. The procedure shall be the same as if the prosecution were under a single indictment or complaint.(d) Relief From Prejudicial Joinder.(1) In General. If it appears that a joinder of offenses or of defendants is not in the best interests of justice, the judge may upon his own motion or the motion of either party order an election of separate trials of counts, grant a severance of defendants, or provide whatever other relief justice may require.(2) Motion by the Defendant. A motion of the defendant for relief from prejudicial joinder shall be in writing and made before trial and shall be supported by an affidavit setting forth the grounds upon which any alleged prejudice rests, except that a motion for severance may be made before or at the close of all the evidence if based upon a ground not previously known.(e) Conspiracy. An indictment or complaint for conspiracy to commit a substantive offense shall not be tried simultaneously with an indictment or complaint for the commission of the substantive offense, unless the defendant moves for joinder of such charges pursuant to subdivision (a) of this rule.