DAVID CAMERON’S vision for Europe is compelling. The prime minister wants a European Union dedicated to free trade and competitiveness, which helps business rather than tying it in red tape. It should be a “leaner, less bureaucratic union”, he says. There should be intense co-operation on things like tackling terrorism, but, as far as possible, decisions affecting the people of a country should be made by the government of that country. The club must include Britain. All this he laid out in a long-delayed and epochal speech in London on January 23rd.

But Mr Cameron’s plan to realise his vision is risky. He intends to renegotiate Britain’s relationship with the EU and then to hold a referendum on whether Britain should stay or leave. The vote will be held in the first half of the next parliament—by the end of 2017, in other words.

Mr Cameron’s move is, ultimately, driven by the euro zone’s troubles. Eurosceptics in the Conservative Party have long been nipping at the ankles of party leaders, but the level of harassment has risen as Europe’s fortunes have declined. If the euro zone is to stay together, it seems likely that the union will have to be a tighter one. Eurosceptics see this period of flux as an opportunity for Britain to loosen its ties with the EU. By conceding a referendum, Mr Cameron hopes to undermine sceptics both inside his party and in the United Kingdom Independence Party (UKIP), a small but determined outfit that could deprive the Tories of a majority in the next election.

But even if Mr Cameron’s primary purpose in calling a referendum is to save his political skin, there are other, better, arguments for having one. Referendums are a good way of settling important constitutional questions which, because they split political parties as well as the electorate, cannot be decided through a general election. This newspaper believes that a referendum is needed at some point to settle the difficult matter of Britain’s relationship with Europe.

The big question, then, is when that referendum should be held. Mr Cameron correctly says that now is not the right time, because the future of the EU is too hazy. He wants to hold it in the first half of the next parliament. By then, things should be clearer. This delay will also allow him time to renegotiate his country’s relationship with the EU. He has already said that Britain will opt out from many pan-European judicial and police agreements, as it is entitled to do, and although he is vague about what other concessions he intends to demand, he promises Britons fundamental change.

Happy Tories, grumpy Labour

For Mr Cameron, the speech seems to be working. It has delighted the Tory backbench MPs who feared losing their seats to UKIP (see article). It has put the more Europhile Labour Party in a quandary. If Labour fails to promise a referendum, it will come across as elitist.

For Britain, there is also much in it that is good. Mr Cameron did well to reject the idea, popular among Eurosceptics, that Britain should try for a half-in-half-out status similar to Norway’s or Switzerland’s. Britain could have wasted a lot of time pursuing a solution which ultimately would not have worked, because any such deal that other member states would have agreed to would not have been acceptable to Britons.

His decision to leave vague what he hopes to achieve in a renegotiation was also smart. It allows him to define what success is, and thus to present British voters with a new deal that he can claim as a triumph.

This newspaper would have preferred that Mr Cameron leave the timing of the referendum vague, too. Although it would not have served his purposes so well—the Tory Eurosceptics would have howled and UKIP would have jeered—it would have served the country’s interests better by allowing a future Conservative government to call a referendum at a good time, not a bad one.

Put it all on blue

Going for a referendum in five years’ time or less is risky. First, it could be economically damaging. Business is, by and large, horrified by the prospect that Britain might leave. In the past few weeks three carmakers have called for it to stay in. The threat of an exit as soon as 2017 is likely to discourage multinational companies from investing in Britain.

Second, though five years sounds a long time, it may not be long enough to resolve the euro zone’s future. When the crisis started, nobody would have dreamed that it would go on for more than five years; its resolution could take even longer. By the middle of the next parliament, Britain may still not know what it is voting to stay in or leave.

Explore our interactive guide to Europe's troubled economies

Third, the negotiations could go badly. Many European leaders have come to resent what they see as British special pleading, and are beginning to think the country is heading for the exit. If they conclude that Britain is more concerned with getting its own way than with the health of the European project they could dig in hard, with drastic consequences for Mr Cameron. A humiliated nation might well use a referendum to slap its government (then suffering an inevitable mid-term slump) and send the country out of the EU.

The risks are considerable; but Mr Cameron has some decent cards. Angela Merkel values Britain as a liberal ally, and on the EU budget and the banking union she showed that she was prepared to make concessions to help Mr Cameron see off the Eurosceptics. It seems likely that she will give ground on the renegotiation too, in order to get the answer she wants in the referendum. And it is clear that, however much the British public grumbles about Brussels, it is not set on leaving. In May last year, twice as many Britons told pollsters that they wanted to leave as wanted to stay. As the prospects of an exit have risen, support for it has fallen. Right now, opinion is finely balanced between staying and going.

Mr Cameron is taking an unnecessary risk with his country’s future. But his hand is stronger than some of his opponents maintain; and so, with a bit of luck, his gamble should pay off.