Long-awaited document paves the way for civilian rule after Omar al-Bashir’s removal in the face of mass protests.

Hundreds of people have taken to the streets of Sudan’s capital, Khartoum, chanting revolutionary songs and waving national flags after the country’s military rulers and opposition coalition signed a hard-won constitutional declaration.

The document, initialled on Sunday, paves the way for a transition to civilian rule following the toppling of longtime President Omar al-Bashir in April.

It sets the shape of an interim government that will govern Sudan for a transitional period of three years until elections are held.

Envoys from the African Union and Ethiopia brokered the talks that resulted in the constitutional declaration. Negotiations between the ruling Transitional Military Council (TMC) and the Forces for Freedom and Change (FFC) coalition stalled repeatedly amid deadly violence against protesters who kept up demonstrations demanding civilian rule.

A formal signing of the document will take place in front of foreign dignitaries on August 17.

The following day, the generals and protest leaders are expected to announce the composition of the sovereign council which will replace the TMC.

Here is what the new agreement entails:

The transitional period will last for 36 months from the day of the signing of the constitutional declaration.

There will be a sovereign council, which will oversee the creation of a council of ministers and a legislative council.

The sovereign council will be an 11-member governing body, which will rule the country for just over three years. The body will be composed of five military personnel chosen by the TMC and five civilians selected by the FFC. The 11th member will be a civilian chosen by consensus between the two parties.

The sovereign council will be headed by a military general during the first 21 months, followed by a civilian for the remaining 18 months.

The FFC will appoint the prime minister.

The prime minister will name a cabinet of 20 ministers from a list of nominees presented by the FFC, excluding the interior and defence ministers. The latter pair will be appointed by the military members on the sovereign council.

Legal action cannot be taken against members of the three councils without permission from the legislative council. The decision to lift immunity would require the approval of a majority of legislators.

The legislative council will be independent. Its members cannot exceed 300 people, and at least 40 percent of the seats will be reserved for women.

The FFC will appoint 67 percent of the legislative council’s members, while other political groups that are not associated with al-Bashir will select the rest.

Sudan’s armed forces and its paramilitary Rapid Support Forces will be led by the commander of the armed forces, who is also the head of the sovereign council.

The council of ministers may ask the sovereign council to announce a state of national emergency if the unity and safety of the country are at risk. Such a request must be presented to the legislative council within 15 days, and will become invalid if the assembly fails to approve it.

New policies will be developed over the next six months in consultation with armed groups in various regions of the country to achieve comprehensive and lasting peace.

The constitutional declaration also contains a chapter on rights and freedoms for Sudanese citizens. It says: