OTTAWA -- The Supreme Court of Canada has struck down a law that forced people convicted of crimes to pay surcharges that help victims, saying the mandatory fee amounts to cruel and unusual punishment.

In a 7-2 decision delivered Friday morning in Ottawa, the Supreme Court found the mandatory victim surcharge puts a crushing financial burden on poor people and places them under constant threat of being arrested and jailed if they do not pay.

"Judges have been forced to impose a one-size-fits all punishment which does not take into account the individual's ability to pay," Justice Sheilah Martin writes in the majority's decision.

For disadvantaged offenders, a high proportion of whom suffer from addiction and mental-health problems, the surcharge levied on top of a sentence results in a "grossly disproportionate public shaming," she added. "It is what most Canadians would call an abhorrent and intolerable punishment."

The victim surcharge has existed since 1988, but five years ago, Stephen Harper's Conservative government removed the ability of judges to waive or lower the fees, making them mandatory in every case. The amount of the surcharge is 30 per cent of any fine, but with a minimum of $100 for lower-severity offences and $200 for more serious ones if no fine is imposed.

The change elicited rare judicial backlash, with judges in a number of provinces either refusing to impose the surcharge in some cases or making the fee so small as to be inconsequential. These decisions were later overturned on appeals.

The case brought to the Supreme Court was that of Alex Boudreault, a high-school dropout who had never held a steady job and who pleaded guilty in September 2013 to four counts relating to breaches of probation orders.

A few months later, the Quebec man pleaded guilty to several other counts, including breaking and entering, possession of stolen property and assault with a weapon.

In 2015, a Quebec court sentenced Boudreault to 36 months in prison and ordered him to pay a victim surcharge of $1,400 -- rejecting his argument the fee infringed the charter guarantee against cruel and unusual punishment.

The Quebec Court of Appeal dismissed Boudreault's challenge of that ruling last year.

The Supreme Court agreed to hear Boudreault's case as well as six similar ones that were grouped together to form the basis of Friday's ruling. The offenders in all seven cases argued they couldn't afford the surcharges, and all seven were living in poverty with physical and mental illnesses. Many also struggled with addictions.

Friday's decision wipes away all amounts owed by the seven offenders. It also means no victim surcharges can be imposed in any conviction regardless of the offender's income, starting immediately.

But it does leave in limbo other offenders who have outstanding surcharge orders. The government can remedy this by changing the law to reflect this decision, Martin noted in her ruling. In the meantime those stuck with surcharges will have to seek relief in the courts one by one, she added.

Justice Minister Jody Wilson-Raybould did introduce legislation in 2016 that would have re-instated the discretion of judges to waive the charge if an offender is truly unable to pay. That bill was later folded into an omnibus justice bill that remains before the Senate.

Friday's ruling did come with a dissenting opinion. Justice Suzanne Cote wrote she disagreed that the surcharge violates the Charter of Rights and Freedoms and would have dismissed the appeals.

But a majority agreed with Martin that the fee is unconstitutional.

"Put simply, it is cruel and it is unusual," Martin wrote.