Hundreds of former Post Office workers who claimed a faulty IT system led to some going bankrupt and others being prosecuted have been vindicated after a High Court ruling in their favour, their lawyers have said.
In a historic lawsuit, more than 550 people took legal action against the Post Office as part of a dispute that has spanned more than a decade.
They said problems with an IT system called Horizon, introduced between 1999 and 2000, caused shortfalls in their accounts, which resulted in some facing criminal charges, bankruptcy and even jail.
Last week it was announced that the Post Office had agreed to pay almost £58m to the former subpostmasters.
At the High Court on Monday, the claimants' solicitor James Hartley said a judge found that on several occasions over the years "bugs, errors and defects in the Horizon system caused discrepancies in postmasters' branch accounts".
Mr Justice Fraser also found that the IT system was "not robust during many of the years in question" and there was a "material risk" of it being the cause of the shortfalls, he added.
Mr Hartley said: "This judgment is vindication for the claimant group of postmasters - they have finally been proved to have been right all along when they have said that the Horizon system was a possible cause of shortfalls in their branch accounts.
"These claimants can now walk with their heads held high after all these years."
Sky News correspondent Sarah Hajibagheri, who was in court, said the judge expressed "very grave concerns regarding the veracity of evidence given by Fujitsu colleagues" about known bugs in the Horizon system.
Evidence will now be sent to the director of public prosecutions to decide on action, Hajibagheri said.
Mr Hatley said the "next significant step to overall justice" for several postmasters will be the outcome of a review of more than 30 convictions by the Criminal Cases Review Commission.
The first of at least three trials over the case finished in March, with a judge resolving most issues in favour of the subpostmasters.
The subpostmasters had claimed the Post Office had not trained them properly in the IT system and that they were misled over its reliability.
They also accused it of failing to investigate the cause of the alleged shortfalls.
Some of those affected told Sky News how they fell into depression, with one saying they felt as if "I had a gun to my head" after being accused of stealing.
Balvinder Gill ran a post office in Oxford in 2003 before he was ordered to repay a massive shortfall which he says led to bankruptcy and depression.
He told Sky News: "Every single week I had the same problems of not being able to understand the errors that were occurring. The figures on the system never matched the physical stock and cash.
"My contract was terminated but I wasn't criminally charged because there was no evidence that I had taken the money.
"I was left broke and, to add further to my woes, I was sent a bill for £108,000.
"I went into a severe state of depression."
The Post Office had previously insisted the Horizon system worked properly and defended the case.
However, in a statement, Post Office chairman Tim Parker said he "accepted our past shortcomings" and had "sincerely apologised to those affected when we got things wrong".
He insisted the Post Office's current Horizon system is "robust relative to comparable systems".
The Post Office's new chief executive, Nick Read, who started his job in September, said: "We are now working to shape a modern and dynamic Post Office, with changes at every level of the organisation placing our postmasters and our customers at the centre of the business."