(a) If the petition, affidavits, exhibits, records and other documentary evidence attached thereto, or the record in the proceedings which resulted in the conviction and sentence, or the record or records in a proceeding or proceedings on a prior petition or petitions filed under the provisions of this article, or the record or records in any other proceeding or proceedings instituted by the petitioner to secure relief from his conviction or sentence (if any such record or records are part of the official court files of the court with whose clerk the petition is filed or are part of the official court files of any other court within the same judicial circuit as the court with whose clerk such petition is filed and are thus available for examination and review by such court) show to the satisfaction of the court that the petitioner is entitled to no relief, or that the contention or contentions and grounds (in fact or law) advanced have been previously and finally adjudicated or waived, the court shall by order entered of record refuse to grant a writ, and such refusal shall constitute a final judgment. If it appears to such court from said petition, affidavits, exhibits, records and other documentary evidence, or any such available record or records referred to above, that there is probable cause to believe that the petitioner may be entitled to some relief, and that the contention or contentions and grounds (in fact or law) advanced have not been previously and finally adjudicated or waived, the court shall forthwith grant a writ, directed to and returnable as provided in subsection (b) hereof. If any such record or records referred to above are not a part of the official court files of the court with whose clerk the petition is filed or are not part of the official court files of any other court within the same judicial circuit as the court with whose clerk such petition is filed and are thus not available for examination and review by such court, the determination as to whether to refuse or grant the writ shall be made on the basis of the petition, affidavits, exhibits, records and other documentary evidence attached thereto.
(b) Any writ granted in accordance with the provisions of this article shall be directed to the person under whose supervision the petitioner is incarcerated. Whether the writ is granted by the supreme court of appeals, a circuit court, or any statutory court in this state, it shall, in the discretion of the court, be returnable before (i) the court granting it, (ii) the circuit court, or a statutory court, of the county wherein the petitioner is incarcerated, or (iii) the circuit court, or the statutory court, in which, as the case may be, the petitioner was convicted and sentenced.
(c) The clerk of the court to which a writ granted in accordance with the provisions of this article is made returnable shall promptly bring the petition and any affidavits, exhibits, records and other documentary evidence attached thereto, and the writ to the attention of the court if the writ was granted by some other court, and in every case deliver a copy of such petition and any affidavits, exhibits, records and other documentary evidence attached thereto and the writ to the prosecuting attorney of the county, or the attorney general if the writ is returnable before the supreme court of appeals. The prosecuting attorney or the attorney general, as the case may be, shall represent the state in all cases arising under the provisions of this article.