The military rulers of Sudan have reached a power-sharing deal with opposition members to cover the next three years until elections are held.

The new sovereign council agreed upon on Friday morning will rule the country by rotation, according to an African Union official mediating in the crisis that has rocked the country for the past six months.

The uprising of the Sudanese people, demanding democracy, freedom, justice and an end to human rights violations, has lasted through the removal of the country’s long-term president, a military takeover and the brutal killing on 3 June by heavily armed paramilitary forces of at least 128 protesters who were staging a peaceful sit-in, as well as the rape of many more.

Under the agreement, the military will lead the council first, with the head of the junta, Abdel Fattah al-Burhan, as its chair, and then civilians will take over.

The council will be made up of five military and five civilian members, as well as a sixth so-called civilian agreed upon by both sides who will actually be a retired military officer, according to reports.

An independent investigation into the killings was also announced, and anyone found guilty will not be allowed to sit on the sovereign council. The African Union suspended Sudan’s membership after the attack.

Beginning in the eastern city of Atbara in December, the uprising is often said to have been triggered by a rise in bread prices, but has much deeper roots: it follows in a long tradition of revolution in Sudan, before the 30-year presidency of Omar al-Bashir. In 1964 and 1985, unpopular leaders were forced from power by popular revolts.

Bashir was forced out in April, and is in jail charged with corruption, but the transitional military council, which seized power after Bashir’s ousting, was unable to stop the demonstrations.

Despite the violence against them, protesters have returned to the streets again and again, including last weekend when seven were killed and hundreds wounded in the first major demonstrations since the 3 June massacre.

As well as a civilian government, protesters are calling for violent paramilitary forces to be withdrawn from cities, help for unarmed civilians who were attacked, an end to an internet blackout and the release of all political prisoners.

However, the agreement made no mention of resuming internet service or removing the Rapid Support Forces, who are responsible for most of the abuses, from the streets.

Despite leading the revolution, women were hardly represented in the negotiation room, the prominent Sudanese journalist Yousra Elbagir pointed out.

Human Rights Watch’s EU director, Lotte Leicht, said Sudan’s armed forces had “a history of broken promises, atrocities and impunity”, and the UN should carry out an inquiry into the abuses.