When a direction to release the person arrested on bail is contained in the warrant of attachment or endorsed on the warrant, the arrested person must be discharged from the arrest upon executing and delivering to the officer, at any time before the return day of the warrant, a written undertaking, with two sufficient sureties, to the effect that the person arrested will appear on the return of the warrant and abide the order of the court or judge or the sureties will pay, as may be directed, the sum specified in the warrant or ordered by the court or the judge.
§ 3-1-516, MCA