A terminal cancer patient who faced up to 15 years in prison for growing marijuana that he says was used to treat his tumors was instead sentenced to probation by an Iowa judge Tuesday.

The Quad-City Times' Brian Wellner first reported the surprise ruling Tuesday afternoon:

Benton Mackenzie, 48, faced at least three and as much as 15 years in prison, but District Judge Henry Latham instead chose to grant Mackenzie a three-year probation, Wellner reported.

About a dozen demonstrators rallied in support of Mackenzie outside Scott County Courthouse in Davenport, Iowa before the ruling came down, holding signs that read "Stop arresting patients" and "Treating illness is a right."

The use of medical marijuana is currently illegal in Iowa in nearly all cases.

Since his conviction earlier this year, Mackenzie has been traveling to Oregon, where marijuana is legal for medical purposes and where out-of-state patients are allowed to take advantage of the more permissive laws, to obtain medical cannabis to help treat his angiosarcoma, a cancer of the blood vessels. Latham warned Mackenzie on Tuesday that he must remain "substance abuse"-free while on probation or could face prison time, according to the Associated Press.

"You are a man with intelligence and passion. I hope you can put your efforts to a more constructive use than to continue to violate the laws of this state," Latham said.

In July, Mackenzie and his wife Loretta were convicted in an Iowa district court of marijuana manufacturing and conspiracy for growing 71 marijuana plants at Mackenzie's parents' home in Long Grove, Iowa. Local authorities seized the plants in a 2013 raid of the home. Mackenzie said he had grown the plants to make cannabidiol, or CBD, a non-psychoactive compound in cannabis, to treat his tumors. Mackenzie's son Cody, 22, was found guilty of misdemeanor possession of marijuana and paraphernalia.

On Tuesday, the judge also sentenced Mackenzie's wife and son to probation.

Mackenzie suffers from severe angiosarcoma, a rare and aggressive form of cancer that produces large skin lesions. Photos documenting Mackenzie's legal case and his cancerous lesions have been posted to the "Free Benton Mackenzie" Facebook page. In July, Loretta Mackenzie wrote on Facebook that Benton's condition had worsened in the last several months. She included a recent photo depicting large, discolored tumors on her husband's skin. WARNING: PHOTOS ARE GRAPHIC.

Latham had barred Mackenzie from using any defense that included the claim that he'd grown cannabis for medical necessity. Mackenzie had said he was threatened with jail if he talked about his health in court and that he would not be likely to survive a prison sentence.

Loretta said in court Tuesday that her husband's condition is getting "a lot worse," according to Wellner.

It's not clear how, if at all, Mackenzie plans to treat his condition without the use of medical cannabis.

Earlier this year, Iowa Gov. Terry Branstad (R) signed into law a measure that legalized the use of CBD oil to treat epilepsy. That law, however, focuses narrowly on treatment for "intractable epilepsy" and could not be applied to Mackenzie -- a reality that the editorial board of The Des Moines Register strongly criticized in a July statement.

"The change in law benefits only a small group of Iowans with the most organized lobbying efforts," the paper's editors wrote. "Other sick Iowans should have legal access to marijuana extracts, too. These include people with painful and debilitating conditions like cancer, spinal cord injuries and severe arthritis, who may benefit from the drug. But if these people obtain cannabis oil, they will still be considered criminals in this state."

Iowa voters overwhelmingly support the legalization of medical marijuana. A recent poll found that 81 percent of those asked were in favor of legalization.