TORONTO -- A three-year mandatory minimum sentence for gun possession is "cruel and unusual punishment," Ontario's top court ruled Tuesday in striking down a plank of Ottawa's law-and-order agenda.

The sentencing law, enacted as part of the Conservatives' 2008 omnibus bill, could see people sent to prison for three years for what would amount to a licence violation, the Court of Appeal for Ontario ruled.

In that scenario, there is a "cavernous disconnect" between the severity of such an offence and the severity of the sentence, the court ruled.

The law as written could capture anyone from a person keeping an unloaded restricted gun, with ammunition accessible, in their cottage when their licence requires it to be in their home, to a person standing on a street corner with a loaded gun in his back pocket "which he intends to use as he sees fit," the court said.

"No system of criminal justice that would resort to punishments that 'outrage standards of decency' in the name of furthering the goals of deterrence and denunciation could ever hope to maintain the respect and support of its citizenry," the court ruled.

"Similarly, no system of criminal justice that would make exposure to a draconian mandatory minimum penalty, the cost an accused must pay to go to trial on the merits of the charge, could pretend to have any fidelity to the search for the truth in the criminal justice system."

The ruling has no significant impact on sentences for people engaged in criminal conduct or who pose a danger to others, saying they should continue to receive sentences to emphasize deterrence and denunciation, the court said.

The law had been previously struck down by an Ontario Superior Court judge in the case of Leroy Smickle. He was in his cousin's house in his boxers, posing for a Facebook picture with a loaded handgun, when police burst in with a search warrant for the cousin, who they believed had illegal firearms.

Smickle was convicted of possession of a loaded prohibited firearm, but the judge ruled that it would be cruel and unusual to send the first-time offender to prison for a "very foolish" act for three years. Judge Anne Molloy gave Smickle a one-year conditional sentence.

But the Appeal Court said that sentence was "totally inadequate." A sentence of about two years less a day would have been appropriate without a mandatory minimum sentence, the court ruled, so his lawyers will have to return to court to argue his sentence.

Instead of Smickle, the court considered what is called a reasonable hypothetical.

It raised the case of John Snobelen, a former Ontario cabinet minister who was charged after his wife told police -- during marital difficulties -- about a gun he bought in the U.S. and forgot to register.

He received an absolute discharge because the Crown proceeded summarily. The three-year mandatory minimum is in place if the Crown proceeds by indictment, which is more serious.

By making it a hybrid offence, Parliament acknowledged that conduct captured by the offence runs the gamut, the court said. The Crown argued that for less morally blameworthy situations, the Crown will simply proceed summarily.

However, the court said, since those decisions are made early on, there will "inevitably" be cases that mean the Crown would have made a different choice as more facts emerge.

In Snobelen's case, if his wife had alleged Snobelen had used the presence of the gun to intimidate her, the Crown could have opted to proceed by indictment, the court wrote.

"In those circumstances, the three-year penitentiary term would surely be a grossly disproportionate sentence," the court ruled.

The Appeal Court heard six appeals together in February because each involved a constitutional challenge to a mandatory minimum sentence for various firearm offences.

Federal government lawyers had argued in support of the law, raising a spate of gun violence in 2005, which first prompted Ottawa to propose the stiffer penalties.