Sudan’s army and the country’s pro-democracy movement have signed a final power-sharing deal at a ceremony in the capital, Khartoum.

Saturday’s agreement paves the way for a transition to civilian rule following the military overthrow of President Omar al-Bashir in April after months of protests.

The deal establishes a joint military and civilian council to rule for a little over three years until elections can be held. The agreement would also establish a cabinet appointed by the activists and a legislative body.

The protest leaders have been locked in tense negotiations with the army for weeks while holding mass protests.