Media playback is unsupported on your device Media caption Seema Misra is fighting to overturn her conviction.

Hundreds of post office workers have won a key victory against the Post Office and the controversial accounting software they were forced to use

It is the first step towards overturning the convictions of postmasters accused of fraud or theft after using the Horizon IT system.

Their lawyer said they could "now walk with their heads held high" after the ruling which ends years of campaigning.

It comes after the Post Office had said it would pay £58m to settle claims.

Last week the Post Office had acknowledged problems with the IT system but Monday's judgment has been made as part of a court case launched before that settlement was reached.

In the case, brought by six lead claimants, the judge looked at allegation that the system contained a large number of software defects, which caused shortfalls with sub-postmasters and postmistresses' accounts.

In Monday's High Court judgment, Mr Justice Fraser said the Horizon IT system was not "remotely robust" and even when improved it had a significant number of bugs.

He said there was a "material risk" that shortfalls in Post Office branch accounts were caused by the system.

The Post Office workers blame the system for creating big shortfalls in their accounts, discrepancies which led to some being made bankrupt and others prosecuted and sent to prison.

Homes, businesses and reputations have been lost, as well as years spent in prison.

Image caption "These claimants can now walk with their heads held high," said James Hartley, partner at Freeths law firm

Among those involved in the case is Seema Misra, who was pregnant with her second child when she was convicted of theft and sent to jail in 2010.

She was accused of theft after using the Post Office Horizon IT system, which is provided by Fujitsu.

Seema became a sub-postmistress in West Byfleet in Surrey in June 2005 and was suspended in January 2008 after an audit found a discrepancy of £74,000 in her accounts.

She had been feeding at least £100 per day from her shop into the Post Office tills, because of discrepancies in balancing the accounts. One day there was a £10,000 hole.

Image caption Rubbina Shaheen hopes her conviction will be overturned

This went on for two years, she said, with very little support from the Post Office.

"If I hadn't had been pregnant, I definitely would have killed myself," she said. "It was the worst thing. It was so shameful."

She is now focused on trying to get her conviction overturned.

Another worker, Rubbina Shaheen is also among those fighting to clear her name. She ran the Greenfields post office in Shrewsbury and was convicted and jailed in 2010 and while she is not one of the 557 Post Office claimants, but is now hoping her conviction will be overturned.

Long-running dispute

The 400-page judgment comes after the Post Office had agreed a payout with 557 claimants after a long-running dispute over the system.

The Criminal Cases Review Commission, which investigates miscarriages for justice, is looking into more than 30 criminal convictions of former sub-postmasters.

James Hartley, partner at Freeths law firm which represented the claimants, 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.

"This judgment, together with the settlement reached last week, are important stepping stones to achieving much-needed closure for these postmasters.

"They can now start to move on with their lives."

Mr Justice Fraser said he would refer the case to the Director of Public Prosecutions after evidence given by employees of Fujitsu, which developed and maintained the Horizon system, in previous court cases.

He said: "Based on the knowledge that I have gained, I have very grave concerns regarding veracity of evidence given by Fujitsu employees to other courts in previous proceedings about the known existence of bugs, errors and defects in the Horizon system."

'Re-set relationship'

Post Office Chairman, Tim Parker, said the judgment acknowledged that the current Horizon system was robust and related to previous version of the systems.

"In reaching last week's settlement with the claimants, we accepted our past shortcomings and I, both personally and on behalf of the Post Office, sincerely apologised to those affected when we got things wrong.

We have given a commitment to learning lessons from these events, and today's judgment underlines the need to do so."

"Importantly, our new chief executive [Nick Read] has made clear the need to reset our relationship with postmasters and started the process to build a much better relationship with them."