Media playback is unsupported on your device Media caption PM David Cameron: "We will give the British people a referendum with a very simple in or out choice"

David Cameron has said the British people must "have their say" on Europe as he pledged an in/out referendum if the Conservatives win the election.

The prime minister said he wanted to renegotiate the UK's relationship with the EU and then give people the "simple choice" between staying in under those new terms, or leaving the EU.

The news was welcomed by Eurosceptics who have long campaigned for a vote.

France and Germany both warned the UK could not "cherry pick" EU membership.

During noisy Prime Minister's Questions exchanges in Parliament, Labour leader Ed Miliband said Mr Cameron was "running scared" of the UK Independence Party, whose poll ratings have been rising.

Mr Miliband, who said he opposed holding an in/out referendum, said Mr Cameron was "going to put Britain through years of uncertainty, and take a huge gamble with our economy."

In his long-awaited speech, welcomed by many Conservative MPs, Mr Cameron pledged to hold a referendum during the early part of the next parliament - by the end of 2017 at the latest - if the Conservatives win the next general election.

He said it would be a decision on the UK's "destiny" and, if he secured a new relationship he was happy with, he would campaign "heart and soul" to stay within the EU.

"It is time for the British people to have their say," he said. "It is time to settle this European question in British politics. I say to the British people: this will be your decision."

However, Mr Cameron did not spell out what powers he would like to see the UK take back as part of a new settlement or what would happen if the negotiations did not go his way.

'Very simple choice'

The Conservative leader has been under pressure from many of his MPs to give a binding commitment to a vote on Europe.

Analysis It has taken quite some time for the prime minister to go from promising a major speech on Europe to delivering it. But today marks the beginning of a process, not the end. The many Eurosceptics in his party will be pleased that he is offering an in/out referendum on Britain's membership of the EU - although some will regard the timescale as tardy. But there are important hurdles. He has to win the next election with an overall majority. His European partners will have to be willing to renegotiate Britain's relationship. And while the promise of a referendum will unite many in his party this side of an election, the process of renegotiation might re-open divisions. What the PM didn't say today is what would he do if the negotiations deliver less than he would like. Would he still proceed with an in/out referendum? Would he still argue for a yes vote? Would others in his party who would be prepared to stay on the EU on the right terms defect to the No camp if they don't like the deal the PM strikes with Brussels? Labour and the Lib Dems say David Cameron is creating damaging uncertainty for business, but he has thrown down the gauntlet to them. Can they allow him to be the only major party leader to offer voters a say on EU membership after the next election? Annotated transcript: Cameron speech

Mr Cameron said "disillusionment" with the EU was "at an all-time high" and "simply asking the British people to carry on accepting a European settlement over which they have had little choice" was likely to accelerate calls for the UK to leave.

"That is why I am in favour of a referendum," he said. "I believe in confronting this issue - shaping it, leading the debate. Not simply hoping a difficult situation will go away."

Setting out the conditions for a future poll, he said he would seek a "mandate" for a renegotiation and a referendum in the next Conservative election manifesto.

"And when we have negotiated that new settlement, we will give the British people a referendum with a very simple in-or-out choice to stay in the EU on these new terms; or come out altogether. It will be an in/out referendum."

But he said holding such a referendum now would be a "false choice" because Europe was set to change following the eurozone crisis and it would be "wrong to ask people whether to stay or go before we have had a chance to put the relationship right".

Mr Cameron said he understood "the appeal" of Britain going it alone and he was sure the UK would survive outside the EU. But, he said, the UK must think "very carefully" about the implications of withdrawal for its prosperity and role on the international stage.

"If we left the European Union, it would be a one-way ticket, not a return," he added.

The prime minister rejected suggestions that a new relationship was "impossible to achieve", adding that he would prefer all other EU countries to agree a new treaty but would be prepared to seek negotiations on a unilateral basis.

However French foreign minister Laurent Fabius warned: "You can't do Europe a la carte... to take an example which our British friends will understand - imagine Europe is a football club and you join, once you're in it you can't say 'Let's play rugby'".

German foreign minister Guido Westerwelle said Germany wanted the UK to "remain an active and constructive part of the European Union... but cherry picking is not an option" before adding that Europe needed more, not less, integration.

Conservative MPs who want a looser relationship with the EU said Mr Cameron's promise a "watershed" moment.

Douglas Carswell told the BBC it was the speech he had "been waiting to hear from a Conservative prime minister all my adult life", while Mark Pritchard said it was "a major triumph" and would unite his party.

Media playback is unsupported on your device Media caption Nigel Farage: 'The attempt to kick the can down the road for five years is not good enough'

Mayor of London Boris Johnson said the British people had not been consulted on Europe since 1975, and it was "high time" they were.

But the former European commissioner and Labour cabinet minister Lord Mandelson told the BBC that Mr Cameron was putting forward a "completely bogus and rather phoney set of demands and circumstances" designed to appease critics in his party.

Shadow foreign secretary Douglas Alexander added: "We understand the need for change but I don't honestly believe the best way to get change in a club of 27 is to stand at the exit door demanding change or threatening to leave."

Former Labour Prime Minister Tony Blair said it was a worrying that the UK had put its departure from the EU "on the table".

He told BBC Radio 4's The World at One: "It reminds me a bit of the Mel Brooks comedy Blazing Saddles where the sheriff, at one point during it, holds a gun to his own head and says: 'If you don't do what I want I'll blow my brains out.' - you want to watch that one of the 26 (other EU members) don't say just go ahead."

'Threatening to leave'

The Lib Dems, who are the junior partner in the UK's governing coalition, say pursuing a wholesale renegotiation of the UK's membership will cause uncertainty.

Lib Dem leader Nick Clegg, who is also deputy prime minister, said "years of uncertainty" caused by a future referendum would hit jobs and growth and this "was not in the national interest".

Media playback is unsupported on your device Media caption Nick Clegg: "In my view it's not in the national interest"

And former Lib Dem leader Charles Kennedy told the BBC he could not see his party agreeing to a referendum if the Conservatives failed to win a majority at the next election and approached it to form another coalition.

The UK Independence Party said the "genie was out of the bottle" about a possible exit from the EU.

"Winning this referendum, if and when it comes, is not going to be an easy thing but I feel that UKIP's real job starts today," the party's leader Nigel Farage said.

John Cridland, director-general of employers' group, the CBI, said "closer union of the eurozone is not for us" but Mr Cameron "rightly recognises the benefits of retaining membership of what must be a reformed EU".

John Longworth, director general of the British Chambers of Commerce, said the announcement showed Europe had to take the PM seriously, but added: "The lengthy timescale for negotiation and referendum must be shortened, with the aim of securing a cross-party consensus and the outline of a deal during this Parliament."

The BBC's Steve Evans in Berlin said opinion was hardening in Germany and France, with many politicians believing that those opposed to further European integration would be better off "leaving gracefully".

The speech, which has been in the planning for six months, had been scheduled for last Friday in the Netherlands, but was postponed because of the Algerian hostage crisis.