Mali conflict: Rewriting the UN's best made plans
It took France the better part of a year to craft a UN-backed plan for dealing with the Islamist takeover of northern Mali that would avoid a French military intervention.
It took only a few hours to turn that project on its head.
The lightening deployment of French troops to stop an unexpected Islamist offensive left UN diplomats scrambling for answers and analysts scratching their heads.
"I think this is an amazing example of how a diplomatic process at the UN can take on a life of its own without any real reference to what's happening on the ground," says Richard Gowan of the New York University's Center on International Co-operation, who followed the talks closely.
The UN resolution outlines a months-long process of national reconciliation between the authorities in the capital Bamako and Malian Tuareg rebels in the north who cut ties with al-Qaeda and other terrorist groups.
In parallel, European military trainers were tasked with rebuilding the Malian army - which collapsed in the wake of the northern rebellion last year - preparing it to join an African intervention force to take back the north from the Islamist extremists who now control it, sometime around September.
Despite some scepticism from the Americans, the resolution passed unanimously in December.
But now, admits one Security Council diplomat, "some of the assumptions will have to be rethought".
Key among those is the role of the Malian army, which to the alarm of diplomats here evaporated last week in the face of the advancing Islamist rebels.
The resolution clearly underestimated the weakness of the army, envisioning instead that it would lead the joint offensive to the north.
Some Malian soldiers have since rallied to fight with the French, but the question is whether these can form the core of a reformed army, or whether "we move over and have the Africans in the lead rather than the reverse," said the diplomat.
Another flaw was that the initial assessment of the armed groups underestimated their capability as what a senior French diplomat called a "well armed, equipped, trained and determined" force, which apparently tried to hold ground in terrain usually defined by skirmishes and ambushes.
Even the political process was miscalculated.
The idea was to split the Tuareg rebels from foreign terrorist groups by addressing the political and economic grievances that had fuelled their rebellion, with the suggestion that the Islamists amongst the Tuareg, the Ansar Dine, would be willing to negotiate.
"The big question was about Ansar Dine," said another Security Council diplomat.
"The Algerians were saying it was possible to negotiate with them… so it was a shock to Algiers that Ansar Dine was part of the offensive."
However, the unexpected changes on the ground have forced an accelerated deployment of African troops mandated by the UN resolution, pledged now in greater numbers than initially foreseen.
But given the upending of the UN framework it is not clear whether the deployment is legally based on the resolution or on a request for help from Mali, which is what undergirds the French military response.
France is eager to hand the lead to the Africans as soon as possible, although the country's UN Ambassador Gerard Araud has acknowledged there are "questions" about how the shift from a French emergency operation to a UN mandate will take place.
"The resolution remains the context, the umbrella," he said, "and the logic remains: bringing African forces, rebuilding the Malian army. But things have changed so at some moment we might have to see how to adjust its implementation".
One factor that will influence this calculation is the size of the African force, and what sort of Western support it can get to overcome current deficiencies in funding, supplies and training.
"By bringing in the Africans it is possible that the French could at least partially pull out, and having won the initial battle, give the lead to the African contingent," says Mr Gowan.
"But it seems at a minimum if you wanted to do that you'd need a significantly larger force than envisioned, given the failure of the Malian army."
Another factor is what progress there will be in terms of a political process, likely to be pushed by the Americans and the Algerians to counter the logic of a military approach about which they have all along been sceptical.
At the moment, there is remarkable support for the French intervention, both in Mali and in the Security Council, but that could change with the nature of the operation, warns Mr Gowan.
The worst case scenario is that the French, supported by West Africans, get sucked into a battle of attrition with Islamists who switch to the tactics of a long-term insurgency, with huge implications for the region.
"Mali will not benefit from this intervention, and neither will Algeria," the Algerian analyst Ahmed Bin Gedo told the Financial Times recently.
"Some of the risks are that we enter a stalemate. It might end up being a decades-long war, resources will be lost, lives will be lost and it could also potentially spill over the border."
For the UN, the danger is that it might by default become the umbrella not for a nationally led offensive to reunite Mali's territory, but an operation ultimately seen as French aggression against a former colony.