Media playback is unsupported on your device Media caption Carole Easton, from the Women's Trust: "Young people are already at the bottom of the pile"

Thousands of young Britons could lose the right to claim some benefits for four years as part of government plans to tighten the rules for EU migrants.

Introducing a four-year residency test for migrants is a key part of the UK's negotiations of its EU membership.

But lawyers say applying such a test to migrants alone would breach EU laws, and the government is now considering extending the rule to all UK benefit applicants, from the age of 18.

Ministers would not discuss the plans.

In a speech in November, Prime Minister David Cameron said: "Changes to welfare - to cut EU migration - will be an absolute requirement in the negotiation that I'm going to undertake."

He urged EU leaders to accede to his "reasonable" proposals, the centrepiece of which is a demand that migrants arriving in the UK have to wait four years to get access to certain benefits, such as tax credits and child benefit.

Image copyright Getty Images

What is the government doing?

Ministers want EU migrants to live in the UK for four years before they can claim benefits. However, without EU treaty change such a move could be deemed discriminatory and breach EU law.

Why are Britons affected?

One option is to implement a four-year residency rule for all benefit claimants. This could mean Britons, even if they had lived in the UK all their lives, from their 18th birthday would be ineligible for the benefits for four years until they reach 22.

How many people could be affected?

The changes would affect working tax credits and housing benefits. About 50,000 UK citizens under the age of 22 receive tax credits. Most of them have children. The proposal is currently being discussed by ministers and senior officials.

'Direct discrimination'

Government lawyers have written to ministers setting out the legal difficulty of implementing a four-year residency test solely on migrants.

They say applying any new rules to EU migrants alone risks being challenged in the courts by the European Commission under EU anti-discriminatory legislation.

The lawyers' assessment - which has been seen by BBC News - said: "Imposing additional requirements on EU workers that do not apply to a member state's own workers constitutes direct discrimination which is prohibited under current EU law."

The document goes on to say the case for restricting EU migrants' access to certain benefits can be made using secondary legislation, but warned: "The legal arguments to do so are extremely weak."

The government has therefore drawn up residency plans to include all applicants for tax credits, including British citizens.

The BBC understands ministers have considered starting the UK residency rule from childhood, but believe it would also be discriminatory under current EU laws.

'Not going well'

Labour's Stephen Timms said it sounded like EU negotiations were "not going well" and ministers were "waking up" to the fact they will not be able to deliver on their promises.

He told BBC Radio 4's Today programme the government should try to implement a two-year limit, saying: "They might be able to get further with that."

Jonathan Portes, director of the National Institute of Economic and Social Research think tank, said the measures could "disadvantage" both EU migrants and UK benefit claimants.

"This reflects the fact they are, not surprisingly, finding it extremely difficult to negotiate something in Europe which would directly disadvantage, for example, Poles or Lithuanians coming here," he said.

"So the fallback is to do something that disadvantages those people but also disadvantages our own people as well, and hence is not discriminatory."

Work and Pensions Secretary Iain Duncan Smith has pushed for a harder line to be taken with migrants.

As well as the residency test, the Eurosceptic former Tory leader has pushed for EU nationals to have been working in the UK for four years before they become eligible for benefits.

A source said Mr Duncan Smith has always believed people should contribute to the welfare system before they take out.

Pushing for tougher benefit rules for EU migrants has been strongly opposed by some EU countries, including the Polish government.

The European Commission has already taken the government to court over its habitual residence test. The test ensures that only EU nationals with a "right to reside" in the UK can get certain benefits, such as income support, housing benefit and universal credit.

At a hearing in Luxembourg in June at the Court of Justice - the EU's highest court - the Commission argued that the government "has created a situation of direct discrimination" by placing extra restrictions on EU nationals that do not apply to British citizens.

A government spokeswoman said: "We've already taken action to protect the benefits system and ensure that EU migrants come to this country for the right reasons and to contribute to the economy.

"Now we're focused on re-negotiating our relationship with Europe and getting a better deal for Britons, and we won't speculate on other options."