The Government's back-to-work schemes, under which people on benefits work for free, are legally flawed, the Supreme Court has ruled.
Judges upheld an earlier Court of Appeal ruling which found that 2011 regulations underpinning the schemes, which have been criticised as "slave labour", were invalid.
However, the judges ruled that regulations did not constitute forced or compulsory labour, leaving both sides claiming victory.
The legal battle focused on several cases including graduate Cait Reilly who had been made to work for two weeks cleaning and stacking shelves in a Poundland store in Kings Heath, Birmingham.
The 24-year-old graduate said she gained nothing from the fortnight and felt as though she was simply giving her labour for free.
The other case was that of 40-year-old unemployed HGV driver Jamieson Wilson, from Nottingham, who had to do unpaid work cleaning furniture and was stripped of his jobseeker's allowance for six months.
The Supreme Court dismissed Secretary of State Iain Duncan Smith's appeal on the issue of the legality of the back-to-work schemes, holding that the regulations were "invalid" as they did not give sufficiently detailed "prescribed description" of the schemes.
It also held that the Secretary of State had failed to provide sufficient information about the schemes to Ms Reilly and Mr Wilson.
Following the judgment Miss Reilly, who said she had been unfairly labelled a 'job snob' for challenging the scheme, said: "I am really pleased with today's judgment, which I hope will serve to improve the current system and assist jobseekers who have been unfairly stripped of their benefits.
"I brought these proceedings because I knew that there was something wrong when I was stopped from doing voluntary work in a local museum and instead forced to work for Poundland for free.
"I have been fortunate enough to find work in a supermarket but I know how difficult it can be. It must be time for the Government to rethink its strategy and actually do something constructive to help lift people out of unemployment and poverty."
Following the Court of Appeal ruling in February, the Government retrospectively passed legislation to correct problems in the system.
That new legislation rendered much of today's Supreme Court ruling academic but the Government trumpeted its success.
Mr Duncan Smith said: "We are very pleased that the Supreme Court today unanimously upheld our right to require those claiming jobseeker's allowance to take part in programmes which will help get them into work.
"We have always said that it was ridiculous to say that our schemes amounted to forced labour, and yet again we have won this argument.
"Ultimately this judgment confirms that it is right that we expect people to take getting into work seriously if they want to claim benefits."
Jonathan Isaby, political director of the TaxPayers' Alliance said: "This verdict may be embarrassing for the Department for Work and Pensions, but campaigners should not be allowed to exploit it to undermine necessary and fair welfare reform.
"This judgment is about the way ministers introduced legislation into Parliament. It certainly does not reject the concept of mandatory work experience."
On Tuesday, Health Secretary Jeremy Hunt lost his appeal against a Court of Appeal ruling, which found he had no power to announce cuts to A&E and maternity services at Lewisham Hospital.