If it appears by affidavit that the testimony of a person is material in any felony criminal proceeding and that it may become impracticable to secure his presence by subpoena, the judge may require such person to give bail pursuant to Rules of Criminal Procedure for his appearance as a witness. If the witness fails to give bail pursuant to Rules of Criminal Procedure, the witness may be committed to the custody of the sheriff for a period not to exceed five days within which time his deposition shall be taken as provided by Rules of Criminal Procedure. The court upon good cause shown may extend the time for taking such depositions for a period not exceeding five days. In no case except a first or second degree felony shall any surety be required for the bail of such witness.
NMS § 31-3-7