A Queenstown man caught with illegal substances in his house has avoided a conviction because they help him deal with chronic pain.
He also escaped conviction for having a military-style semi-automatic rifle with a 30-round magazine.
The man, who appeared in the Queenstown District Court last month, was granted permanent name suppression.
Police smelled cannabis when they went to his home on an unrelated matter on June 22 last year.
A search uncovered an AR15 rifle in a carry bag on his bed, 372g of cannabis in his bedroom and bathroom, 0.1g of MDMA on his dressing table and 0.1g of methamphetamine in his wallet.
A pipe for smoking cannabis was on his bedside table, and a "snuff bullet'' for sniffing cocaine was on the dressing table.
The defendant's counsel, Bill Dawkins, said his client suffered from "massive pain'' as a result of twice breaking his neck.
He took about 1200 painkillers a month to deal with his pain, but they were "not doing it''.
He was a heavy user of cannabis for "medicinal purposes'', but the other drugs in the house were "odds and sods'' left behind by visitors.
The defendant had bought the AR15 legally with his category A firearms licence, Mr Dawkins said. But he later bought the 30-round magazine on the internet, unaware it made the rifle illegal for that licence category.
Although "ignorance of the law excuses no-one'', it was a mitigating factor.
Judge John Brandts-Giesen said he had decided "by a narrow margin'' to grant a discharge without conviction on the grounds the consequences of a conviction would outweigh the seriousness of the offending.
The possession of the AR15 was the most serious charge, but the defendant's explanation was at least partly accepted by the police prosecutor.
He had used it for hunting and to put down deer on a farm, and, like many people, had exploited a "well-known gap in the law'' to pair it with a high-capacity magazine.
In relation to the drugs, an anaesthetist's report stated the defendant was "far better'' when regularly using cannabis, and a legal cannabis substitute was very expensive.
It had been "unwise'' of him to keep the other drugs, which had been given to him by a visitor.
The defendant was "overcoming great odds in order to work'' but by possessing illegal drugs faced the risk of being convicted in the future.
"Section 106 discharges are not given liberally to people, particularly not in a case of reoffending.''
He ordered the destruction of the firearm and the drugs.
The defendant's arrest preceded recent law changes, resulting from the Christchurch mosque shootings in March, which ban military-style semi-automatic rifles and high-capacity magazines.