Sudan's ruling military council and opposition leaders have signed a power-sharing accord after all-night talks.
It is a "historic moment" for the country, the deputy head of Sudan's ruling military council, Mohamed Hamdan "Hemeti" Dagolo, is quoted as saying by AFP news agency.
Sudan has been in turmoil since the military ousted President Omar al-Bashir in April.
Protesters have been demanding the military hand power to civilians.
Those protests turned deadly in a crackdown on 3 June, when at least 128 people were reportedly killed - a figure disputed by the military authorities.
The two sides have agreed to rotate control of the sovereign council - the top tier of power - for just over three years.
That council will be made of five civilians, five military figures, and an 11th civilian, to be chosen by the 10 members.
A military general will be in charge of that council for the first 21 months, then a civilian will lead for the following 18 months, followed by elections.
The military has been pushing for immunity from prosecution after the protester deaths, but this is absent from the signed deal.
It does, however, promise an investigation into the violence.
A second agreement on constitutional issues is expected to be finalised on Friday.
By Tomi Oladipo, BBC Africa security correspondent
After months of on-and-off talks, the two sides have finally signed a deal. That is notable in itself.
The agreement means that after 30 years of military rule, Sudan is now three years away from a fully civilian administration - in theory.
The finer details of the deal and its constitutional elements have not been agreed upon. There is still a "sovereign council" to be appointed to lead the country through its transition.
However, some among the protesting masses might feel that they have got the short end of the stick.
The very military they challenged - and under whom they suffered pain and death on the streets - remains in power for now and will lead the interim government initially. The generals could possibly secure immunity from prosecution.
Justice in the eyes of the protesters will not have been served yet, but their chants for the fall of the regime have ushered in this new phase.
The unrest in Sudan can be traced back to December 2018, when then President Bashir's government imposed emergency austerity measures.
In April, the president was overthrown by the military after prolonged protests outside the defence ministry in Khartoum, but demonstrators then wanted to ensure authority was swiftly transferred to a civilian administration.
They stayed put outside the ministry and, on 3 June, the Rapid Support Forces (RSF), a paramilitary group under the command of the ruling military council, moved in to disperse them.
Dozens were killed and bodies were thrown into the River Nile. BBC Africa Eye has analysed more than 300 videos shot on that day and footage showed the RSF firing at protesters with live ammunition.
After the massacre, tens of thousands of protesters then returned to the streets a few weeks later, which forced the junta to resume talks on a power-sharing government.
The RSF leadership has denied responsibility for the killings, blaming rogue elements.
The RSF grew out of the Janjaweed militia, which was accused of carrying out a genocide in the Darfur region of western Sudan.