A cancer patient from Montgomery, Illinois, has been sentenced to four years in prison for ordering a 42-pound package of chocolate marijuana edibles to self-medicate. The day after he pleaded guilty, the state legalized recreational marijuana.

Thomas J. Franzen ordered 430 marijuana-infused chocolate bars from a California dispensary in 2014 in order to abate some of his symptoms, such as nausea. He pleaded guilty on May 30 to possession of more than 5,000 grams of cannabis, which carries a prison term of four to 14 years.

Prosecutors dropped the more serious charge of trafficking over 5,000 grams of cannabis, which could have put Franzen behind bars for up to 60 years.

David Camic, Franzen’s attorney, praised the judge who presided over the case. “The judge was cognizant of his health and wanted to give him a break, but ultimately 40 pounds of cannabis is a large amount,” he tells the Chicago Tribune.

But it is difficult to view this outcome as either compassionate or just, considering that Franzen caused no obvious harm to another human being. He has a debilitating disease that very well might kill him—his cancer is stage 4—and he’s going to prison for ordering too much medicine. Four years is better than 60, but the appropriate amount of prison time for this is none.

Franzen will return to court on June 14, at which time Judge Clint Hull will review medical test results to determine when Franzen should begin his sentence. “He’s going through necessary medical treatment and hopefully he’s in a period of remission,” Camic tells the Tribune. “The judge was very kind to delay the sentencing because he will not receive the same level of care in prison that he’s receiving now.”