Media playback is unsupported on your device Media caption Iain Duncan Smith: "The European Commission is trying to land grab"

Britain is being taken to court by the European Commission for allegedly discriminating against EU nationals who claim social security in the UK.

Ministers are accused of discriminating against those from EU member states who have been living and working in the UK.

It is alleged an extra residency test applied by the UK to see if migrants are eligible to claim breaches EU law.

Work and Pensions Secretary Iain Duncan Smith said he planned to fight the commission "every step of the way".

The EU has a standard test that is supposed to be applied by countries to determine a migrant's eligibility for welfare payments.

But the British right-to-reside test goes further and restricts access to a number of social security benefits that would otherwise be available to those coming to the UK from another EU member state.

'Water down'

The commission believes the UK is breaking EU law and alleges thousands of people may have been unfairly denied benefits as a result.

Benefits tests Habitual residence test • Introduced in 1994 for any recent arrivals to the UK who claim means-tested benefits, including returning UK nationals • Allowed under EU rules • Looks at length of time in the UK, employment prospects, reasons for coming to the country, and future intentions • Not applied to European Economic Area (EEA) nationals classed as workers or self-employed, nor their families • Refugees and those with exceptional leave remain exempt Right-to-reside test • Introduced by Labour in 2004 in response to concerns about EU enlargement • Places further restrictions on payments including housing benefit, council tax benefit, child tax credit and child benefit • A person has a right-to-reside if they are economically active or able to support themselves and their family • The European Commission believe the right-to-reside discriminates against EU nationals by making it more difficult for them to access social security than for UK nationals

Consequently, it plans to take Britain to the European Court of Justice - an action that could take years to complete.

But Work and Pensions Secretary Iain Duncan Smith accused the commission of trying to "water down" measures to protect British taxpayers.

"I will fight this every step of the way," he said. "I will not cave in and I will continue to work on strengthening our benefit system in the meantime to ensure it is not open to abuse by anyone."

Deputy Prime Minister Nick Clegg said he believed the commission had got it "wrong on this one".

He told the BBC: "Of course we need to provide support to people who deserve it, who need it and who are entitled to it, but our benefits system is not a free-for-all and it shouldn't be a free-for-all."

The government is "very confident" that it is on "strong ground" defending the current benefits criteria, he added.

Labour, which introduced the right-to-reside rules in 2004 in response to concerns about EU enlargement, said the residence test should be strengthened.

"Most people who come to Britain work and contribute," shadow home secretary Yvette Cooper said. "But it is right that we should have checks in place to make sure people contribute or show commitment to this country before they benefit."

In one case it is claimed an EU national who had been working and paying taxes in the UK was refused jobseekers' allowance after she was made redundant.

Refused allowance

One UK-based charity - Advice on Individual Rights in Europe - said it had dealt with a number of women who had worked in the UK but were denied income support when they became pregnant.

Media playback is unsupported on your device Media caption Legal advisor Adam Weiss: That is clear discrimination in violation of the EU rules on security benefits

"British and Irish citizens always pass this so-called right-to-reside test," the charity's legal director Adam Weiss told BBC Radio 4's Today programme.

"Other EU citizens do not always pass that test and as a result they are often refused certain benefits in circumstances when British citizens and Irish citizens would receive them."

Jonathan Portes, from the National Institute of Economic and Social Research, said studies suggested migrants to the UK are "significantly less likely" to claim benefits than British nationals.

He said EU migrants pay at least 30% more in taxes than they take out in benefits, according to research by University College London.

The case has infuriated some who already believe Brussels interferes too much in UK government policy.

'Specifically excluded'

Media playback is unsupported on your device Media caption Dr Martin Kahanec from the Central European University said migrants "do not respond to welfare generosity"

Peter Lilley was the Conservative minister in charge of social security when the "habitual residence" test, which is allowed under EU law, was introduced in the UK.

He said the European Commission was "creeping" into areas of policy that were "specifically excluded" from European treaties, adding that the move would "strengthen the case for David Cameron to get powers back to this country".

Nigel Farage, leader of the UK Independence Party, which argues for the UK's withdrawal from the EU, said the commission's decision showed that "in a Britain versus European Union fight, we just don't win".

The government recently announced plans for additional curbs on what migrants to the UK should be allowed to access.

The Queen's Speech included a bill to make short-term migrants pay for NHS care, force landlords to check immigration statuses and prevent illegal migrants from obtaining driving licences.