WASHINGTON — The Supreme Court on Wednesday invalidated a Colorado scheme that forced defendants whose convictions have been tossed or overturned to jump through several legal hoops before they could get back any fines or restitution they may have paid out before they were cleared.

Under the Colorado regime, defendants who have been exonerated or have successfully appealed their convictions have to sue to get their money back and essentially prove in civil court that they’re innocent.

Justice Ruth Bader Ginsburg wrote in a 7-to-1 decision that this system “offends the Fourteenth Amendment’s guarantee of due process” because it robs the defendants of the presumption of innocence.

The case reached the Supreme Court after two Colorado defendants, Shannon Nelson and Louis Madden, won appeals or post-trial challenges to their convictions, for which they had been made to pay thousands of dollars in fines and costs.

By the time their convictions were thrown out, though, both had already made some payments toward those obligations and the state kept them — about $702 in Nelson’s case and $1,978 in Madden’s. Ultimately, the Colorado Supreme Court ruled that the “proper procedure” for getting their money back was if they each sued under a state law for exonerees seeking refunds.

Ginsburg said the procedures set out in that law were insufficient to meet the Constitution’s requirements.

“Colorado’s scheme fails due process measurement because defendants’ interest in regaining their funds is high, the risk of erroneous deprivation of those funds under [state law] is unacceptable, and the State has shown no countervailing interests in retaining the amounts in question,” she wrote.

Once a conviction is invalid, Ginsburg added, the state may only impose “minimal procedures” so that people like Nelson and Madden may get their money back.

Justice Samuel Alito agreed with the majority’s end result, but wrote separately to note that it shouldn’t have issued such a “sweeping pronouncement” about restitution for victims of crime — who have their own interest in funds they may have lost and stand to suffer if the defendants’ right to a refund supersedes their right to be made whole.

The lone dissent was by Justice Clarence Thomas, who said both Ginsburg and Alito’s analyses got it wrong, and disputed the idea that the defendants in the case had “a right to an automatic refund.” He wrote that the majority’s conclusion lacked a basis in federal or state law.

Justice Neil Gorsuch, who hails from Colorado, did not take part in Wednesday’s decision. His colleagues heard the case and cast their votes before he was nominated to the Supreme Court.