Sudan’s military and civilian leaders announced on Friday that they had reached an agreement to share power until elections, promising an end to the standoff that has paralyzed the African country since the ouster of President Omar Hassan al-Bashir in April.

The two sides, which resumed talks this week after a monthlong hiatus that included a bloody crackdown by the military, have agreed to form a joint military-civilian authority to run Sudan during an interim period of just over three years, a senior protest leader said.

Power will rotate between military and civilian leaders during the transitional period, a mediator from the African Union, Mohamed Hassan Lebatt, told a news conference in Khartoum. Then, elections are to be held and the military is to return to its barracks, ushering in democratic rule.