Sudan’s military reinstated Prime Minister Abdalla Hamdok on Sunday and promised to release all political detainees after weeks of deadly unrest triggered by a coup, although large crowds took to the streets to reject any deal involving the army.

Under an agreement signed with military leader General Abdel Fattah al-Burhan, Hamdok, first appointed after the overthrow of autocrat Omar al-Bashir in a 2019 uprising, will lead a civilian government of technocrats for a transitional period.

But the civilian coalition that nominated Mr Hamdok as PM two years ago refused to acknowledge any new deal.

“Hamdok has sold the revolution,” protesters chanted after the deal was announced. The Sudanese Professionals Association (SPA), a leading protest group, called it “treacherous”.

The United States, Britain, Norway, the European Union, Canada and Switzerland welcomed the reinstatement of Hamdok and in a joint statement urged the release of other political detainees. The United Nations also welcomed Sunday’s deal.

Hamdok said he agreed to the deal to prevent more casualties.

“Sudanese blood is precious. Let us stop the bloodshed and direct the youth’s energy into building and development,” he said at a signing ceremony broadcast on state television.