A landmark ruling from the European Court of Justice (ECJ) means that European Union member states can stop so called "benefit tourism".
The decision, from the highest court in the EU, said countries within the political and economic union can refuse to give welfare payments to citizens who "solely" move to another member state to receive benefits.
The court looked into the case of a Romanian woman who moved to Germany with her child.
She received German child benefit and social security payments but also applied for a subsistence allowance from the social security system.
This allowance is non-contributory, but the German authorities denied her application on the basis that German law does not allow the payments to be made to EU citizens seeking employment in Germany.
The court decided that the woman should have had sufficient means of her own to reside in Germany as she was economically inactive.
"A member state must have the possibility of refusing to grant social benefits to economically inactive union citizens who exercise their right to freedom of movement solely in order to obtain another member state's social assistance although they do not have sufficient resources to claim a right of residence," the court ruled.
Anthea McIntyre MEP, the Conservative home affairs spokesmen in the European Parliament, said that the ECJ had ruled in favour of "common sense".
"The court has made it clear that the original purpose of free movement is to allow free movement of labour and not of benefits tourists," McIntyre said.
"If people cannot support themselves or make a meaningful contribution to the economy then they can have their benefits curbed, even if they are non-contributory benefits."
The ruling comes in the wake of David Cameron's promise to crackdown on "benefit tourism".
Cameron, writing in the Daily Telegraph earlier in the year, said that EU arrivals to the UK would now only be able to claim Jobseeker's Allowance or child benefit for a maximum of three months, a reduction from the current six month period.
The Conservative Party leader said the move would send the message to EU migrants that they "cannot expect to come to Britain and get something for nothing".