KHARTOUM, Sudan — Joyful dancing and singing greeted Friday's news that Sudan's ruling military council had signed a power-sharing agreement with opposition and protest groups.

The street celebrations in the country's capital came after months of mass demonstrations and the ousting of dictator Omar al-Bashir, who restricted Sudanese civil rights and allowed inflation to skyrocket.

"Today is the start of Sudan's history," said pro-democracy activist Bushri Alsayem. "I wish that the next phase will fulfill the people's struggle."

The tensions rocking the huge, oil-rich northeast African nation had sent tremors of anxiety through the international community. The African Union sent in mediators and the State Department appointed a special envoy to Sudan amid fears that country of 42 million people would descend into chaos.

This image of a female protester gesturing and demanding former Sudanese President Omar Al-Bashir to step down rallied protesters in Sudan and went viral around the world. Lana H. Haroun / Reuters

Meanwhile, protesters have resisted interim military rule saying it is an extension of Bashir's leadership. The longtime autocrat has been indicted by the International Criminal Court over allegations of genocide in the Darfur region.

The two sides, which have held talks in Khartoum for the past two days, agreed to "establish a sovereign council 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 on Friday.

The deal breaks weeks of political impasse and escalating violence between civilian protesters and the military since Bashir was deposed by a coup in April. Massive protests last weekend saw tens of thousands of demonstrators flood the streets of big cities and resulted in at least 11 deaths just ahead of the successful talks.

The two sides agreed to form an independent government and to launch an investigation into the recent violence.

They also 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 security forces crushed a sit-in protest on June 3, killing dozens, and talks collapsed.

The U.N. High Commissioner for Human Rights Michelle Bachelet on Wednesday called on Sudanese authorities properly investigate all acts of violence and allegations of excessive use of force and also lift ongoing restrictions to the internet.

The streets of Omdurman, capital 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 their car horns, and women carrying Sudanese flags ululated 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.

"We would like to reassure all political forces, armed movements and all those who participated in the change from young men and women … that this agreement will be comprehensive and will not exclude anyone," said Gen. Mohamed Hamdan Dagalo, deputy head of the Transitional Military Council.

"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. Since the uprising began in December, protest organizers say a total of more than 250 people have been killed.