When David Cameron decided to impose a three-line whip on Tory MPs for last night's vote on an EU referendum, he miscalculated.
He assumed the traditional combination of party loyalty, hope of promotion and fear of the penalties would keep any backbench rebellion down to a manageable level. But for a number of reasons – including genuine principle, political advantage and a difficult relationship with his own backbenchers – the strategy failed.
In the first place, Mr Cameron appears to misjudge the strength of feeling on the issue among MPs. The present Conservative Parliamentary party is more Eurosceptic than at any time.
The problems in the eurozone have emboldened Tory EU critics who believe that not only were they right about the single currency but they are also correct in their analysis that it is in Britain's strategic national interest to break away (at least in part) from Brussels.
But if that's the principle, then there was also a touch of political gamesmanship in last night's vote. The planned boundary changes and reduction in the number of MPs at the next election means many Tory backbenchers will have a fight to keep their seats. Normally that might count in favour of the leadership – but grassroots Tory sentiment is overwhelmingly anti-European and these are the people who will decide who stays and who goes.
Mr Cameron may have won the vote but he has entrenched divisions in his party. And that could spell further trouble for him in future.