§ 17-3. Who may prosecute writ.
Every person imprisoned or restrained of his liberty within this State, for any criminal or supposed criminal matter, or on any pretense whatsoever, except in cases specified in G.S. 17-4, may prosecute a writ of habeas corpus, according to the provisions of this Chapter, to inquire into the cause of such imprisonment or restraint, and, if illegal, to be delivered therefrom. (1868-9, c. 116, s. 1; Code, s. 1623; Rev., s. 1821; C.S., s. 2205.)