A judge of the district or county court who has knowledge that any person is illegally confined or restrained in the person's liberty within the judge's district or county may, if the case is within the judge's jurisdiction, issue the writ of habeas corpus, without any application being made for the writ .
Tex. Code Crim. Proc. § 11.16