A judge in Senegal has charged opposition leader Ousmane Sonko with rape and released him on bail, after days of deadly protests sparked by his arrest last week.
“He is going home. He is free,” said Etienne Ndione, one of his lawyers.
Mr Sonko, 46, is accused of assaulting a woman who worked in a beauty salon.
He says the case is politically motivated to stop him running again in elections in 2024. He came third in the 2019 poll with 16% of the vote.
Demonstrators scuffled with security forces outside court in the capital, Dakar, before Monday’s hearing.
Police have deployed armoured cars in the city in the wake of several days of clashes in which at least eight people were killed, including a teenager in the southern town of Diaobé – the most serious violence Senegal has seen for several years.
Tear gas was also fired at protesters in central Dakar on Monday, after they pelted officers with stones.
Mr Sonko is popular among young Senegalese, and an opposition collective known as the Movement for the Defence of Democracy has called for three days of mass protests, starting on Monday.
Schools in the capital have also been ordered to close for a week following the unrest.
On Sunday a top Senegalese official whose job is to settle conflicts, Alioune Badara Cissé, said the authorities “need to pause and speak with our youth” and warned that “we are on the verge of an apocalypse”.
Mr Sonko’s arrest is seen as a “lightning rod for much broader discontent and frustrations,” Francois Rouget of security consultancy Control Risks told the BBC’s Newsday programme.
“These [protests] come at a difficult economic time – there are lots of frustrations coming from curfews that have been imposed to tackle coronavirus, so we are seeing a lot of convergences in grievances,” he said.
Much of Mr Sonko’s support comes from the large group of young Senegalese who feel disillusioned about their prospect of finding work.
A lot of the anger is also directed at President Macky Sall, who is being accused of using the judiciary for his political aims.
Two other opposition leaders were excluded from the 2019 election after convictions which they say were politically motivated. Mr Sonko is currently the country’s only major opposition leader.
Mr Sonko was accused of rape in February. He was arrested on Wednesday as he was on his way to court, accompanied by a group of supporters, on charges of disrupting public order when he refused to change his route.
Ousmane Sonko is a 46-year-old former tax inspector, he was fired in 2016 after making allegations of tax anomalies against the president’s brother, Aliou Sall.
Mr Sonko had at that point already become involved in politics, forming his Pastef party in 2014.
His parliamentary immunity was removed last week, after he was accused of rape.