The Supreme Court of Canada dealt the Harper government's tough-on-crime agenda a serious blow Tuesday by striking down a law requiring mandatory minimum sentences for crimes involving prohibited guns.

The 6-3 ruling, penned by Chief Justice Beverley McLachlin, said the statute was unconstitutional as it upheld a 2013 Ontario Court of Appeal ruling that labelled the law cruel and unusual.

The ruling said the mandatory minimum sentence could ensnare people with "little or no moral fault" and who pose "little or no danger to the public." It cited as an example a person who inherits a firearm and does not immediately get a license for the weapon.

"As the Court of Appeal concluded, there exists a 'cavernous disconnect' between the severity of the licensing-type offence and the mandatory minimum three-year term of imprisonment," McLachlin wrote for the majority.

Justice Minister Peter MacKay said in a statement that the government will review the decision to determine "next steps towards protecting Canadians from gun crime and ensuring that our laws remain responsive."

"Our government will continue to be tough on those who commit serious crimes and endanger our communities," the minister added.

Liberal Leader Justin Trudeau said there is a place for mandatory minimums in certain situations, noting that past Liberal governments have introduced them for "extreme crimes."

"But I think the over-use of them that the Supreme Court has highlighted, by this Conservative government, isn't necessarily doing a service to Canadians, both by not necessarily keeping us that much safer and also wasting large amount of taxpayers dollars on unnecessary court challenges," he told reporters in Oakville.

Doubt cast on deterrence

Keeping Canadians safe is cited by the government as the reason for its tough sentencing laws. McLachlin took aim at that justification in her ruling.

"The government has not established that mandatory minimum terms of imprisonment act as a deterrent against gun-related crimes," she wrote. "Empirical evidence suggests that mandatory minimum sentences do not, in fact, deter crimes."

The court was deciding two appeals involving mandatory minimum sentences for gun crimes brought by the Ontario and federal attorneys general.

The top court upheld the appeal court's quashing of both the three-year mandatory minimum for a first offence of possessing a loaded prohibited gun, as well as the five-year minimum for a second offence.

The Ontario and federal governments argued that the minimums do not breach the charter protection against cruel and unusual punishment.

The new sentencing rules were enacted in 2008 as part of a sweeping omnibus bill introduced by the federal Conservatives.

More handgun cases

The two governments say they enacted the mandatory minimums in response to the increasing number of handgun possession cases coming before the courts.

In one of the two cases that made up the appeals heard by the Supreme Court, a young Toronto man with no criminal record was sentenced to three years after pleading guilty to possession of a loaded firearm.

The judge in the case said that without the mandatory minimum, he would have sentenced Hussein Nur to 2½ years.

In the second case, Sidney Charles pleaded guilty to firearms offences after he was found in his rooming house bedroom with a loaded and unlicensed semi-automatic handgun.

He was sentenced to five years because he had two previous convictions.

In defending the mandatory sentence for repeat offenders, Ottawa and Ontario argued that it is within a reasonable range of legislative choice.

While the justices said the law is too broad in a general sense, they said the sentences were fitting in the two cases at issue.

"In most cases, including those of Nur and Charles, the mandatory minimum sentences of three and five years respectively do not constitute cruel and unusual punishment. But in some reasonably foreseeable cases that are caught by (the law) they may do so."

The Supreme Court has clashed with the Conservative government on several key policies, although it recently sided with Ottawa over the destruction of gun registry data, which Quebec sought to preserve.

That win for the Conservatives came after several losses at Canada's top court.

Other recent setbacks for the federal government at the Supreme Court include: