The European Union is taking Britain to court over benefits for migrants - a move that has angered many who believe Brussels interferes too much in UK government policy.
The European Commission said that tests applied to check if European claimants were eligible for benefits in Britain were unfair - and has referred Whitehall to the EU's Court of Justice.
A statement on the EC website said: "UK nationals have a right to reside in the UK solely on the basis of their UK citizenship, whereas other EU nationals have to meet additional conditions in order to pass this right to reside test.
"This means that the UK discriminates unfairly against nationals from other member states. This contravenes EU rules on the coordination of social security systems which outlaw direct and indirect discrimination in the field of access to social security benefits."
Work and pensions secretary Iain Duncan Smith told the BBC he would fight the Commission "every step of the way" and not give in to any changes to the UK's welfare system.
He said: "People in this country expect me to protect the benefits system from abuse and protect the money of hardworking taxpayers. So I will not stand by while the European Commission tries to water down the valuable protections we've put in place.
"I will not cave in and I will continue to work on strengthening our benefits system to ensure it is not open to abuse by anyone."
In a rare show of solidarity, shadow home secretary Yvette Cooper backed his stance and called on the government to tighten UK residence tests.
She said: "The EU Commission is wrong to try to prevent member states having sensible checks as it will increase public concerns about migration and give member states an incentive to cut employment support for everyone, which is against everyone's interests in Britain and across Europe."
The coalition is planning to introduce further benefit restrictions on migrants. Ministers have put forward plans to restrict access to legal aid and charge EU migrants for access to some elements of NHS care.
Government statistics reveal that migrants make up only 8% of the population, and contribute 10% towards the UK's Gross Domestic Product (GDP).
Jonathan Portes, of the National Institute of Economic and Social Research, said studies suggested that UK migrants were "significantly less likely" to claim benefits than British nationals.
He also said that EU migrants paid at least 30% more in taxes than they took out in benefits, according to research by University College London.