UK to hold EU referendum before 2018, David Cameron promises (VIDEO)

British Prime Minister David Cameron delivers his long-awaited speech on the UK's relationship with the EU on January 23, 2013 in London, England. Cameron has promised a referendum on EU membership should the Conservatives win the next election.

LONDON — The UK will hold a referendum on whether to stay in the European Union, Prime Minister David Cameron promised Wednesday.

Not just yet, however: the referendum will take place only if Cameron's Conservative Party wins the 2015 general election, and then not until the next parliament is well underway ("by the end of 2017 at the latest," according to the BBC).

The interval will allow London to renegotiate the terms of its current relationship with the EU, Cameron said, including taking back powers from Brussels and rewriting EU treaties.

If those changes can be achieved, the prime minister said he was sure that remaining in the EU is in Britain's best interests. Stressing the economic and political benefits of EU membership, Cameron warned: "We should think very carefully before giving that position up."

GlobalPost Senior Correspodent in London Barry Neild said Cameron's tabling of a possible EU exit, couched in the vaguest possible terms, shows the prime minister is still trying to steer a cautious path through factional squabbles that threaten to tear his own party asunder.

Yet while his promise of a referendum may have brokered a temporary peace between the pro-Europe lobby and the hardline Eurosceptics within his ruling Conservatives, it has generated heavy criticism both home and abroad.

Both the opposition Labour party and the Liberal Democrats — the Conservatives' minority partner in the UK's coalition government — have warned that Cameron's attempt to railroad Europe into redrafting its rules could backfire.

In stating his desire to keep Britain in the EU, provided its 26 other nations agree to overhaul its mechanisms and repatriate powers to its members, Cameron appears to be gambling on a positive outcome for both his referendum and his ultimatum to Europe.

But as Tony Blair, the former Labour prime minister, put it, Cameron instead appears to have cast himself in a scene from a spoof western.

Blair told the BBC: "It reminds me a bit of the Mel Brooks comedy Blazing Saddles where the sheriff says at one point as he holds a gun to his own head: 'If you don't do what I want I'll blow my brains out.' You want to watch out that one of the 26 doesn't just say: 'OK, go ahead.'"

Ed Miliband, the current Labour leader, accused Cameron of putting the demands of his own party over the concerns of the people who elected him.

"He is frightened because of the people behind him," Miliband told the UK parliament. "He is being driven to it, not by the national interest, he has been dragged to it by his party."

Nick Clegg, the leader of the Liberal Democrats, said the prime minister's decision to put Britain on an uncertain path would cost the country dearly in terms of jobs and economic growth.

European leaders, though no doubt relieved that Cameron did not specify which EU powers he wants to repatriate, vented their unease at what he was setting in motion.

“Cameron’s Europe a la carte is not an option,” said Martin Schulz, the president of the European parliament.

German Chancellor Angela Merkel, who has recently warmed to the prospect of a possible EU treaty renegotiation, warned that this could only happen with pan-European consensus.

"We are prepared to talk about [what] British wishes but we must always bear in mind that other countries have different wishes and we must find a fair compromise," Merkel said.

"We will talk intensively with Britain about its individual ideas but that has some time over the months ahead."

With up to four years of campaigning ahead of the referendum itself, it is too early to gauge which way the British public will vote on Europe.

As it stands, there is strong feeling both for and against EU membership, and an equally large number of undecideds. The recent by-election successes of the UK Independence party, which wants a withdrawal from Europe, suggests that pro-Europeans may have their work cut out to persuade a sceptical public unless Cameron can provoke meaningful change.