The High Court has ruled emergency laws underpinning a government back-to-work scheme are "incompatible" with the European Convention on Human Rights.
The government says it should not have to repay claimants docked benefits for not doing all they could to find work.
But a judge said the retrospective application of legislation passed in 2013 "interfered with the right to a fair trial" of those affected.
Ministers said they were "disappointed" and would appeal.
The case originates in a legal challenge brought by Cait Reilly in 2012. She maintained that her participation in an unpaid work placement in a Poundland store in 2011 breached her human rights.
The 24-year-old graduate challenged the legality of the scheme, part of the government's "mandatory work activity" programme, where claimants risk losing their Jobseeker's Allowance if they do not take part.
She said she had not been informed prior to the placement that she would, as a result, have to give up her voluntary work in a museum - where she hoped to build a career.
'Minority of cases'
The government was forced to pass emergency legislation amending the regulations last year after the Court of Appeal ruled that Ms Reilly had not been properly notified about the scheme and its undertakings.
The legislation, which came into force in March 2013, strengthened the rules to make it clear that claimants must do all they could to find work in order to claim benefits.
It also sought to ensure the government did not have to repay claimants who had been penalised for not complying with the conditions of their benefit claims by retrospectively "validating" sanctions.
But claimants argued that this was unfair and insisted they were entitled to compensation.
Mrs Justice Lang, sitting at the High Court in London, ruled on Friday that the retrospective nature of the legislation interfered with the "right to a fair trial" under Article Six of the Convention on Human Rights.
She said the claimants could apply for a judicial review of the relevant legislation.
The Department for Work and Pensions said it was "disappointed" by the ruling - which it said applied to a minority of claimants - and would appeal.
"We disagree with the judgement on the legislation and are disappointed," a spokeswoman said.
"It was discussed, voted on and passed by Parliament. While this applies to only a minority of past cases and does not affect the day-to-day business of our Jobcentres, we think this is an important point and will appeal."
She said the legislation remained "in force" and the government would not be compensating anyone pending the outcome of its appeal.
But Paul Heron, a solicitor for Public Interest Lawyers, said it was a "massively significant" ruling and the DWP's decision to appeal against it would be a further blow to the "upwards of 3,000 cases sitting in the tribunal system waiting for this judgement".
About £130m was owed to people who had fallen foul of the retrospective legislation, he said, ranging from four weeks' benefit, about £250, to several thousand pounds.
He told BBC News it was "about time the DWP just held their hands up, admit they made an error, and pay people the money they were entitled to at the time. That is what a responsible government would do".
The back-to-work schemes have been condemned by critics as "slave labour" because they involve work without pay. But they are seen by supporters as a good way of getting the unemployed back into the world of work.
The Supreme Court upheld the Court of Appeal's ruling on the regulations last year, although the judges also rejected claims that the schemes were "exploitative" and amounted to "forced labour".
Ministers said that the most recent legal judgement had upheld this view.
"We're pleased the court recognised that if claimants do not play by the rules and meet their conditions to do all they can to look for work and get a job, we can stop their benefits," the spokeswoman added.
Poundland, one of several employers which took part in the scheme, withdrew from it in 2012.