The Senegal government on Friday vowed to use "all means necessary" to return order after police fired tear gas in clashes with supporters of opposition leader Ousmane Sonko as the interior minister said four people had died.

The clashes followed a court ruling that Sonko be held in custody. And following two days of protests, UN Secretary-General Antonio Guterres urged all sides to avoid any further escalation of the violence.

Government buildings in Dakar were under tight security before Sonko's court hearing
Government buildings in Dakar were under tight security before Sonko's court hearing AFP / JOHN WESSELS

"The protests must remain peaceful, and the security and police forces must at all times operate... in line with international human rights standards," his spokesman Stephane Dujarric told reporters in New York.

"The government regrets the loss of four lives" in events "that are rooted in banditry and insurrection", Interior Minister Antoine Felix Abdoulaye Diome said on television on Friday, accusing Sonko of "issuing calls to violence".

In Dakar's working class district of Medina earlier, hundreds of young people fought running street battles with riot police and smoke rose from burning tyres at makeshift barricades in the capital city.

Senegalese opposition presidential candidate Ousmane Sonko is a firebrand speaker popular with the young
Senegalese opposition presidential candidate Ousmane Sonko is a firebrand speaker popular with the young AFP / SEYLLOU

Protesters chanted "Free Sonko" on the main Blaise Diagne avenue, the ground strewn with stones, grenade cartridges and burning debris.

"The protests must remain peaceful, and the security and police forces must at all times operate... in line with international human rights standards," his spokesman Stephane Dujarric told reporters in New York.

Supporters of Senegal's opposition leader Ousmane Sonko clashed with police on Wednesday
Supporters of Senegal's opposition leader Ousmane Sonko clashed with police on Wednesday AFP / JOHN WESSELS

In Mbao, in the city's outer suburbs, looters also ransacked a French chain Auchan supermarket, an AFP correspondent at the scene said. The chain says least 14 stores have been attacked during this week's unrest.

Police officers blocked protesters in Dakar
Police officers blocked protesters in Dakar AFP / JOHN WESSELS

The arrest of Sonko, popular with young people and seen as a key challenger to President Macky Sall, has sparked the worst unrest in years in a West African state often heralded as a beacon of stability.

His supporters had called for further protests to coincide with his hearing before a judge on Friday on charges of disturbing order.

Clashes have gripped Senegal's capital for days
Clashes have gripped Senegal's capital for days AFPTV / Adrien BARBIER

"Sonko has been returned to custody over the matter of disturbing public order," attorney Etienne Ndione told reporters after the hearing.

Tensions were high in the city with hefty police deployments in place around the law courts, presidential palace and National Assembly in the heart of the city.

Clashes broke out on Wednesday between Sonko's supporters and police as he made his way to court for another case where he faced rape accusations -- allegations that he denies.

Senegalese opposition presidential candidate Ousmane Sonko is a firebrand speaker popular with the young
Senegalese opposition presidential candidate Ousmane Sonko is a firebrand speaker popular with the young AFP / SEYLLOU

Sonko was then arrested on charges of disturbing public order, a development that sparked angry protests in the capital and other cities.

The custody order issued on Friday, which relates specifically to the public order case, expires on Sunday.

He was not charged on Friday in the rape case and returns to court on Monday for questioning over those accusations, his lawyers said.

One person died in the southern town of Bignona on Thursday, police said, during clashes there. It was not clear if that death was included in the four revealed by Abdoulaye Diome.

Protesters attacked the offices of the government daily Le Soleil and RFM radio station, which belongs to a press group owned by singer and former minister Youssou Ndour. Both media outlets are deemed pro-government.

Sonko, a 46-year-old devout Muslim who is leader of the opposition Pastef party, is popular with many young Senegalese because of his sharp-tongued attacks on the elite, especially President Sall.

He came in third to Sall in the 2019 elections.

But his political future was suddenly clouded last month when rape charges were filed against him by an employee at a salon where, he said, he went to receive back massages.

He denies the accusations and accuses Sall of conspiring to sideline him from politics.

The government warned "certain media" on Thursday against pursuing what it called "tendentious" coverage of events.

The regulatory authorities suspended two local television channels, Sen TV and Walf TV, for 72 hours, accusing them of relentlessly broadcasting images of the unrest.

In a statement, Amnesty International called on the Senegalese authorities "to immediately halt arbitrary arrests of opponents and activists, respect freedom of peaceful assembly and freedom of expression."

Netblocks, an organisation that monitors disruption to the Internet, said social media and messaging applications, including Facebook, YouTube and WhatsApp, had been affected by restrictions.