Northern Ireland's leaders have been rewarded with the promise of a new US investment programme after securing a historic deal today which saved power sharing.

Gordon Brown and his Irish counterpart, Brian Cowen, flew into Northern Ireland to put their seal of approval on the deal, which will create a Department of Justice, gives unionists concessions on the issue of Protestant parades and saves the power-sharing executive from collapse.

Brown said the achievements over the longest period of unbroken negotiations since the peace process began 16 years ago were inspirational.

"This is the last chapter of a long and troubled story and the beginning of a new chapter after decades of violence, years of talks, weeks of stalemate."

Tonight the White House said Barack Obama saw the deal as "an important step to greater peace and prosperity for all communities on the island."

Obama would also meet Cowen, the DUP leader and first minister Peter Robinson and the deputy first minister, Sinn Féin's Martin McGuinness, in Washington on St Patrick's Day next month.

Earlier, Hilary Clinton, the US secretary of state, said the agreement between the DUP and Sinn Féin was a "shining example to other parts of the world locked in religious and ethnic conflicts".

As a result of the deal, she said: "The people of Northern Ireland are poised to build a thriving society on this stronger foundation.

Our economic envoy, Declan Kelly, will continue to help Northern Ireland reap the dividends of peace, including economic growth, international investment and new opportunities.

In the near future, Declan and I will host first minister Robinson and deputy first minister McGuinness in Washington."

The Irish prime minister said the agreement reached "presents a real opportunity to renew the partnership which is the life blood of the devolved institutions. The people of Northern Ireland yearn for this constructive partnership to deliver tangible outcomes that improve their lives."

Referring back to the Belfast agreement of 1998, Gerry Adams, the Sinn Féin president, described today's agreement as "yet another good Friday." After reaching an agreement just before midnight on Thursday, the parties in the Northern Ireland assembly must now vote to put the compromise package in place. They will vote on 9 March to devolve policing and justice powers, which will then create a justice ministry on 12 April – a key Sinn Féin demand throughout these negotiations.

Under the agreement, a six-member working group, appointed by Robinson and McGuinness, will formulate a framework for handling contentious marches and the phasing out of the Parades Commission.

The new body will encourage local people to find solutions to parading problems, with the rights of marchers and residents taken into account. It will complete its work within three weeks, when the Northern Ireland executive will transfer responsibilities for parading legislation from Westminster and table a new bill based on the group's proposals.

An executive working group will be set up, in the hands of the SDLP and Ulster Unionists, to improve the way the power-sharing cabinet is run. Robinson and McGuinness will address issues still outstanding from the 2006 St Andrews agreement that led to the DUP-Sinn Féin deals. These include legislative measures to protect the rights of Irish language speakers.

Ian Paisley Jr, the North Antrim assembly member and son of the DUP's founder, described the agreement as a "win for unionism".

Paisley said his party had negotiated the end of the Parades Commission, which most unionists regard as biased in favour of nationalists. He added that unionist critics of the deal had "no alternative except the imposition of joint authority from London and Dublin".

Mindful of attacks on the DUP by the hardline Traditional Unionist Voice, Robinson said: "There are some who will play politics with this agreement, but the real focus in the months to come must be on building an administration at Stormont that our whole community identifies with and supports."

Jim Allister, the TUV leader and a former DUP MEP, said he was "relishing the prospect" of a general election contest with his former party. Allister will stand for the TUV in Ian Paisley Sr's North Antrim constituency.

"In football terms I see this result as a five to one win for Sinn Féin. They get their date for policing and justice. Secondly, their veto can be exercised over the justice ministry. They now have working party on Irish language. North/South bodies are strengthened. And finally there is a stronger north-south parliamentary forum. The DUP only get a view of parading issues.

"Sinn Féin are laughing all the way to the next staging post," he said.

Shaun Woodward, the Northern Ireland secretary, said the deal was bad news for republican dissidents determined to destabilise the power-sharing government.

He said a powerful message was being sent out to the dissidents that there are now "two groups of people who were once terrible rivals [who] have found a way through a very big challenge".

But the Real IRA, Continuity IRA and Óglaigh na hÉireann are unlikely to be moved by the accord at Hillsborough. In the past seven days the republican dissidents have carried out three gun and bomb attacks on police stations across Northern Ireland.

Republican sources have told the Guardian that the groups are likely to intensify their armed campaigns when policing and justice powers are transferred to Belfast.

The main points

Responsibility for policing and justice will be devolved from Westminster to the Northern Ireland assembly by 12 April.

• A working group will look at ways of reforming the Parades Commission, which regulates marches, so it obtains cross-community support.

• The justice minister will be thecandidate best able to commandcross-community support.

• Another working group, led by the junior coalition SDLP and UUP parties, will examine how to improve the functioning of the cross-party executive.

• The Treasury will provide extra funds for security, police pensions and hearing loss claims from the Troubles.