Sudan’s ousted Prime Minister Abdalla Hamdok is to be reinstated, after being placed under house arrest during a military coup last month.
All political detainees will be released as part of a new agreement between the military, civilian leaders and ex-rebel groups, mediators said.
On 25 October, Sudan’s military had declared a state of emergency and dissolved the civilian leadership.
It sparked weeks of mass protests in which at least 40 people have died.
The deal was reached late on Saturday night, and is to be signed into action on Sunday, the head of Sudan’s Umma Party, Fadlallah Burma Nasir, confirmed.
Mr Hamdok has agreed to the terms so that further bloodshed can be avoided, Reuters news agency reports, citing a source close to him.
His office said restrictions on his movement had been lifted and that the security forces outside his house had left, AFP reports.
The group of mediators, which included academics, journalists and politicians, released a statement outlining the terms of the agreement, which said the rules governing the transition towards democracy would be restored.