(a) A civil action or claim initiated against the state, the Board of Corrections, the Division of Correction, the Division of Community Correction, another state agency, or a political subdivision, or an original action in an appellate court, or an appeal of an action, whether or not the plaintiff was represented in court, by an inmate in a penal institution or an incarcerated person appearing pro se may be:
(1) Dismissed without prejudice by the court on its own motion or on a motion of the defendant, if all administrative remedies available to the inmate have not been exhausted; or
(2) Dismissed with prejudice by the court on a motion of the defendant if the court is satisfied that the action is frivolous or malicious.
(b) As used in this section, “civil action” does not include a petition for a writ of habeas corpus or other petition for post-conviction release in which the court is jurisdictionally empowered to grant release from incarceration or a reduction in sentence.