A new law to exonerate hundreds of Post Office branch managers caught up in the Horizon IT scandal is set to be introduced.

Prime Minister Rishi Sunak told MPs at Prime Minister’s Questions on Wednesday that subpostmasters were victims of “one of the greatest miscarriages of justice in our nation’s history”.

Hundreds were convicted of swindling money on the basis of evidence from a flawed IT system.

The Prime Minister told MPs: “We will introduce new primary legislation to ensure that those convicted as a result of the Horizon scandal are swiftly exonerated and compensated.”

Mr Sunak also announced a new upfront payment of £75,000 for the “vital” group of postmasters who took action against the Post Office.

At Prime Minister’s Questions on Wednesday, he said: “This is one of the greatest miscarriages of justice in our nation’s history.

“People who worked hard to serve their communities had their lives and their reputations destroyed through absolutely no fault of their own. The victims must get justice and compensation.”

Mr Sunak said: “we will make sure the truth comes to light” and “right the wrongs of the past”.

Post Office minister Kevin Hollinrake said 980 postmasters were convicted but just 93 have managed to get their convictions overturned.

The usual method for overturning a conviction would see the Criminal Cases Review Commission sending it to the Court of Appeal for a hearing.

But the unprecedented scale of the Horizon scandal means the Government is taking a legislative route rather than a lengthy court process.

Justice Secretary Alex Chalk has been discussing the situation with senior judges because of the constitutional concern about Parliament being seen to interfere with the legal process.

The Horizon system started to be rolled out in Post Office branches across the UK in 1999 and over the subsequent years a series of subpostmasters were prosecuted over missing funds.

In 2019 the High Court ruled that Horizon contained a number of “bugs, errors and defects” and there was a “material risk” that shortfalls in Post Office branch accounts were caused by the system.

The long-running battle for justice accelerated dramatically after ITV broadcast the drama Mr Bates Vs The Post Office, which highlighted the scandal earlier this month.