If the person or officer on whom any writ of habeas corpus has been duly served refuses or neglects to obey the same, by producing the body of the party named or described therein, and by making a full and explicit return thereto, within the time required, and no sufficient excuse is shown for such refusal or neglect, it is the duty of the court or judge before whom the writ has been made returnable, upon due proof of the service thereof, forthwith to issue an attachment against such person or officer, directed to the sheriff of any county within this State, and commanding him forthwith to apprehend such person or officer and bring him immediately before such court or judge. On being so brought such person or officer shall be committed to close custody in the jail of the county where such court or judge may be, without being allowed the liberties thereof, until such person or officer make return to such writ and comply with any order that may be made by such court or judge in relation to the party for whose relief the writ has been issued.
N.C. Gen. Stat. § 17-16