Sudan says that “forces of darkness” linked to the ousted President Omar al-Bashir were behind Tuesday’s failed coup attempt.

“Remnants from the previous regime” were “intent on aborting the civilian democratic transition”, said Prime Minister Abdalla Hamdok in a separate message.

He described it as an “orchestrated coup attempt”.

Bashir, who had been in power for three decades, was toppled two years ago.

The current administration – involving the military, civilian representatives and protest groups – was then established as part of a power-sharing agreement.

Reuters news agency quotes the Sudanese military as saying 21 officers and a number of soldiers had been detained in connection with the failed putsch, and are continuing to search for the rest of the culprits.

Earlier reports on Tuesday from the capital, Khartoum, and nearby Omdurman described intense military activity, and the main bridge across the River Nile was shut.

In the small hours, shooting was heard near a military base housing a tank division in Omdurman, journalist Mohammed Alamin told the BBC’s Focus on Africa programme.

Then shortly after a news flash on state TV said that a coup attempt had been thwarted.

The coup plotters had tried but failed to take over a building housing the state media.

Prime Minister Hamdok said his government would “take immediate measures to fortify the transition and continue to dismantle the system of the former regime, which still poses a threat to the transition”.

Several coup attempts have taken place in Sudan in the years since President Bashir was toppled, the BBC’s media monitoring service reports.

Mr Hamdok said several days of unrest in Port Sudan in the east of the country were also part of a plot to destabilise the country.

There has been tension within the Sovereign Council which is supposed to be overseeing a return to civilian rule.

“We’re not going back… there are people trying to turn back the hands of time,” said Information Minister Hamza Baloul in a statement read earlier on state TV.

He added that “forces of darkness were targeting the revolution” started by mass popular protests against then-President Bashir, but said government bodies would be the “first line of defence” protecting Sudan’s transition.

Correspondents say some elements within the military are likely to be strongly opposed to a transition that will see them lose considerable power.

The Sudanese government says the situation in the country is now “under control”.

Video footage shared on Tuesday morning appeared to show armoured vehicles on city streets, but reports from Khartoum now say traffic is now flowing smoothly in central Khartoum and its bridges are open.

Sudan’s state news agency has published photos of the leader of Sudan’s Transitional Military Council (TMC), Lt-Gen Abdel Fattah Abdelrahman Burhan, visiting the armoured division headquarters after the aborted coup:

Mohanad Hashim, a journalist for government-run Sudan TV in Khartoum, reports that the Bashir loyalists blamed for the coup say they are disgruntled with Sudan’s tough economic situation.

The BBC’s Africa correspondent Catherine Byaruhanga says Sudan’s transitional government is under pressure to deliver economic and political reforms amid competing demands from conservative and liberal constituencies.