(a)(1) An application for a writ of habeas corpus, other than an application pursuant to subdivision (2) of this subsection, shall be made to the superior court, or to a judge thereof, for the judicial district in which the person whose custody is in question is claimed to be illegally confined or deprived of such person’s liberty.

(2) An application for a writ of habeas corpus claiming illegal confinement or deprivation of liberty, made by or on behalf of an inmate or prisoner confined in a correctional facility as a result of a conviction of a crime, shall be made to the superior court, or to a judge thereof, for the judicial district of Tolland.

(b) The application shall be verified by the affidavit of the applicant for the writ alleging that he truly believes that the person on whose account the writ is sought is illegally confined or deprived of his liberty.

(c) The writ shall be directed to some proper officer to serve and return, who shall serve the same by putting a true and attested copy of it into the hands of the person who has the custody of the body of the person who is directed to be presented upon the writ. If the officer fails to make immediate return of the writ, with his actions thereon, he shall pay fifty dollars to the person so held in custody.

(d) Any judge of the Superior Court to whom an application for a writ of habeas corpus is made may make the writ returnable before any other judge of the court, the consent of the other judge being first obtained; and the other judge shall thereupon proceed with the matter with the same authority as though the application had been originally presented to him.

(e) If the application is made to a judge, the judge may certify the proceedings into court and the case shall thereupon be entered upon the docket and proceeded with as though the application had originally been made to the court.

(f) A foster parent or an approved adoptive parent shall have standing to make application for a writ of habeas corpus regarding the custody of a child currently or recently in his care for a continuous period of not less than ninety days in the case of a child under three years of age at the time of such application and not less than one hundred eighty days in the case of any other child.