Except as provided below, counsel assigned pursuant to § 23A-40-6 and subdivision 23A-40-7(2) shall, after the disposition of the cause, be paid by the county in which the action is brought, or, in case of a parole revocation, by the county from which the inmate was sentenced, a reasonable and just compensation for the services and for necessary expenses and costs incident to the proceedings in an amount to be fixed by a judge of the circuit court or a magistrate judge within guidelines established by the presiding judge of the circuit court.
If the cause originated from a criminal offense committed by an inmate under confinement in a facility operated by the Department of Corrections, the Department of Corrections must, after the disposition of the cause, pay counsel assigned pursuant to § 23A-40-6, a reasonable and just compensation for the services and for necessary expenses and costs incident to the proceedings in an amount to be fixed by a judge of the circuit court or a magistrate judge within guidelines established by the presiding judge of the circuit court.
SDCL 23A-40-8