A prominent Senegalese opposition figure, charged with rape has been released on bail pending trial.
The case has ignited mass outrage at President Macky Sall’s government and led to the worst unrest in a decade.
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.
Sonko rose to prominence in 2015 after releasing documents he said exposed political corruption in Sall’s ruling Alliance for the Republic party and criticising Senegal’s economic reliance and relationship with former colonial power France.
Thousands of mainly young people have taken to the streets in the past week, leaving at least eight dead in clashes between protesters and police and bringing parts of the capital, Dakar, to a halt.
On Friday, at least four people died, according to police, including a 20-year-old student, amid an aggressive response by security forces who have shot live rounds and teargas.
On Sunday, Alioune Badara Cissé, a top Senegalese official, whose job is to settle conflicts, said the authorities "need to pause and speak with our youth" and warned that "we are on the verge of an apocalypse".
Military tanks patrolled Dakar’s streets on Monday morning in a show of force. Outside court groups of Sonko supporters cheered the judgment as a “partial victory”. Despite his release, protests called by his Movement to Defend Democracy party (M2D) are expected to continue.
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.
Posts on social media under the hashtag “FreeSenegal” have trended in Nigeria, Ghana and other countries in a continent where young populations are increasingly vocal in their opposition to political elites accused of suppressing democracy and changing constitutions to extend their terms.
In 2010 Sall led mass protests when the then president, Abdoulaye Wade, sought a third term. However, many of Sonko’s supporters increasingly fear that the president, a key French ally, is now also seeking to extend his own rule beyond his second term – a prospect leaders in West Africa have increasingly embraced.
Senegal's neighbours in the West African regional bloc, Ecowas, have condemned the violence and called on "all parties to exercise restraint and remain calm."
Meanwhile, some protesters have looted and vandalised French stores and petrol stations in Senegal, as significant anti-government and anti-French sentiment has unravelled into the streets.
France is the largest trading partner and investor in Senegal, and French companies are accused of stifling local-owned businesses.
Other French-owned companies such as Total petrol stations, Air France offices and Orange mobile phone outlets have also been attacked by the protesters, who consider France a strong ally of Sall.