Gordon Brown, Peter Robinson, Martin McGuinness and Brian Cowen announce the Hillsborough Castle Agreement
By Mark Devenport
BBC NI political editor
It began with real fears that Sinn Fein's Deputy First Minister Martin McGuinness might resign and a breakneck rush by Gordon Brown and Brian Cowen to Hillsborough to stave off the imminent collapse of the Stormont Assembly.
It continued through 10 days and almost as many nights of negotiations, interspersed with waves of optimism and pessimism about the outcome.
This week began with apparent rebellion within the DUP ranks when 14 of the party's assembly members voted against the latest proposals from Hillsborough brought back by their leader Peter Robinson.
Then came a late-night meeting at Stormont during which the doubters withdrew their opposition and set the scene for Friday's breakfast return visit from the two prime ministers.
At the news conference launching the Hillsborough Agreement, the leaders engaged in rhetoric about a new spirit of cooperation and local politics coming of age.
But does this deal, as the prime minister claimed, secure Northern Ireland's future?
In the short term it has prevented the immediate collapse of the Assembly, which would have probably led to a snap election.
The Irish and British prime ministers looked happy on arrival at Hillsborough
Should this have resulted in a three-way split within unionism, between the DUP, Ulster Unionists and the Traditional Unionists, it could have proven very difficult for the British and Irish governments to resuscitate power sharing.
Such an outcome would probably have triggered attempts to comprehensively renegotiate the nature of the coalition government constructed under the Good Friday Agreement.
The Hillsborough deal does not envisage such a radical reform, although it does pledge a re-examination of the poor internal workings of the power sharing executive.
However, it does promise a new start to the disruptive issue of contentious parades.
Although recent marching seasons have been far less violent than the days of the tense stand-offs at Drumcree during the 1990s, these marches still cause violence in a handful of trouble spots. The deal talks about creating new structures with a greater emphasis on local mediation, dialogue and transparency.
But it will require an increase in the levels of trust, both on the streets and in the Assembly, if the twin problems of parading and politics are to be overcome.
The deal is laced with interlinked dates and deadlines for both policing and parades which are designed to provide mutual reassurance for both sides.
However, they could turn into obstacles if they are not met as envisaged.
No sooner had he left Hillsborough to attend a Haiti fund raising event in Lisburn, than Peter Robinson was talking about having "a clever device" to ensure full compliance.
He wouldn't elaborate on quite what he meant, but it's clear that the DUP insisted on a tight three-week timescale for the review group which is due to draw up the blueprint for new parading structures because it wanted the plans completed before its MLAs trooped through the Stormont Assembly lobby to vote for a new justice minister.
There's also speculation that the first minister could threaten his resignation if he believes republicans have not stuck to their side of the bargain by December - the date by which the new parades structures should come into force.
Such a swift resort to pressure politics belies some of the high flown rhetoric on display at the launch of the Hillsborough Agreement.
Throughout the talks, members of the public urged the parties to reach a deal
If this saga started with Martin McGuinness threatening the so called "nuclear option" then Stormont remains a mini-model of the old cold war doctrine of "mutually assured destruction".
No wonder one DUP source resorted to an old Ronald Reagan quote "Trust But Verify" to describe the spirit of this deal.
Potential pitfalls include the reluctance of the Ulster Unionists to back the agreement and the annoyance of Alliance, who are expected to provide the new justice minister, about the failure to address their concerns about the so-called Shared Future Strategy.
The anti-power sharing Traditional Unionist Voice will subject the precise relationship of the new minister to the executive to close scrutiny, in order to back their contention that Sinn Fein has indeed got its hands on powers over law and order.
Moreover, the whole scheme for appointing a justice minister with cross community backing from both unionists and nationalists is a temporary measure which is due to expire in 2012 when the parties will examine their options again.
In historic terms, this deal isn't as significant as the Good Friday Agreement 12 years ago or the DUP's decision to share power with Sinn Fein three years ago.
But it has kept power sharing alive, which is in itself no mean achievement.