British Prime Minister David Cameron has pledged to hold a referendum on Britain's EU membership if the Conservatives win the next election.

Mr Cameron ended months of speculation by announcing in a speech in London that the "in-out" referendum would be held between 2015 and the end of 2017.

However, he said he will campaign "with all my heart and soul" for Britain to stay in the EU when the referendum comes.

Mr Cameron said that if Britain left the union "it would be a one-way ticket, not a return".

The prime minster shrugged off warnings that the referendum could imperil Britain's diplomatic and economic prospects and alienate its allies.

Mr Cameron said Britain did not want to pull up the drawbridge and retreat from the world but that public disillusionment with the EU is at "an all-time high".

"It is time for the British people to have their say. It is time for us to settle this question about Britain and Europe," he said.

His Conservative party would campaign for the 2015 election promising to renegotiate Britain's EU membership.

Mr Cameron said: "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 European Union on these new terms or come out altogether. It will be an in-out referendum."

Whether Mr Cameron will ever hold the referendum remains as uncertain as the Conservatives' chances of winning the next election due.

The party trails the opposition Labour party in opinion polls, and the coalition government is pushing through painful public spending cuts to try to reduce Britain's large budget deficit, which is likely to upset voters in the meantime.

Mr Cameron's promise looks likely to satisfy much of his own party, which has been split on the issue, but may create uncertainty when events could put his preferred option of a looser version of full British membership out of reach.

The move may also unsettle other EU states, such as France and Germany.

European officials have already warned Mr Cameron against treating the union as an "à la carte menu" from which he can pick and choose membership terms.

German Chancellor Angela Merkel has said she wants Britain to be an active member of the EU.

Ms Merkel said she is prepared to speak about British wishes, but they have to find a compromise that is fair for all.

Mr Cameron is also likely to raise concerns in the US, a close ally, which has said it wants Britain to remain inside the EU with "a strong voice".

Nor is it likely to help heal rifts with his pro-European Liberal Democrat junior coalition partners.

Mr Cameron said he would prefer Britain, the world's sixth biggest economy, to remain inside the 27-nation EU, but he also made clear he believes the EU must be radically reformed.

A new EU must be built upon five principles, he said: competitiveness, flexibility, power flowing back to - not just away from - member states, democratic accountability and fairness.

The eurozone debt crisis is a main reason why Britain must reassess its relationship with the wider EU, Mr Cameron said, adding that a closer union was not Britain's objective.

Mr Cameron said the EU faced three main problems: the debt crisis, competitiveness and faltering public support.

Democratic consent for the EU in Britain was now "wafer thin", reflecting the results of many opinion polls that have shown a slim majority would vote to leave the union and the rise of the UK Independence Party that favours complete withdrawal.

"Some people say that to point this out is irresponsible, creates uncertainty for business and puts a question mark over Britain's place in the European Union," said Mr Cameron.

"But the question mark is already there. Ignoring it won't make it go away."

Avoiding a referendum would make an eventual British exit more likely, not less, he said.

This would risk bottling up resentment towards the EU, compounding people's feeling that "the EU is heading in a direction that they never signed up to".

"Simply asking the British people to carry on accepting a European settlement over which they have had little choice is a path to ensuring that when the question is finally put - and at some stage it will have to be - it is much more likely that the British people will reject the European Union."

Many Britons resent the EU's interference in their daily lives and its "unnecessary rules and regulations", he added.

Mr Cameron's speech has been marked by long delays, diplomatic rows and the postponement due to the Algerian hostage crisis.

Narrow majority in favour of leaving EU - Poll

The most recent opinion poll in Britain showed a narrow majority in favour of leaving the European Union - but that would change if Mr Cameron renegotiated Britain's relationship with Europe, and called for a yes vote on the basis that British interests were protected.

The YouGov poll for today's edition of The Sun newspaper showed that 40% of those polled would vote ot leave the EU, compared to 37% who want Britain to remain, while 6% said they would not vote, and 18% were undecided.

However, when the pollsters asked people to imagine Mr Cameron had renegotiated Britain's relationship with Europe, said British interests were now protected, and called for a yes vote, 53% would vote to stay in the EU, 26% would vote to leave, 5% would not vote, and 17% were undecided.

This comes three days after another poll by the same organisation, which for the first time in the current parliament showed a majority in favour of staying - by 40% to 34%.

There is strong support for the holding of a referendum - with 58% in favour, 23% opposed, and 19% say they don't know.

Clegg warns of future uncertainty

Deputy Prime Minister and liberal Democrat leader Nick Clegg said that a renegotiation of Britain's position in Europe was not in the national interest and would lead to years of uncertainty for business.

"The biggest challenge which is facing our country is that we have a fragile economy which is taking time to recover," he said.

"That's why my priority, certainly the priority of the Liberal Democrats, is to build a stronger economy in a fairer society.

"Now, that job is made all the harder if we have years of grinding uncertainty because of an ill-defined, protracted renegotiation of Britain's status within the European Union."

Cameron a 'weak prime minister' - Miliband

Labour leader Ed Miliband said the speech defined Mr Cameron as "a weak prime minister, being driven by his party, not by the national economic interest".

Mr Miliband said: "Everyone knows that the priority for Britain is the jobs and growth that we need.

"We have had warning after warning from British business about the dangers of creating years of uncertainty for Britain."

UKIP leader Nigel Farage said the referendum promise was a vindication of his party's long struggle but warned that securing a no vote would be tough and UKIP's "real job starts today".

He questioned whether Mr Cameron was serious about repatriating powers or simply looking to win back eurosceptic voters to the Tories.

'No surprises' in speech - Creighton

Minister for European Affairs Lucinda Creighton has said that there were "no surprises" in Mr Cameron's speech.

Ms Creighton said that it was now up to the British people to decide on their future relationship with the EU.

However, she said that it was clear at the level of 26 other member states that there was "no appetite whatsoever" for new treaty change in the foreseeable future.

The minister said that the speech's reference to strengthening the single market and the need to be competitive were principles that "we all agree with".

She said she hoped an in-out referendum in Britain would lead to a "more balanced and reasonable debate".

"Our experience of referendums has been very positive, in that they really engaged people in the issues," she said.

Tánaiste and Minister for Foreign Affairs Eamon Gilmore said the EU was better off with Britain inside of it, rather than outside.

But he said focus must not become a case of "who is in and who is not".

Fine Gael MEP Gay Mitchell said Mr Cameron's pledge has more to do with British politics than British interests.

Mr Mitchell said any renegotiation of the terms of EU membership by Britain would open the door for other countries to seek to do the same and he does not know how it can work.

He said Britain belongs at the heart of Europe.

1975 State papers: Staying in Europe 'less-damaging'

The last time Britain held a referendum on whether to remain within the European Union (then the EEC), the then-government concluded that Ireland would lose out, whether it remained after UK withdrawal, or left at the same time.

However, the January 1975 report of an Inter-Departmental Group on the economic consequences of British withdrawal, concluded that the consequences of staying in Europe would be "less damaging" than withdrawing.

In a referendum in June 1975, Britain voted to stay in the EEC by a two to one margin.

British officials identified keeping the UK within the EEC as "a major political objective for Ireland", and said the Irish presidency of the EEC in the first half of 1975 helped in the renegotiation of British terms of membership.

Former British Prime Minister Tony Blair

Britain's pro-EU former Labour Prime Minister Tony Blair said he felt a "huge stab of anxiety" about the prospect of an in/out referendum on the European Union.

Speaking from the World Economic Forum in Davos, Switzerland, Mr Blair told Sky TV that Britain's eventual exit from the EU was now on the agenda.

Mr Blair said he agreed with Cameron when he said in a landmark speech earlier today that reform was needed in Europe.

The British Conservatives have long argued amongst themselves about whether Britain should be an EU member, a division eagerly exploited by the small but vociferous anti-EU UK Independence Party (UKIP) which is rising in opinion polls.

Mr Blair added: "There's got to be a compelling reason to put that (referendum) question on the agenda. I don't see that compelling reason now."

Hollande says no question of diminishing EU for UK

French President Francois Hollande said there is no question of "diminishing" the European Union to allow Britain to stay in it.

"What I'll say, on behalf of France and as a European, is that it isn't possible to bargain over Europe to hold this referendum," Mr Hollande said on a trip to the Alpine city of Grenoble.

He continued: "Europe must be taken as it is. We can help it evolve tomorrow, but we can't offer to reduce it or diminish it on the grounds of (Britain) staying in it."