Sudan's main opposition coalition and the ruling military council have signed a final power-sharing deal that paves the way for a transitional government, and eventually elections, following the overthrow of long-time leader Omar al-Bashir.

Stability in Sudan, which has been grappling with an economic crisis, is seen as crucial for a volatile region struggling with conflict and insurgencies from the Horn of Africa to Egypt and Libya.

One of Sudan's top generals, Mohamed Hamdan Dagalo, who is deputy head of the military council, and opposition alliance representative Ahmad al-Rabie had initialed the agreement on 4 August and were the main signatories today.

Also present were African Union and Ethiopian mediators, who helped broker the accord, and representatives from Egypt, Saudi Arabia and the United Arab Emirates, all of which see themselves as influential in Khartoum.

Sudanese troops are operating in Yemen as part of a Saudi-led coalition fighting Houthi rebels.

Leaders of Ethiopia, South Sudan and Kenya were also present.

"The coming period will be a test for us, no one will be excluded," said leading opposition figure Sadiq al-Mahdi, Sudan's last democratically elected premier.

"We will open the door to everyone to participate in Sudan's celebration."

The Transitional Military Council (TMC) has ruled Sudan since April, when the military deposed Mr Bashir following months of protests against his rule during which dozens of demonstrators were killed.

The TMC and the main opposition alliance, known as the Forces of Freedom and Change (FFC), have been negotiating the power-sharing deal since then, but continued unrest, during which more protesters were killed, delayed an agreement and plunged Sudan further into turmoil.

Mr Dagalo, also known as Hemedti, commands the paramilitary Rapid Support Forces, some of whose members have been accused of involvement in killing demonstrators who have repeatedly turned out in huge numbers to press for political progress.

In a speech, Mohammed Nagy Alassam, a leader within the FFC, emphasised the need for an investigation and justice for those who were killed, particularly during the violent dispersal of a protest site in the capital Khartoum on 3 June.

"The martyrs are still with us, they are with the revolutionaries," spectators in the room chanted.

State television showed dozens of people lined up outside the convention centre where the signing ceremony was held, waving flags and flashing peace signs in celebration.

The make-up of a new sovereign council, which will run Sudan during a three-year transitional period leading up to elections, will be announced tomorrow.

Mr Bashir is wanted for war crimes in Sudan's Darfur region by the International Criminal Court, and is awaiting trial in Sudan on corruption charges.