British voters will decide whether the country's future lies in or out of the European Union on 23 June, Prime Minister David Cameron announced today.
Within hours of yesterday's agreement, one of Mr Cameron's closest allies, Justice Secretary Michael Gove, and five other ministers declared they would campaign against him the referendum.
It was the first blow in what could be a new "civil war" in Mr Cameron's Conservative Party over Europe. Divisions over Britain's place in Europe contributed to the downfall of two of his predecessors, John Major and Margaret Thatcher.
It is a war Mr Cameron tried hard to avoid when he came to power in 2010. The following year he ordered his party in the strictest terms to vote down a bill suggesting a referendum on membership of the EU, saying it was the "wrong answer for Britain".
But within two years, he had changed his mind, paving the way to a membership referendum, by declaring: "I believe in confronting this issue - shaping it, leading the debate. Not simply hoping a difficult situation will go away."
Mr Cameron, 49, now finds himself fighting a referendum which will determine Britain's future in world affairs and shape the future of the EU - Britain is the bloc's second-largest economy.
In a quirk of the British political system, Mr Cameron is in the unusual position of being more sure of the backing of the opposition Labour Party than of his own party.
"He didn't want a referendum, he was bounced into doing it," said Douglas Carswell, a Conservative Party member until he defected to the eurosceptic UK Independence Party (UKIP) in 2014.
The deal reached yesterday followed weeks of negotiations across Europe in which Mr Cameron tried to win better terms for Britain if it remains in the EU, hoping to win over sceptical voters including many in his own party.
He said he had won his country a "special status" from the agreement, which excludes Britain from the founding goal of "ever closer union" and hands the government welfare curbs to try to tackle concerns over high levels of migration.
A spokesman for Mr Cameron said the prime minister had always focused on winning "the best deal for the British people" and denied the negotiations had been about "party management".
The Secretary of State for Northern Ireland, Theresa Villiers, is among those campaigning for the UK to leave the EU.
The DUP leader Arlene Foster has also said the party will campaign to leave the EU. Ms Foster said the DUP had always been eurosceptic in its outlook, and she said it saw nothing in the deal agreed by Mr Cameron to change that outlook.
The SDLP, Alliance and Sinn Féin are in favour of remaining in the EU while the Ulster Unionists have not yet announced their view.
Among the first ministers to declare they would be campaigning for an "in" vote were Home Secretary Theresa May, Business Secretary Sajid Javid, International Development Secretary Justine Greening and Transport Secretary Patrick McLoughlin.
Earlier, Taoiseach Enda Kenny hailed the agreement reached at the two-day EU summit.