EU summit: High stakes and missed meals
Marathon talks have concluded in Brussels between UK Prime Minister David Cameron and 27 other European Union leaders nailing down a renegotiated UK-EU relationship. Mr Cameron will now use the deal to campaign in the UK's forthcoming referendum on whether to stay in the union.
We look at how the talks unfolded.
Thursday afternoon - 'Battling for Britain'
Arriving at the summit, Mr Cameron tells reporters: "I'll be battling for Britain. If we can get a good deal, I'll take that deal - but I will not take a deal that doesn't meet what we need. I think it's much more important to get this right than to do anything in a rush."
He is reported to have packed three shirts for the conference and to have told his wife and the children that he might not be back for the weekend.
But European Commission President Jean-Claude Juncker is upbeat, describing himself as "quite confident" of a deal.
The mood in Brussels is that this is a "now or never" summit - "The mood around town is that people think that if we don't get it solved now, we're never going to solve it," a senior EU diplomat tells reporters.
EU Council President Donald Tusk, chair of the summit, meets Mr Cameron before the official start, warning "this is a make or break summit".
Lithuanian President Dalia Grybauskaite predicts there will be a squall but no fatal storm. "I think everybody will have their own drama and then we'll agree," she tells reporters.
Mr Tusk schedules wrap-up talks over an "English breakfast" for Friday morning and the meeting begins at 17:00 local time (16:00 GMT).
Thursday evening - Despondency
The breakfast triumph looks unlikely after officials confess little or no progress has been made in the first round of talks, which lasted two and a half hours.
"Sometimes, some issues and details that come up at sherpa [preparation] meetings, then disappear. This was not the case: everybody asked about everything," the BBC's Simon Wilson reports.
Downing Street officials say there remain five key areas of difference, including whether child benefit cuts can be applied retroactively and how long any restrictions on in work benefits can last.
Britain and France also push for any deal to include an assurance that this would be a final offer and could not be revisited. One official says there's no "sense that gaps in key issues have narrowed... there's a lot of hard work to do overnight".
Up all night
A series of bilateral talks begins just before 03:00. Mr Cameron and Mr Tusk continue the talks until 05:30 local time (04:30 GMT).
Proceedings take a surreal turn when one EU official tries to explain the linguistic vagaries of one particular sticking point - the issue of "ever closer union", an EU principle which Mr Cameron questions.
"Every lawyer in Europe agrees 'ever closer union' doesn't mean anything. It's just a nice phrase.
"Only two places share an opposite interpretation - Britain and Belgium. But politically they look at it in opposite ways."
Reuters reports that a senior EU negotiator explains the dilemma is like Renee Magritte's surreal painting Ceci n'est pas une pipe.
"We need to find a common understanding... which reflects on the one hand the legal dimension of it - Ceci n'est past une pipe, you cannot really smoke it... - but it's true, when you look at it, you see a pipe."
Mr Tusk says talks have made "some progress, but a lot remains to be done".
Friday morning - talks resume
The triumphant breakfast announcement is shelved, with talks resuming at 11:00 local time. For Mr Cameron, this means only three hours' sleep.
Several countries are taking issue with his demand that an emergency brake on in-work benefits for migrants should be in place for 13 years. The emergency brake is to be used when migration reaches "exceptional" levels.
"Eastern European countries, southern European countries, if they come home as prime ministers and tell their parliament that their citizens in Britain are for a long time citizens second class [sic], then they will have difficulties to explain that," says German MEP Elmar Brok.
Friday tea-time - hotels booked
Summit meals are scheduled and rescheduled as time ticks on with no final agreement.
"The situation is critical," one official says. "The session scheduled for 4pm [15:00 GMT] has just been cancelled and the meeting of leaders has been postponed to dinner at the earliest, and they have been asked to book hotels for tomorrow."
Greece throws a last-minute spanner in the works, saying it wants a curb on migrants over its border with Macedonia or it will not sign any deal.
Germany's Chancellor Angela Merkel is spotted nipping out for chips.
Friday dinner - deal clinched
The EU leaders sit down to a 19:00 meal and a draft deal, which finally gets pushed through.
"Agreement #UKinEU done. Drama over," the Lithuanian president tweets moments after the dinner begins. The curtain has come down on the drama she predicted at the start. Mr Cameron is free to return home, where the next stage begins.