Thirty nine sub-postmasters who were wrongly prosecuted by the Post Office have had their criminal convictions overturned.

The appellants, some of whom were imprisoned for crimes they never committed, had been accused of theft and false accounting because of a faulty computer system.

In court, Sam Stein QC, the barrister representing several sub-postmasters, said the scandal had turned the Post Office “into the nation’s most untrustworthy brand”.

Between 2000 and 2014, the Post Office prosecuted more than 700 sub-postmasters, on average one a week, after a bug in the computer system Horizon led to financial shortfalls in branch accounts.

It previously agreed a nearly £58m settlement with 550 sub-postmasters, but most of that money went on legal costs and funders.

The barrister who led that civil claim called today’s judgment an “incredible victory” that could pave the way for more substantial compensation.

“This is something we should all be ashamed of – that it ever happened, but money will never compensate these people for what’s happened to them,” said Patrick Green QC.

More from UK

Announcing the court’s ruling, Lord Justice Holroyde said the Post Office “knew there were serious issues about the reliability of Horizon” and had a “clear duty to investigate” the system’s defects.

But the Post Office “consistently asserted that Horizon was robust and reliable”, and “effectively steamrolled over any subpostmaster who sought to challenge its accuracy”, the judge added.

Lord Justice Holroyde, sitting with Mr Justice Picken and Mrs Justice Farbey, said: “Post Office Limited’s failures of investigation and disclosure were so egregious as to make the prosecution of any of the ‘Horizon cases’ an affront to the conscience of the court.”

However, three of the former sub-postmasters – Wendy Cousins, Stanley Fell and Neelam Hussain – had their appeals dismissed by the court.

Lord Justice Holroyde said in these three cases, “the reliability of Horizon data was not essential to the prosecution case and that the convictions are safe”.

One of those whose conviction was overturned was Seema Misra, a former sub-postmistress accused of theft, who said clearing her name was a moment she had been “dreaming about” for over a decade but added that it “won’t bring back the time”.

Mrs Misra took over her post office in 2005 and was pregnant when she was wrongly sent to prison after being accused of stealing £75,000 from her branch.

“I would definitely have killed myself if I hadn’t been pregnant,” she said.

Mrs Misra collapsed in court when her original 15-month sentence was read out.

She told Sky News: “Did they even understand the case? Did they know what are they doing? That time I lost faith in justice, I said that’s it, that can’t be done, there’s no justice here.”

The mother-of-two said she would never forget the guilt she felt after leaving prison: “It was like I had bought shame to the family.

“My kids are my pride and they didn’t want people to see me and say ‘Oh, she is Seema Misra’. It was all over the papers and everything, I didn’t want to give them a bad name because of myself.”