(a) A court may grant a defendant credit toward a sentence of imprisonment for time spent in a treatment program that furthers the reformation and rehabilitation of the defendant if the court finds that the program places a substantial restriction on the defendant's freedom of movement and behavior and is consistent with this section.
(b) A court may only grant credit under this section
(1) in the amount of one day of credit toward a sentence of imprisonment for each full day the defendant spent in a treatment program; and
(2) if the court ordered the defendant to participate in and comply with the conditions of the treatment program before the defendant entered the program.
(c) In granting credit toward a sentence of imprisonment for time spent in a treatment program, a court shall consider the following factors:
(1) the restrictions on the defendant's freedom of movement and behavior;
(2) the circumstances under which the defendant was enrolled in the program;
(3) the residency requirements of the program;
(4) the physical custody and supervision of the defendant at the program;
(5) the circumstances under which the defendant is permitted to leave the program's facility;
(6) the rules of the program and the requirement that the defendant obey the orders of persons who have immediate custody or control over the defendant;
(7) the sanctions on the defendant for violating the program's rules or orders;
(8) whether the defendant is subject to arrest for leaving the program's facility without permission;
(9) the use of an electronic monitoring device;
(10) whether the program provides substance abuse treatment;
(11) the use of other technology that monitors or restricts the defendant's movement and behavior;
(12) other factors that support the court's finding that the program places a substantial restriction on the defendant's freedom of movement and behavior;
(13) other factors that support the court's finding that the program furthers the reformation and rehabilitation of the defendant.
(d) A court may grant credit against a sentence of imprisonment for time spent under electronic monitoring if the person has not committed a criminal offense while under electronic monitoring and the court imposes restrictions on the person's freedom of movement and behavior while under the electronic monitoring program, including requiring the person to be confined to a residence except for a
(1) court appearance;
(2) meeting with counsel; or
(3) period during which the person is at a location ordered by the court for the purposes of employment, attending educational or vocational training, performing community volunteer work, or attending a rehabilitative activity or medical appointment.
(e) If a defendant intends to claim credit toward a sentence of imprisonment for time spent in a treatment program or under electronic monitoring either as a condition of probation or as a condition of bail release after a petition to revoke probation has been filed, the defendant shall file notice with the court and the prosecutor 10 days before the disposition hearing. The notice shall include the amount of time the defendant is claiming. The defendant must prove by a preponderance of the evidence that the credit claimed meets the requirements of this section. A court may not consider, except for good cause, a request for credit made under this subsection more than 90 days after the disposition hearing.
(f) To qualify as a treatment program under this section, a program must
(1) be intended to address criminogenic traits or behaviors;
(2) provide measures of progress or completion; and
(3) require notification to the prosecuting authority, pretrial services officer, or probation officer if the person is discharged from the program for noncompliance.
(g) Unless the defendant participated in a residential treatment program under (c) and (f) of this section while under electronic monitoring, a court may not grant credit against a sentence of imprisonment under (d) of this section if the sentence is for
(1) a felony crime against a person under AS 11.41;
(2) a crime involving domestic violence as defined in AS 18.66.990;
(3) an offense under AS 11.71 involving the delivery of a controlled substance to a person under 19 years of age;
(4) burglary in the first degree under AS 11.46.300; or
(5) arson in the first degree under AS 11.46.400.
(h) Nothing in this section authorizes the release of a person on electronic monitoring after conviction and while awaiting sentencing if the person is ineligible for release under AS 12.30.040(b).
(i) A court may not grant credit under this section for time spent in a treatment program or under electronic monitoring for a sex offense as defined in AS 12.63.100.
(j) A court may grant credit under this section for time spent in a treatment program or under electronic monitoring if the court finds that the sentence, including credit toward the sentence of imprisonment, meets the requirements of AS 12.55.005.
(k) When a court grants credit toward a sentence of imprisonment under this section, if a defendant spends time in a treatment program while under electronic monitoring, the court may grant credit for either the time spent in the treatment program or for the time spent under electronic monitoring, but not for both.
(l) A court granting credit against a sentence of imprisonment under (a) of this section may grant credit of not more than 365 days against the total term of imprisonment imposed.