BOSTON — Cayla Plasse was addicted to drugs.

After pleading guilty to shoplifting, a judge offered her numerous chances to remain out on probation and get treatment. But Plasse kept using drugs and breaking her probation.

Finally, at the request of Plasse and her family, an Orange District Court judge sentenced her to jail, ensuring she would remain incarcerated for the time needed to complete an intensive residential addiction treatment program run by the Hampden County Sheriff’s Department.

Did the judge act appropriately in considering her need to complete a rehabilitation program in fashioning the jail sentence?

The Massachusetts Supreme Judicial Court on Thursday decided unanimously that yes, the judge was allowed to consider her need for residential treatment in sending Plasse to jail.

“After the defendant’s failure to make use of the opportunity to avoid incarceration while on probation, the judge sought to maintain an appropriate balance between the defendant’s individualized needs and those of the community in which she resides,” Justice Barbara Lenk wrote for the court.

As attitudes toward drug addiction have shifted in society, and addiction is seen increasingly as an illness, not a crime, the Supreme Judicial Court has occasionally heard cases addressing the criminal justice implications of this shift.

In July, the court ruled that someone who is addicted to drugs can be required to remain drug-free as part of their probation, and can be found to have violated probation if they use an illegal drug.

The latest decision, Commonwealth vs. Cayla Plasse, addresses a unique set of circumstances, but also has implications for how judges should approach sentencing for people who are addicted to drugs.

After Plasse, then 21, pleaded guilty to stealing from a department store, a judge said he would dismiss the charge if she spent a year on probation, completed a shoplifting prevention program and was supervised by the community corrections department, which performed drug and alcohol screenings.

For three years, Plasse repeatedly violated the terms of her probation. She tested positive for THC, which is the compound in marijuana, cocaine, amphetamine and morphine. The judge required her to enter three different residential treatment programs, but she kept leaving the programs because of drug use. Eventually, she lost contact with her probation officer.

Finally, Plasse’s family and even Plasse agreed that she needed to be incarcerated to receive treatment. Her attorney asked the judge to sentence her to at least nine months in jail so she could complete a particular drug treatment program.

The judge imposed a sentence of two years, with enough credits that she could be released in nine or 10 months, saying he was doing it “not to punish (her) but to make sure that she gets through a program and is back out on the street safe and alive.”

Months later, Plasse, represented by a new lawyer, asked to be released. Although she has since been released from jail, the SJC agreed to take to case to consider the larger implications of whether a judge can consider rehabilitative programming in fashioning a sentence.

The court found that as long as the sentence is within the guidelines allowed by state law, a judge can consider rehabilitative programming, if a defendant asks for it.

“In circumstances in which a defendant specifically requests a judge's consideration of his or her substance abuse issues and related need to complete a rehabilitative program while incarcerated, the judge may take these factors into account,” the court found.

The court did emphasize that its decision was primarily due to the unusual circumstances in this case — where the judge for three years recognized that incarceration was not the best way of achieving rehabilitation and only imposed a jail sentence once everything else failed, and once Plasse and her family acknowledged that she needed incarceration to complete treatment.