The Conservative government's attempt to detain thousands of prisoners for longer periods has been blocked, in the newest in a series of crushing defeats at the Supreme Court of Canada.

The government had tried to stop judges from acting in what it saw as an excessively generous way toward prisoners who have not received bail. Canada has more people in jail who are awaiting their trials than it has convicted, sentenced offenders, and judges have been routinely giving them extra credit for the time they serve, to count toward their ultimate sentence if convicted. The Supreme Court said Friday the practice is rooted in traditional sentencing principles and can continue.

The 7-0 ruling comes after three unanimous or near-unanimous defeats in the past month, including a rejection of Prime Minister Stephen Harper's latest choice for a position on the court, Justice Marc Nadon, whom it ruled ineligible.

Story continues below advertisement

Even with the majority of the Supreme Court's members appointed by Mr. Harper, it is now an open question whether other key elements in the government's tough-on-crime agenda will survive judicial scrutiny. This week, the court agreed to hear a constitutional challenge to mandatory minimum sentences for illegal gun possession. Another law, making criminals pay mandatory financial penalties for victim services, has been challenged, skirted and mocked by judges, and may reach the Supreme Court.

What these cases have in common is the government's attempt to limit judges' discretion in sentencing. "The entire history of the common law [a 1,000-year-old body of precedents and traditions] is a history of granting a fair amount of latitude to the people who sit there and listen to the witnesses testify," Toronto lawyer Dirk Derstine said in an interview. "That's one of the real reasons why they're running into trouble. Judges are unhappy about this."

The new ruling was an enormous rebuke. Five years ago, justice minister Rob Nicholson told the House of Commons judges were bringing the justice system into disrepute by giving prisoners double or even triple credit for the time they served before their sentencing. He asserted that prisoners were abusing the system by dragging out their cases while they sat in custody so they could reduce their overall jail time. With the Truth in Sentencing Act, the government banned double credit, set the maximum at one day credit for each served, and allowed an exception of 1.5 days where "the circumstances justify it."

But the country's judges had their day in court, and won.

The Supreme Court said that in spite of Mr. Nicholson's words – and the act's subtitle, "Limiting credit for time spent in pre sentencing custody" – the law wasn't clear about what circumstances justify extra credit. Judges in several provinces had continued to routinely give 1.5 days credit for each day served, because jail time after sentencing is nearly always reduced by a minimum of one-third; a 90-day sentence means 60 days. Their interpretation was in accord with the timeless sentencing principles of proportionality and parity, the Supreme Court said, in a ruling written by Justice Andromache Karakatsanis, a Harper appointee.

"A rule that results in longer sentences for offenders who do not obtain bail, compared to otherwise identical offenders is incompatible with the sentencing principles of parity and proportionality," she wrote in an Ontario case involving a 19-year-old man convicted of manslaughter for shaking a baby to death. "This is particularly so, given that vulnerable and impoverished offenders are less able to access bail."

Justice Minister Peter MacKay, who said he is reviewing the decision, now has a choice. He could explicitly define the circumstances that justify 1.5 times credit, to rule out its routine use. But that could run afoul of what the court said about parity and proportionality. Or he could rewrite the sentencing principles themselves. But it is hard to see how that would survive a constitutional challenge. Or he could simply blame judges for holding back Conservative policies aimed at the protection of society.

Story continues below advertisement

The Truth in Sentencing Act was not challenged on constitutional grounds, but the court still managed to hint at the broader constitutional parameters, Calgary lawyer Lisa Silver said.

"I think that's what the court is trying to explain to the government: 'You can do these things, but you're going to have to do them clearly, explicitly, and it's still not going to change the supreme law, which is the Charter [of Rights and Freedoms].'"