DAKAR, Senegal (AP) — Senegal’s top opposition leader, Ousmane Sonko, has been released from prison ahead of the presidential election later this month, triggering jubilant celebrations across the country's capital.

Sonko is widely seen as ruling party. As he left the prison complex on Thursday night, Sonko was greeted outside by crowds of supporters waving flags, chanting and holding up posters.

Sonko had been in prison since July and has fought a prolonged legal battle to run for president in the March 24 election. Sonko and his key ally, Bassirou Diomaye Faye, were both set free, his lawyer Bamba Cisse told The Associated Press.

It wasn’t immediately clear how their releases would impact the election. Faye was named the opposition’s election candidate after Sonko was barred from running.

Supporters also gathered at Sonko's house and at other locations in the capital, Dakar, to celebrate. Convoys of supporters drove around the city tooting their horns and yelling until late at night.

Sonko, who finished third in the 2019 presidential election, is popular among young people and his fiery campaign to tackle corruption has resonated in a country with economic hardship. The war in Ukraine has pushed up food and energy prices, further straining the economy.

Sall himself ultimately decided not to seek a third term in office after Sonko’s supporters launched months of protests that at times turned deadly. The protests have rocked Senegal's image as a pillar of stability in West Africa, where dozens of coups and attempted coups have taken place in recent decades.

Sonko’s presidential bid has faced a prolonged legal battle that started when he was accused of rape in 2021. He was acquitted of the rape charges but and sentenced to two years in prison last summer, which ignited deadly protests across the country.

In January, he was disqualified from the ballot because he faces a six-month suspended sentence following , Senegal’s highest election authority, the Constitutional Council, said at the time.

Sonko's supporters maintain his legal troubles are part of . His release follows Sall’s decree to exonerate political prisoners, including hundreds that were arrested in the violent protests last year.

Presidential candidates kicked off their election campaigns last Saturday, following weeks of violent protests .

tried to , just weeks before it was to take place on Feb. 25. His announcement that the vote would instead be held 10 months from now and drew protesters to the streets again. But the Constitutional Council, rejected Sall’s postponement and ordered the government to set a new date as soon as possible.

The ºÃÉ«tv Press. All rights reserved.