Christmas came early for Brussels lawyers and policy wonks who relish nothing better than a brain-teasing multidimensional constitutional puzzle to while away the dark days of winter.
After a "make-or-break" summit dinner with Prime Minister David Cameron, the political leaders of the European Union agreed there must be a compromise to keep Britain in the bloc and passed the tangled parcel of British demands to their technocratic minions to sort out the details within two months.
"The mood is much better. Now we can go away and work on the alternatives," one of those now charged in Brussels with taking on the negotiations told Reuters.
"Cameron got what he needed as a British government source put it, "more top down" orders to negotiators to cut through the legal detail: "Political leaders saying: 'This is an issue. We want to fix it. We value Britain's place in the EU.
"And so now go away and solve it'."
An official said gleefully that EU lawyers were already on top of the issue and could now find a way out by February:
"We got the political direction - 'Solve it'," he said, adding: "We have on our table 25,000 solutions to the problem."
The mood is much better. Now we can go away and work on the alternatives
Although Cameron insisted he was not dropping a touchstone demand for EU workers to wait four years to claim benefits in Britain, fellow leaders were confident of his readiness to consider other ways to reduce immigration from Europe that did not clash with treaties on equal treatment of all EU citizens.
"Cameron is willing to find solutions," said Belgian Prime Minister Charles Michel, a European federalist who diplomats said was among the prickliest of the British premier's peers during a dinner conducted in a largely clubby atmosphere.
There were some furrowed brows among EU officials who have spent months in technical discussions with London that have thrown up as many questions as answers -- principally about how to square EU treaty law with curbs on immigration from Europe that Cameron says he needs to sell an EU reform deal to British voters in a membership referendum to be held within two years.
Few have any illusions about the scale of the task facing them before the leaders' next rendezvous in Brussels on Feb. 17-18.
Jean-Claude Piris, former head of the European Council legal service which will take a lead in drafting compromise texts in the coming weeks, said Cameron's migrant welfare ban was clearly illegal. But he added: "I am sure they will sort it out."
He cautioned, however, that his successors must be careful not to fudge EU treaty law in their haste and end up with a compromise that would not stand up to scrutiny in the European courts. "I hope it won't be illegal," he said.
German Chancellor Angela Merkel and others made clear that they could accept some amendment to EU treaties, as Cameron says he needs. But over dinner several leaders stressed they had no chance of securing immediate ratification of such changes from increasingly Eurosceptic parliaments and electorates.
That, officials say, leaves what some call the "Edinburgh option" -- a binding protocol among the states of the EU to make changes the next time the treaties are revised. Denmark secured such a deal at a summit in the Scottish capital in 1992.
That in turn limits what can be modified. A protocol gives leaders the chance to give their interpretation of the treaty, but cannot entirely overturn fundamental treaty principles -- such as that governments cannot set one law for their own citizens and another for those of other EU member states.
Among possibilities EU officials were already speaking of after the dinner with Cameron is an "emergency brake" on immigration, whereby Britain might ask to halt immigration, or benefits, on the grounds a "massive influx" from the EU was fundamentally undermining its social security system.
Many question whether such a legal mechanism would be effective -- not least it would be unclear when the brake might be applied and by whom. But it has the advantage of experience -- Belgium, for example, curbed subsidies to foreign medical students, arguing that after being trained many returned to their home countries, leaving public hospitals understaffed.
Leaders and officials were also keen to stress that there are legal difficulties with all four sets of reforms that Cameron is seeking, though migrant benefits is the toughest. Several leaders spoke of their concerns that guarantees not to hurt Britain's sterling interests should not damage the euro.
The mood in the room was broadly collegial, diplomats said, as Cameron talked through the chicken terrine starter -- deploying all his PR man's eloquence and charm for half an hour -- and then Merkel and others politely prodded him with questions.
There was no detailed discussion of the four-year demand or other technicalities, but more a sense that, politician to politician, they understood the bind Cameron is in, however much many see it of his own making in a bid to defang Eurosceptics in his own party. And now they want to come together to avoid the calamitous exit of Europe's second-biggest economy from the EU.
"Most were open," one of the senior officials said. "They said: 'OK, David, if you have a problem, let's solve it'."
Irish Prime Minister Enda Kenny was particularly supportive, diplomats said. Ireland stands to lose heavily if its intimate neighbour quits the bloc and Kenny noted the support London had lent when Dublin was consumed by the euro zone debt crisis.
But Lars Lokke Rasmussen, the Danish prime minister whose country is a traditional free-trading ally of Britain in the EU, also had a friendly word of caution, an official said. Having just lost a referendum on a tweak to Denmark's relationship with the EU, Rasmussen said leaders must be aware of British voters.
Winning that vote -- and Cameron says he must have reforms to win -- will be at the forefront of minds when the lawyers and technical experts get down to crafting a deal before February.
"Today was the political moment," an EU official said. "It now goes back to the technical level and it will be political again in February."