The writ of habeas corpus is intended to be applicable to all such cases of confinement and restraint, where there is no lawful right in the person exercising the power, or where, though the power in fact exists, it is exercised in a manner or degree not sanctioned by law.
Tex. Code Crim. Proc. § 11.23