Senegalese opposition leader Ousmane Sonko, whose arrest has sparked violent protests, was charged with rape on Monday but was released on bail under judicial supervision, his lawyers said.
Sonko appeared in court in the capital Dakar on Monday, where he faced questions about a rape charge, which he denies and claims is politically motivated.
Five people have been killed in days of clashes that have threatened to erode Senegal's reputation as a beacon of stability in West Africa.
"He is going home. He is free," said one of his lawyers, Me Etienne Ddione.
Sonko's supporters have called for three more days of protests starting on Monday and schools in Dakar have been ordered to close for a week.
Sonko, 46, was arrested on Wednesday on charges of disturbing public order.
Sonko finished third in the 2019 election, which saw President Macky Sall win a second term in office, and is considered a future presidential contender in the West African state.
He is popular among young Senegalese.
During previous protests, people hurled stones at police, looted shops and torched cars.
The protests calmed on Saturday but the call from the opposition collective known as the Movement for the Defence of Democracy for more demonstrations has led to fears the violence could escalate.
The 15-nation Economic Community of West African States has called for peace and said it had "significant concerns".
Foreign embassies in Dakar, including the United States, and the European Union issued a joint statement on Sunday urging non-violence and dialogue.
President Macky Sall has yet to publicly address the situation and is facing pressure to speak on the matter.
Kenya's Odinga vows to continue protest campaign
Senegalese opposition leader claims he was victim of assassination attempt
Sudan: Political faction condemns moves to form new govt without consensus
Police and protestors clash in Nairobi amid nationwide demonstrations
Go to video
Arrests as Kenya opposition leads anti-government protests
Trial of Senegalese opposition leader postponed