Ever since he first gave in to backbench Tory demands for an EU referendum, David Cameron has known that the biggest risk to Britain staying in Europe is public unease about immigration.
Cameron's conundrum in 2013 was to persuade the voters that somehow he was acting on their concerns, while not breaking the EU's key principle that any citizen is free to move around for work.
When it became clear that migration quotas or 'emergency brakes' weren't either workable or palatable to fellow EU leaders, the focus shifted to 'benefit tourism' and the 'pull factor' of our generous welfare system.
But in his Chatham House speech (and letter to EU council president Donald Tusk) today, the PM seemed finally to concede that he may have to tone down his demands on even this.
What a difference six months makes. In May, the Tory general election manifesto sounded pretty uncompromising. "We will insist that EU migrants who want to claim tax credits and child benefit must live here and contribute to our country for a minimum of four years," it declared.
Fast forward to today and that word 'insist' - with its clear implication of a non-negotiable red line - has disappeared. Instead, the PM said "I am open to different ways of dealing with this issue". In his letter to Tusk, he added that the "precise means" of implementing his migration plans were "a matter for negotiation, not least as there may, in each case be different ways of achieving the same result". What had seemed a red line is now very much a faint pink, if it's visible at all.
Of course, the PM isn't doing this so he can be humiliated over a retreat on a key policy. He's having to negotiate because he's been warned that the four-year ban could be illegal (because EU law bans discriminatory practices).
A brief bit of political history is helpful here. As the Centre for European Reform's John Springford has pointed out, the four-year idea first cropped up in Cameron's immigration speech in November 2014. At the time, there was a real panic on about the rise of Ukip and Cameron needed a long ladder to get him out of his hole.
It's thought that Cameron took a liking to an Open Europe pamphlet - from Damian Chalmers and Stephen Booth - that suggested a three-year residency requirement could be introduced via an EU directive rather than treaty change. Add an extra year and, bingo, it was in the November speech.
Despite warnings from civil servants that the idea may be illegal at worst and difficult to get past 27 other nations at best, the PM put the four-year idea into the Tory manifesto.
The real fly in the ointment was that every other EU legal experts disagreed with Chalmers. They suggested that all jurisprudence and case law in the EU points to any three- or four-year ban being illegal.
One solution to what Jean-Claude Juncker's spokesman called the 'problematic' issue of in-work benefits is to level the playing field: impose a four-year ban on Brits as well as EU migrants. Some Government sources have suggested that British 18-year-olds would have to work until they are 22 to get any tax credits. Ministers don't particularly need the votes of the under-25s (as they're proving on housing benefit and the living wage), but No.10 sources are steering us away from this idea.
The other solution is to perhaps cut the four-year ban to a six-month ban. This may, just may, get past the European Court of Justice. The problem then is a political one: can the PM sell it to the public after backing off a much longer curb?
Which brings us the guts of the referendum. A vote to stay in will depend not on other countries, but on whether the public are convinced that there's a sense of fair play in the EU's dealings with the UK - and on who's doing the convincing.
Today, despite his weak warning that 'I rule nothing out', the most striking thing about David Cameron's speech was how pro-European it was. And he made clear for the first time that Britain's very security, the safety of its people, was at stake.
"Our membership of the European Union is not just a matter of trade and commerce, of pounds and pence. It is about our national security as well as our economic security. The world is undoubtedly a more dangerous place than when I made my speech at Bloomberg three years ago," he said. The EU joining forces against Putin in Ukraine, ISIL in Iraq and Syria, the Iranian nuclear programme were all cited.
Cameron even argued that the fact that the UK has a border post in Calais, rather than Dover, was proof of how important the EU was to our national security. Not an easy sell when you're suggesting the EU is part of the problem, not part of the solution, to immigration.
It can be argued that from his Bloomberg speech in 2013, through his 'renegotiation' and on through the referendum campaign, Cameron has never been in control and has been buffeted about by others. As he pointed out today, it will be others - the British people - who make the final call.
EU diplomats constantly describe the referendum as a problem of Cameron's own making, as if it were a Conservative party management issue rather than one of genuine reform. And just as the Tory party's internal tensions gave birth to the referendum, so too could they bury any 'In' vote. A raft of Eurosceptics got up in the Commons to condemn their leader's speech.
Even though they differ on the general merits of immigration, keeping control of our own borders is the issue that unites both Boris Johnson and Theresa May with many Tory Eurosceptics.
With a Tory leadership race looming in 2019, will Boris take the biggest risk of his life and come out for Brexit if Cameron fails to come back from Brussels with anything revolutionary on freedom of movement? Will the normally risk-minimising Mrs May? Leading a Brexit campaign could help either of them to win the Tory party leadership, but the cost could be high.
Don't forget that Boris may well be in the Cabinet next May and will be bound by collective responsibility. If he gets a boring job, it's not inconceivable he could stage a Hezza-style flounce-out of Cabinet to lead the Out campaign should Cameron's renegotiation really produce only 'thin gruel' (copyright, J Rees-Mogg).
Some in the Osborne camp would love Boris's bluff to be called. And the big problem for Johnson would be the danger of ending up on the losing side. Furthermore, if he does back Brexit and lose, he would face inevitable questions of when he'd next hold a fresh referendum and 'banging on about Europe' and immigration would dog the Tories once more.
For Boris, as for Cameron, playing with fire on EU immigration is a dangerous pastime. By stoking worries about generous benefits and national sovereignty, they both risk getting burned politically.
The PM today made flexibility his buzzword for a reformed EU. "Flexibility is what I believe is best for Britain; and, as it happens, best for Europe too," he said. On the key issue of EU migration and four-year benefits bans, he's shown a willing flexibility in his own renegotiation with EU partners. Just whether the public - or Boris - will be so flexible remains to be seen.