Application for a writ of habeas corpus shall be by petition, in writing, sworn to by the person for whose relief it is intended, or by someone in his behalf, describing where and by whom he is deprived of liberty, and the facts and circumstances of the restraint, with the ground relied on for relief; and the application shall be made to the judge or chancellor of the district in which the relator is imprisoned, unless good cause be shown in the petition to the contrary. However, any petition filed by an inmate of any training school or hospital attacking his commitment for a claimed denial of a fundamental constitutional right under the Constitution of the State of Mississippi or of the United States which would affect his commitment shall be filed in a court of the county from which he was committed. And, if filed in any other court, the judge of that court shall, if he grants the writ, make it returnable to a court of the county from which the relator was committed; and in the case of a person committed by a youth court, not less than five (5) days’ notice prior to hearing shall be given to the county attorney or district attorney of the county of commitment.