An Ontario Superior Court judge has chosen to defy the federal government by refusing to impose a mandatory three-year sentence on a man caught with a loaded handgun, because to do so would be akin to "cruel and unusual punishment."

Judge Anne Molloy wrote in her decision Monday that while she is favour of reducing violent crime, she can find no "tangible evidence" that imposing the mandatory minimum sentence in this case would achieve that.

The case concerned a Toronto man, Leroy Smickle, 30, who was caught taking pictures of himself posing with a loaded illegal gun while alone in his cousin's apartment. Smickle had planned to load the pictures to his Facebook page.

While he was loading the pictures, police smashed down the door of the apartment with a battering ram as they executed a search warrant in relation to Smickle's cousin, who they suspected had illegal firearms.

Inside, they found Smickle with the gun in hand. He was charged with possession of a loaded firearm.

Molloy ruled that Smickle, who has no other criminal record, was "very foolish" to have been caught engaging in "adolescent preening" with the pistol. But she said that the circumstances of what he did didn't warrant a penitentiary sentence.

"Mr. Smickle is guilty of colossally bad judgment," Molloy wrote. "However, apart from this one lapse in judgment, he is not a criminal."

Molloy concluded that sending Smickle to prison for three years would be unconstitutional, because Sec. 12 of the Charter provides that "everyone has the right not to be subjected to cruel and unusual punishment."

"A reasonable person knowing the circumstances of this case, and the principles underlying both the Charter and the general sentencing provisions of the Criminal Code, would consider a three year sentence to be fundamentally unfair, outrageous, abhorrent and intolerable," she wrote in her judgment.

She said she was "painfully aware" of the scourge represented by handguns in the community. "But, typically, it is the circumstances in which the gun is possessed, and what is done with the gun, that give rise to the more serious concerns affecting community safety," she wrote.

"It is also difficult to see how inflicting cruel and unusual punishment on an individual can be justified based on an overall legislative objective of general deterrence."

Instead, she sentenced Smickle to five months of house arrest in addition to the equivalent of seven months spent in pre-trial custody.

The Attorney General of Ontario has said the Crown's office is reviewing the decision before deciding what to do next.

The ruling comes as the federal government pushes ahead with its tough-on-crime agenda, which includes new mandatory minimums for certain crimes.

The mandatory minimum gun law came into force in 2008 as part of the "Tackling Violent Crime Act."

A similar approach is part of the new Bill C-10, the Harper government's omnibus crime bill, which is currently making its way through the Senate. Bill C-10 combines nine pieces of legislation, covering everything from drug crimes, sex, young offenders, criminal pardons and the issue of Canadians jailed abroad.

Critics of the bill say the costs of longer prison sentences will be enormous, and will come at the cost of rehabilitation and reintegration of convicts.

Ontario Premier Dalton McGuinty says mandatory minimum sentences still have his full support.

In a tweet Tuesday, McGuinty wrote that Ontario supports mandatory minimums for gun crimes, and notes the province is backing mandatory sentences in another case at the appeal level.