(a) Any surety, desiring to surrender his principal and after notifying the principal’s attorney, if the principal is represented by an attorney, in a manner provided by Rule 21a, Texas Rules of Civil Procedure, of the surety’s intention to surrender the principal, may file an affidavit of such intention before the court or magistrate before which the prosecution is pending. The affidavit must state:
(1) the court and cause number of the case;
(2) the name of the defendant;
(3) the offense with which the defendant is charged;
(4) the date of the bond;
(5) the cause for the surrender; and
(6) that notice of the surety’s intention to surrender the principal has been given as required by this subsection.
(b) In a prosecution pending before a court, if the court finds that there is cause for the surety to surrender the surety’s principal, the court shall issue a capias for the principal. In a prosecution pending before a magistrate, if the magistrate finds that there is cause for the surety to surrender the surety’s principal, the magistrate shall issue a warrant of arrest for the principal. It is an affirmative defense to any liability on the bond that:
(1) the court or magistrate refused to issue a capias or warrant of arrest for the principal; and
(2) after the refusal to issue the capias or warrant of arrest, the principal failed to appear.
(c) If the court or magistrate before whom the prosecution is pending is not available, the surety may deliver the affidavit to any other magistrate in the county and that magistrate, on a finding of cause for the surety to surrender the surety’s principal, shall issue a warrant of arrest for the principal.
(d) An arrest warrant or capias issued under this article shall be issued to the sheriff of the county in which the case is pending, and a copy of the warrant or capias shall be issued to the surety or his agent.
(e) An arrest warrant or capias issued under this article may be executed by a peace officer, a security officer, or a private investigator licensed in this state.