EU reform deal: What Cameron wanted and what he got
David Cameron is campaigning for Britain to remain in the EU after securing a deal he claims will give the country "special status" in the 28 nation bloc.
But did he get what he wanted?
Here we look at the draft reform proposals drawn up by European Council President Donald Tusk at the start of February, the final text agreed on Friday and what Mr Cameron originally promised.
What Cameron wanted: Allowing Britain to opt out from the EU's founding ambition to forge an "ever closer union" of the peoples of Europe so it will not be drawn into further political integration in a "formal, legally binding and irreversible way". Giving greater powers to national parliaments to block EU legislation.
What the draft deal said: "The references to an ever closer union among the peoples are... compatible with different paths of integration being available for different member states and do not compel all member states to aim for a common destination.
"It is recognised that the United Kingdom... is not committed to further political integration into the European Union.
"Where reasoned opinions on the non-compliance of a draft union legislative act with the principle of subsidiarity, sent within 12 weeks from the transmission of that draft, represent more than 55% of the votes allocated to the national parliaments, the council presidency will include the item on the agenda of the council for a comprehensive discussion."
What the final deal said: "It is recognised that the United Kingdom, in the light of the specific situation it has under the Treaties, is not committed to further political integration into the European Union. The substance of this will be incorporated into the Treaties at the time of their next revision in accordance with the relevant provisions of the Treaties and the respective constitutional requirements of the Member States, so as to make it clear that the references to ever closer union do not apply to the United Kingdom."
Assessment: Mr Cameron has secured a commitment to exempt Britain from "ever closer union" to be written into the treaties. He has also negotiated the inclusion of a "red-card" mechanism, a new power. If 55% of national parliaments agree, they could effectively block or veto a commission proposal. The question is how likely is this "red card" system to be used. A much weaker "yellow card" was only used twice. The red-card mechanism depends crucially on building alliances. The sceptics say it does not come close to winning the UK back control of its own affairs - and Mr Cameron is set to announce further measures which he claims will put the sovereignty of the Westminster Parliament "beyond doubt".
Some key areas also appear to be have been dropped along the way. There will be no repatriation of EU social and employment law, which was a 2010 manifesto commitment. There will be no changes to the working-hours directive.
Migrants and welfare benefits
What Cameron wanted: The Conservative manifesto said: "We will insist that EU migrants who want to claim tax credits and child benefit must live here and contribute to our country for a minimum of four years." It also proposed a "new residency requirement for social housing, so that EU migrants cannot even be considered for a council house unless they have been living in an area for at least four years".
The manifesto also pledged to "end the ability of EU jobseekers to claim any job-seeking benefits at all", adding that "if jobseekers have not found a job within six months, they will be required to leave".
Mr Cameron also wanted to prevent EU migrant workers in the UK sending child benefit or child tax credit money home. "If an EU migrant's child is living abroad, then they should receive no child benefit or child tax credit, no matter how long they have worked in the UK and no matter how much tax they have paid," says the Tory manifesto.
What the draft deal said:"[New legislation will] provide for an alert and safeguard mechanism that responds to situations of inflows of workers from other member states of an exceptional magnitude over an extended period of time… the implementing act would authorise the member state to limit the access of union workers newly entering its labour market to in-work benefits for a total of up to four years from the commencement of employment."
What the final deal said:
On in-work benefits: The Council would authorise that Member State to limit the access of newly arriving EU workers to non-contributory in-work benefits for a total period of up to four years from the commencement of employment. The limitation should be graduated, from an initial complete exclusion but gradually increasing access to such benefits to take account of the growing connection of the worker with the labour market of the host Member State. The authorisation would have a limited duration and apply to EU workers newly arriving during a period of 7 years.
On child benefit: A proposal to amend Regulation (EC) No 883/2004 of the European Parliament and of the Council on the coordination of social security systems in order to give Member States, with regard to the exportation of child benefits to a Member State other than that where the worker resides, an option to index such benefits to the conditions of the Member State where the child resides. This should apply only to new claims made by EU workers in the host Member State. However, as from 1 January 2020, all Member States may extend indexation to existing claims to child benefits already exported by EU workers. The Commission does not intend to propose that the future system of optional indexation of child benefits be extended to other types of exportable benefits, such as old-age pensions;
Assessment: Mr Cameron had to compromise on this aspect of the deal in the face of strong opposition from Poland and three other central European countries. He got the four-year "emergency brake" on in-work benefits he had set such store by - but new arrivals will have their tax credits phased in over four years. The brake will be in place for a maximum of seven years, rather than the 13 years Mr Cameron is thought to have wanted - but the EU has agreed it would be "justified" to trigger it without delay after the referendum if the UK votes to stay in the EU.
Mr Cameron failed in his original demand to ban migrant workers from sending child benefit money back home. Payments will instead be linked to the cost of living in the countries where the children live. The new rules will apply immediately for new arrivals, and for existing claimants from 2020.
The UK government has already reached an agreement on out-of-work benefits. Newly arrived EU migrants are banned from claiming jobseeker's allowance for three months. If they have not found a job within six months they will be required to leave. EU migrant workers in the UK who lose their job, through no fault of their own, are entitled to the same benefits as UK citizens, including jobseekers allowance and housing benefit, for six months.
Neither the draft deal nor the final agreement mention changes to social housing entitlement but they were never part of Mr Cameron's preliminary negotiations.
Economic governance or safeguarding interests of countries outside the eurozone
What Cameron wanted: An explicit recognition that the euro is not the only currency of the European Union, to ensure countries outside the eurozone are not materially disadvantaged. He also wanted safeguards that steps to further financial union cannot be imposed on non-eurozone members and the UK will not have to contribute to eurozone bailouts.
What the draft deal said: "Measures, the purpose of which is to further deepen the economic and monetary union, will be voluntary for member states whose currency is not the euro.
"Mutual respect between member states participating or not in the operation of the euro area will be ensured.
"Legal acts... [between eurozone countries] shall respect the internal market."
What the final deal said: The language on monetary union was unchanged. On financial regulation, this line was added: "The single rulebook is to be applied by all credit institutions and other financial institutions in order to ensure the level-playing field within the internal market."
Assessment: Mr Cameron won guarantees that countries outside the eurozone, such as Britain, will not be required to fund euro bailouts and will be reimbursed for central EU funds used to prop up the euro. The deal also provides a right for any member state to escalate concerns about the impact of eurozone decisions for urgent discussion in the European Council.
But Mr Cameron ran into unexpectedly firm resistance from France on financial regulation. The French wanted to underline was that Britain would not win any "exceptions to the rules of the EU" - particularly in relation to regulation in the City - hence the addition of the "level playing field" line.
Mr Cameron got his explicit recognition that the EU has more than one currency - but it does not go as far mandating "multiple currencies".
What Cameron wanted: A target for the reduction of the "burden" of excessive regulation and extending the single market.
What the draft deal said: "The EU must increase efforts towards enhancing competitiveness, along the lines set out in the Declaration of the European Council on competitiveness. To this end the relevant EU institutions and the member states will make all efforts to strengthen the internal market….this means lowering administrative burdens."
What the final deal said: Similar language but a promise to establish "where feasible burden reduction targets in key sectors, with commitments by EU institutions and Member States.
Assessment: This was the least controversial of the government's demands - and Mr Cameron got more than he was offered in the draft document, with the target to cut red tape. Such promises have been made before, however, without being matched by reality.
Further reading on the UK's EU referendum
Referendum timeline: What will happen when?