Thousands of unemployed people could be entitled to financial rebates totalling millions after judges in the court of appeal declared that almost all of the government's "work-for-your-benefit" employment schemes were unlawful.

Civil servants at the Department for Work and Pensions (DWP) scrambled to issue new regulations following the ruling of a three-judge panel at the Royal Courts of Justice. They found that Iain Duncan Smith, the work and pensions secretary, had not given unemployed people enough information their rights to appeal against being made to work up to 780 hours unpaid and the penalties they faced should they opt not to do so.

The case, which had initially been brought by a 24-year old geology graduate Cait Reilly, centred around whether the secretary of state was able to create new programmes and schemes at the stroke of the pen rather than issuing parliament with the full details of the growing number schemes in operation since the coalition government took power.

The geology graduate approached the Guardian with her story of forced labour in Poundland in November 2011.

Reilly, 24, from Birmingham, and a second complainant, 41-year-old unemployed HGV driver Jamieson Wilson, from Nottingham, both succeeded in their claims that the unpaid schemes were legally flawed after the court found the DWP had exceeded its powers.

The court ruling means tens of thousands of unemployed people who have had benefits docked for not properly taking part in schemes such as work experience and the work programme are entitled to a rebate. However the DWP said it would resist paying out rebates until all legal avenues had been exhausted.

"We have no intention of giving back money to anyone who has had their benefits removed because they refused to take getting into work seriously. We are currently considering a range of options to ensure this does not happen," a DWP spokesperson said.

The court awarded full costs to Reilly and Wilson and refused the government permission to appeal but the department said it would take the matter to the supreme court.

While union officials and campaigners celebrated the judgment, the DWP said that the victory was a technical matter which would be overcome as soon as it issued fresh regulations which complied with the court's ruling.

However, the DWP was unable to say whether thousands of jobseekers currently on the governments "workfare" schemes could walk away from unpaid placements in charity shops and social enterprises, without fear of having benefits docked, after the appeal court declared their ruling would take hold with immediate effect.

The judges struck down any suggestion that being made to work unpaid on pain of having benefits stripped for up to three years was a form of forced labour under the human rights act.

Speaking after the ruling was delivered, Reilly said she was "overjoyed and relieved".

"Obviously I don't want to get rid of the government helping people get into work because that's what we want, that's what we've been fighting for really. But we wanted to get rid of the aspect of punishment about it, where people are forced into things that they necessarily don't need to be doing. [That] has just been great," she said.

While striking down human rights arguments, the panel of Lord Justice Pill, Lady Justice Black and Sir Stanley Burnton ruled unanimously that Duncan Smith had exceeded his powers as secretary of state. In the ruling, Burnton said: "I emphasise that this case is not about the social, economic, political or other merits."

Burnton said parliament was "entitled to encourage participation in such schemes by imposing sanctions". "However," he said, "any scheme must be such as has been authorised by parliament."

"There is a constitutional issue involved," the judgment said. "The loss of jobseeker's allowance may result in considerable personal hardship, and it is not surprising that parliament should have been careful in making provision for the circumstances in which the sanction may be imposed."

Burton with his fellow judges ruled that under section 17a of the 1995 Jobseekers Act as amended in 2009, the secretary of state could not do as he saw fit and had to lay the details of the those programmes before parliament.

One scheme, mandatory work activity, which was introduced under its own legislation, is not directly affected by the ruling. But some lawyers believe it would also be struck down in upcoming judicial reviews.

The employment minister, Mark Hoban, said: "The court has backed our right to require people to take part in programmes which will help get them into work. It's ridiculous to say this is forced labour. This ruling ensures we can continue with these important schemes.

"We are, however, disappointed and surprised at the court's decision on our regulations. There needed to be flexibility so we could give people the right support to meet their needs and get them into a job. We do not agree with the court's judgment and are seeking permission to appeal, but new regulations will be tabled to avoid any uncertainty.

"Ultimately the judgment confirms that it is right that we expect people to take getting into work seriously if they want to claim benefits."

The TUC general secretary, Frances O'Grady, said: "This blows a big hole through the government's workfare policies. Of course voluntary work experience can help the jobless, and it is right to expect the unemployed to seek work. But it is pointless to force people to work for no pay in jobs that do nothing to help them while putting others at risk of unemployment. "This policy is about blaming the jobless, not helping them."

The PCS union said that its members who staff jobcentres and advice centres would "offer guidance and support to all those affected by the ruling, including those who have been unjustly sanctioned."

Matthew Oakley, head of economics and social policy at Policy Exchange, said the ruling "should not be seen as some sort of body blow to the government's welfare plans.

"The main problem in this particular instance was miscommunication of the requirements and penalties for not complying, rather than the policy itself."