Sudan's ruling transitional military council and a coalition of opposition and protest groups reached an agreement to share power during a transition period leading to elections, setting off street celebrations by thousands of people.

The two sides, which have held talks in the capital, Khartoum, for the past two days, agreed to "establish a council of sovereignty by rotation between the military and civilians for a period of three years or slightly more," African Union mediator Mohamed Hassan Lebatt said at a news conference.

They also agreed to form an independent technocratic government and to launch a transparent, independent investigation into violent events that took place in recent weeks.

The two sides agreed to postpone the establishment of a legislative council. They had previously agreed that the Forces for Freedom and Change coalition would take two-thirds of a legislative council's seats before talks collapsed and security forces crushed a sit-in protest on June 3, killing dozens.

The streets of Omdurman, Khartoum's twin city across the Nile River, erupted in celebration when the news broke, a Reuters witness said. Thousands of people of all ages took to the streets, chanting "Civilian! Civilian! Civilian!"

Young men banged drums, people honked car horns, and women carrying Sudanese flags cheered in jubilation.

"This agreement opens the way for the formation of the institutions of the transitional authority, and we hope that this is the beginning of a new era," said Omar al-Degair, a leader of the coalition.

The head of Sudan's transitional military council, Gen. Mohamed Hamdan Dagalo, described the agreement as "comprehensive," adding that it "does not exclude anyone."

"We thank the African and Ethiopian mediators for their efforts and patience. We also thank our brothers in the Forces for Freedom and Change for the good spirit," said Dagalo, who heads the Rapid Support Forces accused by the coalition of crushing the sit-in.

Opposition medics say more than 100 people were killed in the dispersal and subsequent violence. The government put the death toll at 62.