Britain will be forced to pay benefits to even more migrants under EU plans to be fought over in a politically explosive court case.

Officials in Brussels last night confirmed that the European Commission is taking legal action to make Britain lift existing restrictions that prevent some migrants claiming child benefit and child tax credit in the UK. The news comes just days after David Cameron pledged to cut handouts in a bid to reduce soaring immigration.

The case at Europe’s highest court will further anger the public and politicians who have called on the Government to tighten up Britain’s generous welfare system and make the country a less attractive destination for would-be immigrants.

Scroll down for video

If Britain loses, it will either have to change the law to allow jobless migrant families to claim child benefit, or face paying millions in fines.

Latest figures show 24,000 families are currently claiming child benefit of at least £89 a month for 38,500 children living abroad, at an estimated cost of £30 million a year, while 4,000 claim child tax credit.

On Friday, the Prime Minister pledged to end the ‘exporting’ of child benefit, as well as to ban migrant workers from claiming tax credits until they have worked in the UK for four years.

Last night Nigel Mills, one of the Conservative backbenchers demanding a tough limit on EU migrants, said: ‘Free movement is about the right to work, not the right to claim benefits. The EU should accept our rules are the will of the British people and Parliament.

Prime Minister David Cameron who had pledged to cut handouts such as child benefits for migrants in a bid to reduce soaring immigration

‘It just shows how big a battle we’ve got to get anything close to a sensible position. Even when we’re asking for things that are not unreasonable, it just suggests they’re going to push us to the exit door.’

The case, to be heard at the European Court of Justice, centres on the ‘right-to-reside’ test that EU migrants must pass before they can claim benefits in this country.

Labour introduced it in 2004 as concerns began to be raised about the ‘open doors’ policy that would eventually see more than one million Eastern Europeans arrive over a decade. The test allows officials to check if benefit claimants are ‘economically active’ – in a job, self-employed or looking for work – or able to support themselves.

But since 2011, the European Commission has been telling the UK that the right-to-reside rule is discriminatory, as it makes it easier for native Britons to access social security than migrants. Last year, employment commissioner Laszlo Andor, a Hungarian economist known as the ‘most Left-wing man in Brussels’, said he would take the UK to court over the test.

It can be disclosed today that court papers were lodged on June 27 this year. In the claim form, the EC calls on the European Court of Justice to ‘declare that the United Kingdom, by the requirement that a claimant for child benefit or child tax credit have a right to reside in the United Kingdom, has failed to comply with its obligations’ under rules that guarantee all European residents the right to benefits in other member states.

Its argument goes on: ‘The Commission maintains that in requiring a claimant of child benefit and child tax credit to have a right to reside in the United Kingdom as a condition of being treated as resident there, the United Kingdom has imposed a condition that Regulation (EC) No 883/2004 does not permit.

‘Alternatively the Commission submits that by imposing a condition of entitlement to social security benefits that is automatically met by its own nationals, the United Kingdom has created a situation of direct discrimination against nationals of other member states.’

The EC originally intended the case to cover a wider range of payments, including state pension credit, jobseekers’ allowance and incapacity benefit – in total claimed by an estimated 400,000 migrants in the UK.

But it will now just consider child benefit and child tax credit, after a European Court of Justice case earlier this month ruled that a migrant woman in Germany could not claim a jobseekers’ allowance because she was not looking for work but remained entitled to child benefit. If Britain were to lose the crucial case, unlikely to be settled before next May’s General Election, thousands of migrants with no intention of paying taxes would be able to claim child benefit here.

Immigrants queue up outside a polling station in Portsmouth to vote for a new Romanian president

At £89 a month for one child, and available to all but the highest earners, it is far more generous than in countries such as Poland, where parents get less than £15 a month, or Greece, where it is just £3.

A defeat would also be a huge setback in David Cameron’s plan, announced on Friday, to stop new arrivals claiming most benefits until they have paid four years’ worth of National Insurance. He is already facing having to convince other European leaders to agree to re-write key treaties.

Professor Steve Peers, an expert in EU law at Essex University, said: ‘This is a very important case regarding whether the UK can deny benefits to other EU citizens and could potentially have a big impact on Mr Cameron’s renegotiation plans.’ A Treasury insider insisted the right-to-reside test was ‘vital and fair’, adding: ‘We are not only fighting this, but pressing ahead with plans to strengthen the UK benefits and tax credits system to ensure it cannot be abused.’

Next month, the Luxembourg-based court will pass judgment in a separate case about whether or not Britain can opt out of a decision to give Turkish migrants more rights to social security systems in Europe. The UK has already lost two similar cases involving other countries outside the EU.

One senior figure in the European Court of Justice, Advocate General Juliane Kokott, has already said Britain should not be allowed to opt out of the new rules for Turkey because there is ‘no room’ for an ‘a la carte Europe’.