An Illinois cancer patient has been sentenced to prison for ordering 42 pounds of THC-infused chocolates that he claims he purchased to self-medicate.

Thomas Franzen, 37, pleaded guilty to possession of more than 5,000 grams of cannabis in exchange for a 4-year prison sentence, the Kane County State's Attorney's Office said.

Prosecutors said in a news release on Thursday that Franzen "sought to sell" the chocolate, but Franzen's defense attorney said he was using them to relieve himself from stage 4 cancer symptoms, like nausea.

Attorney David Camic said prosecutors showed “compassion” in dismissing the more serious charge of cannabis trafficking after authorities intercepted the chocolates in 2014.

DR. MARC SIEGEL: POT AND YOUR HEALTH — HERE'S WHAT A PHYSICIAN WANTS YOU TO KNOW ABOUT MARIJUANA

THC, or tetrahydrocannabinol, is "the main psychoactive compound in marijuana that gives the high sensation," according to Healthline. In addition to cigarette form, THC also comes in "oils, edibles, tinctures, capsules."

Kane County State's Attorney Joe McMahon said in a statement that because of Franzen's medical condition, his office "reduced a 12-year mandatory minimum sentence to 4 years, of which he is required to serve only 2 years."

"We did this in spite of evidence that proves that Mr. Franzen is a drug dealer," McMahon said, and added: “Evidence from state and federal investigators shows that he has purchased and sold marijuana products across North America."

CLICK HERE TO GET THE FOX NEWS APP

The state's attorney continued: “The marijuana-laced product found at Mr. Franzen’s home was not purchased from a medical marijuana business, and the amount he purchased far exceeds what would be used for personal consumption and is evidence that he is a drug dealer.”

Franzen is due in court June 14, when he will present results of new medical tests to Judge Clint Hull, who will decide when Franzen will begin serving his prison term.

The Associated Press contributed to this report.