Sudan's army rulers and protest leaders have signed a hard-won constitutional declaration, paving the way for a promised transition to civilian rule.

The agreement builds on a landmark 17 July power-sharing deal and provides for a joint civilian-military ruling body to oversee the formation of a transitional civilian government and parliament to govern for a three-year transition period.

Protest leader Ahmed Rabie and the deputy head of the ruling military council, General Mohamed Hamdan Daglo, signed the declaration at a ceremony attended by African Union and Ethiopian mediators.

The signing was met by a wave of applause in the Khartoum hall as representatives from both sides shook hands.

Crowds celebrating a "full agreement" on the declaration the night before the signing

A formal signing in front of foreign dignitaries is due to take place on 17 August, the date on which ousted president Omar al-Bashir is due to go on trial on corruption charges, protest leader Monzer Abu al-Maali said.

The following day the generals and protest leaders are expected to announce the composition of the new transitional civilian-majority ruling council, he said.

"Members of the ruling sovereign council will be announced on 18 August, the prime minister will be named on 20 August and cabinet members on 28 August," Mr Abu al-Maali said.

The deal on a constitutional declaration is the fruit of difficult negotiations between the leaders of mass protests that erupted last December against Mr Bashir's three-decade rule and the generals who eventually ousted him in April.

The talks between the protest movement and ruling generals had been repeatedly interrupted by deadly violence against demonstrators who have kept up rallies to press for civilian rule.