After hearing the matter both upon the response and any other evidence, the court shall either discharge or remand the petitioner, grant him any other relief to which he is entitled, or admit him to bail and adjudge the cost of the proceeding, including the charge for transporting the prisoner, provided, however, that if the petition is denied, the costs and expenses of the proceeding and the attorney fees of any attorney appointed to represent the petitioner shall be assessed against the petitioner. If such cost, expenses, and fees are collected, they shall be paid to the Commonwealth. When relief is granted upon a petition for a writ of habeas corpus, the order granting relief on the writ shall be served on the respondent and the petitioner. Service may, in the court's discretion, be accomplished by personal service or by transmitting a certified copy of the order to the parties via regular or certified mail, a third-party commercial carrier, or electronic delivery. Code 1950, § 8-603; 1968, c. 482; 1977, c. 617; 2019, cc. 8 , 8 .
|