David Cameron has warned that he will block further expansion of the European Union unless reforms are agreed to crack down on "benefit tourism".
The threat came at an EU summit in Brussels where he acknowledged that "enlargement" had been one of the union's greatest strengths and a spur for peace and prosperity.
But he said the system was meant to offer the prize of free movement to workers from new member states, and not those just looking for cash handouts.
Days after announcing tighter UK controls on migrants' financial benefits ahead of an expected wave of Romanians and Bulgarians coming to Britain from January 1, the Prime Minister was looking for support from other EU leaders to rewrite the rules before any more membership hopefuls are given the green light. There was not much sign of it at the summit, but the Prime Minister said he was launching a debate that needed to be tackled, adding that rules should be tightened, by treaty change if necessary.
With at least six countries in the queue for membership the Prime Minister pointedly observed that each accession would require the approval of all existing member states: "Accession (to full EU membership) requires unanimity - so there is a real opportunity to insist on a new approach."
The most recent expansion ushered in Croatia earlier this year, with full cross-border rights to settle in any of the other members triggered within the next seven years.
The EU accession process starts with Serbia next month, and plans are under way to grant Albania "candidate status" as soon as next June.
Mr Cameron said he had opposed immediate status for Albania, and wanted to see the start of a serious debate on a rules shake-up - including consideration of the Prime Minister's own idea of only granting full cross-border work and residency rights to citizens of newly added member states once their national prosperity has reached a certain level.
Mr Cameron told a post-summit press conference: "I support enlargement as a huge driver of peace and prosperity - but the EU of today is very different from that of 50 years ago: the founding fathers didn't envisage that enlargement would mean mass migration. We must get back to the principle of granting free movement to workers ready to work hard, not those who are after the best benefit deal.
"It is not supposed to be about free movement for benefit tourism for those who don't have the means to support themselves: it is about people in work looking for work elsewhere."
The Prime Minister said one possible answer he was putting forward was to restrict access depending on a new member state's average GDP or domestic wage rates. Once the gap is sufficiently closed to defuse the rush for benefits in relatively rich member states, full free movement rights would be granted.
He went on: "We must learn the lessons of history. The mistake of the last (Labour) government was to give unfettered immediate access (after major EU enlargement in 2004). That was a huge mistake. People simply didn't see that one and half million people would move across Europe."
He admitted there were not enough figures on the likely levels of benefit tourism from Romania and Bulgaria from January because of " a struggle to get Government departments to examine what the costs and numbers are".
"Part of it is about sending a very clear signal: people are welcome to come and work, but not to come and claim. We must also examine some of the specific benefit issues: I don't think it is right that people can come and work in the UK, with their families back at home but getting UK levels of child benefit in the home country.
"That seems to me to be wrong and we should change that, but when you try in Europe, it takes time, it needed negotiation and agreement."
Meanwhile, he said the unilateral changes he was bringing in to control benefit claims were legal under EU law - something the European Commission is investigating in the wake of a war of words between Downing Street and the EU's employment, social affairs and inclusion commissioner Laszlo Andor.
When challenged that it was too late to affect imminent migration flows from Romania and Bulgaria, Mr Cameron said: "I don't accept that: it is important in advance of Bulgarian and Romanian accession to make sure we put in place all the right controls and measures we can. We are well within the law and we have done what we can - and if they (the restrictions) weren't making a difference, why would Andor be making such a fuss about it?"