Long days and partial agreement for Sudans
It was supposed to be just a one day summit. A quick in and out to Addis Ababa for both Sudanese President Omar al Bashir and his South Sudanese counterpart Salva Kiir. Instead, it became a five day presidential marathon of night and day negotiation.
At first the expectation was that the two sides would sign just a limited deal that met no more than their immediate interests. South Sudan wanted to turn its oil back on, Sudan wanted security on its border. But then like a balloon being pumped full of too much air, the ambitions for what they could achieve expanded.
They would sort out everything, including all the hotly disputed territories along the border. Then midweek the balloon threatened to pop, with both sides briefing pessimistically, suggesting nothing would be signed, nothing would be achieved.
Eventually what was signed was no more really than had been expected on Sunday.
But the act of having stayed engaged at the presidential level for so many unexpected days - with each president ducking out of attending the United Nations general assembly in New York to be there – was an achievement in itself.
It was only in April that Sudan and South Sudan stood on the brink of war.
That was after South Sudan rolled its tanks into Sudan's main oil installation in Heiglig, claiming it as its own. Both governments, facing a dire economic situation at home, seized upon the diversionary rhetoric of the enemy next door.
The United Nations Security Council, alarmed at the instability that the independence of South Sudan seemed to have suddenly become, issued a resolution demanding the two sides resolve all their differences.
The extended deadline to do that was 22 September, hence the effort this week for a comprehensive deal.
In a divorce with no settlement, South Sudan split from Sudan in July 2011.
There was no agreement on what their future relationship would look like.
This week's deal gives that relationship shape.
Firstly the security deal – which was Sudan's priority - will see a demilitarised zone along the border.
If implemented, it should make a reality of the non-aggression pact they signed earlier this year.
Having these two countries no longer in a hostile relationship is also a significant step for regional stability in an area of Africa fraught with tension along many borders.
But as importantly, the economic deal actually lays the basis for two "mutually viable" states which is what the African Union mediators always said they were seeking.
It creates a vital border for trade. Sudan's access to the Red Sea is South Sudan's cheapest way of bringing in imports, for what is a virtually import dependent economy.
It is hoped that the resumption of trade across the borderwill also ease tensions and help normalise relations, just as the recent resumption of commercial flights between the two capitals should.
The most important aspect of the economic deal, though, is an agreement to turn the oil back on.
When it became independent in the summer of 2011, South Sudan took with it 75 per cent of oil production from Sudan. However, it still needed Sudan's processing facilities and pipelines and its access to the sea.
But the two sides never agreed on what the fee should be to use these facilities. In January 2012, in a fit of anger, South Sudan shut down its entire oil production when it discovered that Sudan was taking some oil in lieu of unpaid fees.
South Sudan has no other real income, it relies on oil for 98 per cent of its revenue.
While both sides want the dollars that come with oil, South Sudan is particularly desperate for the cash.
At the time South Sudan's headstrong action of turning off its only supply of income left diplomats jaw-dropped.
One said to me: "It's not a case of shooting yourself in the foot, but shooting yourself in the head."
But actually without it, there would have been no deal on Thursday.
It was the driver needed to get South Sudan to engage with enthusiasm in the talks.
After getting independence the fear amongst mediators was that South Sudan had got what it wanted and now had no reason to fully engage.
Needing its oil back on changed that.
One danger of having resolved the oil issue without a comprehensive deal is that future rounds dealing with the matters yet to be negotiated will lack that kind of incentive.
One of the outstanding issues is the conflict between the SPLM North rebels in the border states of South Kordofan and Blue Nile and the Sudanese government.
The SPLM North fought with the South as part of the SPLM during the civil war but their grievances were never resolved despite provision for this in the 2005 Comprehensive Peace Agreement.
Khartoum accuses Juba of continuing to support and supply them. Juba denies this.
It is hoped the buffer zone which will involve joint monitoring of cross border movements will resolve this suspicion.
The UNSC has demanded the two sides make a deal but this hasn't happened.
Without a such a deal a peaceful border will prove difficult.
Hotly-contested Abyei area
Any future talks will undoubtably have to resolve the final issue between Juba and Khartoum: disputed territories, including the hotly-contested Abyei area.
It is no surprise that this week's negotiation failed to digest the demands of resolving these. For more than any other item on the agenda, these involve as much negotiation outside the room as in it.
It was never just a question of how clocking up the hours of talking in the wooden-panelled conference rooms of the luxury Sheraton hotel in Addis to resolve this.
This negotiation also needs to take place hundreds of miles away on the dusty planes and grasslands of the territories in question with the people who live there. Tribal politics are a fundamental part of this negotiation.
Resolving disputed territory also demands negotiation with the military who see it as a duty to protect every inch of sovereign soil – and for the Sudanese army, at least, this is a sensitive subject - they have just suffered the humiliation of losing a lot of that with the creation of South Sudan.
Finding a solution to the territorial dispute also demands negotiation with hardliners who will pounce on anything perceived as government weakness in a deal.
What this deal demonstrates clearly is that any peace agreement is not about peace, so much as interests.
The two sides were under international pressure to achieve a complete deal but it was only in their interests right now to get part of the way.
Yet even this partial deal they have just signed will have stressed certain relationships with some key constituencies for both governments.
Selling the compromises of any agreement to your power base is always challenging.
This is why whenever a peace deal is signed governments are congratulated for their courage.
Peace-making involves leadership – and risk taking. But these are always measured.
A government might put its neck on the line in signing an agreement.
But no government commits Harakiri to implement it.