David Cameron hailed a landmark deal on Friday he said gave Britain "special status" in the European Union and pledged to campaign heart and soul to stay in the EU at a deeply uncertain referendum expected in June.
At a summit that ran into overtime, EU leaders agreed unanimously on a package of measures aimed at keeping Britain in the 28-nation bloc to avoid a potentially disastrous divorce.
Their legally binding decision granted Britain an explicit exemption from the founding goal of "ever closer union", offered concessions on the welfare rights of migrant workers and safeguards for the City of London financial center.
The British prime minister said he had achieved all his main negotiating aims and would recommend the agreement to his cabinet on Saturday, firing the starting gun on a fierce referendum campaign on Britain's future membership of the bloc.
"I believe we are stronger, safer and better off inside a reformed European Union," he told a news conference. "And that is why I will be campaigning with all my heart and soul to persuade the British people to remain in the reformed European union that we have secured today."
The euroskeptic "Vote Leave" campaign was quick to dismiss what it called "Cameron's hollow deal" as bad for Britain.
Cameron acknowledged that one of his closest political allies, Justice Secretary Michael Gove, would campaign to leave the EU, saying he was disappointed but not surprised. He suggested other Conservatives may also join the "out" camp.
He would not officially confirm the expected polling date of June 23 but said he would make an announcement soon.
After two days of intense wrangling in Brussels, EU leaders determined to try to keep Britain in the union resolved outstanding disputes over migrant workers' welfare rights and relations between London and the euro zone.
"So now the deal is done and its up to the British people to decide," said European Commission President Jean-Claude Juncker - the man Cameron tried furiously to block for the top EU executive job, but who played a key role in crafting the deal.
German Chancellor Angela Merkel, one of Britain's strongest allies in Europe, said: "We believe that with this we have given David Cameron a package with which he can campaign in Britain for Britain to stay in the European Union."
The agreement delivered victory to Cameron on several of the key demands on which he chose to fight for what he called "a new settlement" with Europe.
He won a commitment to change the bloc's governing treaties in future to recognize that Britain was not bound to any political union and would have safeguards against financial regulation being imposed on the City of London by the euro zone.
Facing an uphill political battle at home, Cameron was concerned to show Britons that he had won concessions that he believes can reduce an influx of EU migrant workers and keep Britain out of any future political integration.
In hours of wrangling with central and east European countries that provide many of Britain's low-paid immigrant workers, he secured the right to curb in-work benefits for up to four years and scale back child benefit for workers whose children remain abroad.
East European countries were only partially successful in restricting Cameron's welfare cuts to new arrivals rather than the more than 1 million European migrant workers already in the UK. In the end, both sides emerged with something to show for their negotiations.
The Visegrad Group, comprising Poland, Hungary, Slovakia and the Czech Republic, said the deal reflected their key demands.
A compromise largely favorable to Britain was found for French concerns about differential treatment for London banks outside the euro zone as well as to Belgian grumbles about Britain setting a precedent for states to snub EU integration.
Belgium did also secure what EU officials called a "self-destruct" clause whereby that the entire deal would be null and void if Britain votes to leave the EU.
That would to preclude any second renegotiation. Cameron was also at pains to dismiss arguments by some British euroskeptics that a "leave" vote would lead to a better deal.
"The idea that a vote to leave the European Union would lead to a whole new renegotiation is for the birds," he said.
The risks of Cameron's strategy were highlighted on Friday when an opinion poll showed the campaign to leave the bloc had a two-percent lead with 36 percent support. The TNS poll showed 34 percent of British voters wanted to stay in the bloc, 7 percent would not vote and 23 percent were undecided.
But the 49-year-old British leader, a former PR executive, is a formidable campaigner who confounded pollsters and pundits by winning an outright general election victory last year.
Perhaps the biggest threat to his campaign could come from charismatic London mayor Boris Johnson, a euroskeptic former Brussels journalist, who has yet to disclose which side he will take in a battle that could also involve Cameron's succession.
Britain is already the EU's most semi-detached member, having opted out of joining the euro single currency, the Schengen zone of passport-free travel and many areas of police and judicial cooperation. Summit chairman Donald Tusk said Britain had long had a special status inside the bloc.
Many leaders said they felt they were at a historic turning point for European integration.
No country has ever voted to leave the Union. Britain is the EU's second-largest economy and one of its two permanent members on the UN Security Council. Its exit would end the vision of the EU as the natural home for European democracies and reverse the continent's post-World War Two march toward "ever closer union".
The EU issue has divided Cameron's Conservative Party for decades, crippling his 1990s predecessor John Major and bringing down his hero Margaret Thatcher.
Britain's largely euroskeptic press has depicted Cameron as begging or pleading, the Daily Mail describing him as "rattled".
"Shambles as embattled PM's deal is watered down," a front-page headline read over a picture of an anxious-looking Cameron.