Britons will be able to vote to leave the European Union by the end of 2017 if the Conservatives win the next general election, David Cameron has pledged.
The Prime Minister promised to negotiate a new settlement with Brussels and then stage a straight in-out referendum on British membership if he stays in power.
In one of the defining speeches of his premiership, he declared: "It is time for the British people to have their say. It is time to settle this European question in British politics."
He told business chiefs that the Tory manifesto will include a pledge to reach a fresh agreement, to be put to the vote within the first half of a five-year Parliament.
The vow sparked an angry row in Westminster, with both Nick Clegg and Ed Miliband warning that it will condemn the British economy to years of uncertainty.
The Labour leader claimed at PMQs: "He is running scared of UKIP. He has given in to his party and he can't deliver for Britain," as he came out against a referendum.
Mr Clegg warned that years of "grinding uncertainty because of an ill-defined, protracted renegotiation" would hit growth and jobs.
There were also immediate questions over whether other EU states will be prepared to negotiate a special "a la carte" membership for the UK.
In a boost to Mr Cameron, German Chancellor Angela Merkel said she was prepared to "talk about British wishes" to try and achieve a "fair compromise".
But her foreign minister Guido Westerwelle insisted "cherry-picking is not an option" and the President of the European Parliament Martin Schulz said Mr Cameron was "playing a dangerous game".
Laurent Fabius, the French foreign minister, added: "Say that Europe is a soccer club. You join this soccer club, but you can't say you want to play rugby."
Mr Cameron insisted that he does not want Britain to quit the 27-nation bloc and would "fight with all my heart and soul" for a yes vote when the time comes.
But he conceded that public mistrust of the EU is growing and democratic consent is now "wafer thin" because its role has snowballed since the last referendum in the 1970s.
"I never want us to pull up the drawbridge and retreat from the world. I am not a British isolationist but I do want a better deal for Britain," he said.
The Prime Minister rejected the idea of an immediate referendum, insisting it was the wrong time for such a "momentous decision" when the EU is still reeling from the eurozone crisis.
Instead, he outlined plans for a new treaty to reshape the EU, resolve the eurozone crisis, increase the group's flexibility, accountability and competitiveness and allow the return of powers from Brussels.
His "strong preference" is to push through reforms for the whole of the EU but he vowed to negotiate for the UK alone if other member states do not join him.
"The next Conservative manifesto in 2015 will ask for a mandate from the British people for a Conservative government to negotiate a new settlement with our European partners in the next Parliament," he said. "It will be a relationship with the single market at its heart.
"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. Legislation will be drafted before the next election and if a Conservative Government is elected we will introduce the enabling legislation immediately and pass it by the end of that year.
"We will complete this negotiation and hold this referendum within the first half of the next Parliament."
Mr Cameron rejected claims that he is undermining the British economy by tabling a vote, insisting that an exit was more likely if the issue was ignored.
In a move set to delight many Tory MPs, he also signalled a referendum would go ahead even if he is forced into a second coalition. "If I am prime minister, this will happen," he vowed.
Effectively issuing an ultimatum to Brussels, Mr Cameron declared: "The danger is that Europe will fail and the British people will drift towards the exit.
"It is hard to argue that the EU would not be greatly diminished by Britain's departure," he said.
He called for "fundamental, far-reaching change" as he admitted that the "EU is seen as something that is done to people, rather than acting on their behalf".
Mr Cameron rejected the principle of "ever closer union" and called for the end to the "one-size-fits-all" approach with countries in future having different levels of involvement.
However, he set himself firmly against a British exit and warned voters not to choose to leave without considering all the consequences.
"I understand the appeal of going it alone, of charting our own course. But it will be a decision we will have to take with cool heads," he said.
"Of course, Britain could make her own way in the world outside the EU if we chose to do so. So could any other member state. The question we will have to ask ourselves is this: is that the very best future for our country?"
He added: "I want the European Union to be a success and I want a relationship between Britain and the EU that keeps us in it.
"There is no doubt that we are more powerful in Washington, in Beijing, in Delhi because we are a powerful player in the European Union. That matters for British jobs and British security."
He accepted that the scale of his task was vast but declared: "Over the coming weeks, months and years, I will not rest until this debate is won."
The referendum pledge should help the Tories combat the growing threat from UKIP and many Tory MPs hope it will be a turning point in the battle to win power in 2015.
The speech has been months in the planning - with the delay an indication of the difficult balancing act Mr Cameron is attempting to achieve.
It was eventually scheduled to happen in Amsterdam last Friday but was postponed because of the Algerian hostage crisis.
Political editor Adam Boulton said: "This is David Cameron's big throw of the dice politically . He is gambling that the British people will be so attracted by his offer that they will want to give the Conservatives a majority in 2015.
"He is also gambling that the impetus he will have politically from the voters will give him enough leverage with his European partners to negotiate a new deal for Britain."
Downing Street later played down the criticism from some European politicians and insisted Mr Cameron was confident of securing a "better deal for Britain".
"You would anticipate those reactions but it is not always our job to worry about what the foreign ministers are saying. It is our job to worry about what the British people are saying," his spokesman said.