When two or more persons shall be indicted together, the court may, at any time before the defendant has gone into his defense, direct any one of the defendants to be discharged that he may be a witness for the state. An accused may, also, when there is not sufficient evidence to put him upon his defense, be discharged by the court; or, if not discharged by the court, shall be entitled to the immediate verdict of the jury, for the purpose of giving evidence for others accused with him. Such order of discharge in either case shall be a bar to another prosecution for the same offense.
Neb. Rev. Stat. §§ 29-2012