Hundreds of UK subpostmasters wrongly prosecuted for dishonesty due to a faulty software scandal will have their convictions automatically quashed, Prime Minister Rishi Sunak's office said on Wednesday.
The blanket exonerations for offences including theft and false accounting will be made possible through new legislation being introduced in parliament.
More than 700 people running small local post offices received criminal convictions between 1999 and 2015 after the faulty Horizon accounting software made it appear that money had gone missing from their branches.
Many ended up bankrupt and shunned by their communities. Some were jailed. At least four people took their own lives.
Sunak said he understood nothing could "make up for what they've been through" but he hoped the legislation marked an "important step forward in finally clearing their names".
"We owe it to the victims of this scandal, who have had their lives and livelihoods callously torn apart, to deliver the justice they've fought so long and hard for," he said.
The government said it would also act to improve the compensation available to different groups of subpostmasters, including those not actually convicted but still badly affected by the false accusations made by the Post Office.
Kevan Jones, a main opposition Labour Party MP who campaigned for the subpostmasters, welcomed the new Post Office Offences bill as "great news".
"This will exonerate hundreds of victims who were convicted as a result of the Post Office Horizon IT system.
The government said it would push the bill through parliament quickly, with the aim of it becoming law "as soon as possible ahead of the summer recess.
The legislation will cover England and Wales. The devolved governments in Scotland and Northern Ireland are expected to introduce their own plans.
A four-part television drama "Mr Bates vs the Post Office", shown in early January, created a public outcry and galvanised government over the long-running scandal.
The series told the story of a group of subpostmasters wrongly accused and their "David and Goliath" fight back led by one of them, Alan Bates.
When he announced the highly unusual decision to pass legislation providing blanket exonerations, Sunak said he wanted to help right "one of the greatest miscarriages of justice in our nation's history".
The European boss of IT service giant Fujitsu, which supplied the flawed Horizon system, also issued a grovelling apology for his firm's role in the scandal.
"Fujitsu would like to apologise for our part in this appalling miscarriage of justice," European director Paul Patterson said, appearing before a committee of MPs two weeks after programme was broadcast.
"We were involved from the very start. We did have bugs and errors in the system and we did help the Post Office in their prosecutions of the subpostmasters. For that we are truly sorry," he said.