When two or more defendants are jointly indicted, the court may, at any time before the evidence for the defense has commenced, order any defendant to be discharged from the indictment in order that he may be a witness for the prosecution, and such order operates as an acquittal of such defendant, provided he does testify.
Ala. Code § 12-21-223 (1975)