What is in the deal on reform of Britain's EU membership struck in Brussels?
Migrant welfare payments:
In this highly controversial area, the deal offers an "emergency brake" which may be applied by member states where "exceptional" levels of migration are placing strain on social security systems, labour markets or public services.
The Prime Minister's initial proposal for a four-year ban on in-work benefits for EU migrants hit a wall of resistance from eastern European countries so the final deal allows benefits to be gradually phased in over a period of four years, as the worker contributes more to his new home through taxation.
Crucially, the brake will last for a period of seven years, with no option for renewal. This is less than the 13 years sought by Mr Cameron in negotiations .
States wishing to apply the brake will put a request forward to the European Commission, but the final approval will come from national leaders in the European Council. It is not yet decided whether their decision must be unanimous.
In a separate declaration, the Commission confirms that conditions in the UK are already sufficient to trigger an application to use the brake "in the full expectation of obtaining approval".
Mr Cameron initially vowed to stop the payments of child benefit to migrant workers for children living overseas in their home countries.
But the deal instead allows host nations to "index" the benefit to the same rate as in the child's home country, which is lower than the UK in most cases.
The cut applies initially only to new immigrants, but will be applicable to all existing claimants - including 34,000 in the UK - from January 1 2020.
The document states explicitly that the same approach will not be applied in future to old-age pensions.
A lengthy passage from earlier drafts, which stated that the phrase "ever closer union" in EU treaties did not amount to a legal commitment to "political integration" was struck out of the final text, in an apparent response to Belgian sensitivities.
But the new text makes clear that EU treaties will be amended to state explicitly that references to ever closer union "do not apply to the United Kingdom".
National parliaments will be able to wield a "red card" requiring the European Council to reconsider EU legislation if they can muster support equivalent to 55% of the 28-nation bloc.
The deal restates Britain's entitlement not to join the euro and outlaws discrimination against companies and individuals on the basis of the currency of their home country.
It states that countries outside the single currency will not be required to fund euro bailouts and will be reimbursed for central EU funds used to prop up the euro.
And it provides a right for any member state to escalate concerns about the impact of eurozone decisions for urgent discussion in the European Council.
The settlement calls on all EU institutions and member states to "make all efforts to fully implement and strengthen the internal market" and to take "concrete steps towards better regulation", including by cutting red tape.
The agreement confirms measures to deny free movement rights to nationals of a country outside the EU who marry an EU national, as well as action to tackle the use of sham marriages to gain residence rights.
Nations' rights to exclude people believed to pose a security risk are confirmed, even where the individuals affected have no previous convictions.
All of the reforms included in the agreement take effect on the day when the UK votes to stay in the EU and informs the secretary-general of the European Council of the result of the referendum.
A new clause states that the terms of the deal will cease to apply if Britain votes to leave. Inserted at Belgian insistence, this "no second chance" measure is designed to head off the threat of a second referendum by making clear to British voters that they will not be able to use additional leverage from a vote for Brexit to secure an improved deal from Europe.