Sudan's ruling military council and civilian opposition alliance have signed a landmark power-sharing deal.
The agreement ushers in a new governing council, including both civilians and generals, to pave the way towards elections and civilian rule.
Mohamed Hamdan "Hemeti" Dagolo, widely regarded as Sudan's most powerful man, has pledged to abide by its terms.
Sudan has seen pro-democracy protests and repression since long-time ruler Omar al-Bashir was ousted in April.
The deal was signed by Hemeti and Lt-Gen Abdel Fattah Abdelrahman Burhan for the military council, and Ahmed al-Rabie for the Alliance for Freedom and Change umbrella group of pro-democracy protesters.
The prime ministers of Ethiopia and Egypt and the South Sudanese president were among regional leaders attending ceremony.
There were scenes of wild celebrations on the streets of the capital, Khartoum, after the ceremony.
Thousands of cheering people gathered around the convention hall where the documents were signed, waving Sudanese flags and flashing peace signs.
Khartoum residents and people from other parts of the country came in on buses and trains for the occasion.
Under the deal, a sovereign council, consisting of six civilians and five generals, will run the country until elections.
The two sides have agreed to rotate the chairmanship of the council for just over three years. A prime minister nominated by civilians is due to be appointed next week.
Hemeti promises to abide by agreement
"We will stick to every single letter we have agreed on," Hemeti told the BBC in an interview broadcast ahead of the ceremony.
"Even without the agreement, we [would] have to work in this direction because it's in the country's interest," he added. "Therefore we have to carry out the agreement, stick to it and support it."
Hemeti is the commander of the Rapid Support Forces (RSF) - which grew out of the notorious Janjaweed militia that was accused of carrying out a genocide in the Darfur region of western Sudan.
Many people stood outside the RSF headquarters in central Khartoum, playing revolutionary songs and chanting at soldiers in celebration, Reuters news agency reports.
The RSF have been blamed for recent abuses, including the 3 June massacre during which more than 120 people were reportedly killed, with many of the dead dumped in the River Nile.
RSF leaders have denied planning the killings, which they say were carried out by rogue elements.
Asked about the massacre in the BBC interview, Hemeti said there had been "systematic plotting and conspiracy" to tarnish the reputation of the RSF, whom he described as "protectors" and not killers.
How did the crisis unfold?
The unrest in Sudan can be traced back to December 2018, when then President Bashir's government imposed emergency austerity measures.
Cuts to bread and fuel subsidies sparked demonstrations in the east over living standards, and the anger spread to the capital.
The protests broadened into demands for the removal of Mr Bashir - who had been in charge for 30 years.
In April, the president was overthrown by the military after sit-ins outside the defence ministry, but demonstrators then wanted to ensure authority was swiftly transferred to a civilian administration.
A council of generals led by Lt-Gen Abdel Fattah Abdelrahman Burhan assumed power, but it has struggled to return the country to normality.
The army is not a unified force in Sudan; paramilitary organisations and various Islamist militias hold some sway.