2015 migrants
The court ruled it is lawful for UK to withhold benefits to EU migrants with children living abroad DPA/AFP

A challenge at a European court to block the UK from denying some EU migrants child benefits and child tax credits has been rejected. The European Court Of Justice (ECJ) ruled that Britain should be allowed to withhold benefits form migrants if they do not have a right to live in the country in what is one of the biggest issues in the upcoming EU referendum debate.

The ECJ in Luxemburg has also backed Britain's right to refuse to pay family welfare benefits to unemployed migrants who have lived in the UK for less than five years. The appeal by the European Commission (EC) argued that Britain's process of checking whether child benefit and tax credit claimants had a right to live in the country is unfair against EU workers as British citizens are not checked in a similar way.

However, the ECJ ruled that such "unequal treatment" was justified on the basis of "protecting a member state's finances". In their ruling, the court added: "The Court rejects the Commission's principal argument, that the UK legislation imposes a condition supplementing that of habitual residence contained in the regulation," it ruled.

"There is nothing to prevent the grant of social benefits to EU citizens who are not economically active being made subject to the requirement that those citizens fulfill the conditions for possessing a right to reside lawfully in the host member state. In this regard, the Court finds that the UK authorities verify whether residence is lawful in accordance with the conditions laid down in the directive on the free movement of citizens.

"Thus, this verification is not carried out systematically by the UK authorities for each claim, but only in the event of doubt. It follows that the condition does not go beyond what is necessary to attain the legitimate objective pursued by the UK, namely the need to protect its finances."

The ruling will be seen as a huge boost for the Remain campaign ahead of the EU referendum vote on 23 June, with restricting benefits forming a key part of David Cameron's EU renegotiations.

Think-tank the Institute For Public Policy Research (IPPR) said the ruling from the Court shows it is becoming "more sympathetic to the UK's interpretation of free movement rules". Research fellow Marley Morris added: "But there are no guarantees that this will last forever, and future judgements may go against the UK. Conversely, a vote for Brexit on 23 June is likely to create its own legal quagmire, as the subsequent negotiations will have to resolve the free movement rights of EU citizens currently living in the UK and UK citizens currently living in other EU countries in a fair and consistent way."