The International Criminal Court (ICC) in The Hague has acquitted Ivory Coast ex-President Laurent Gbagbo.
He had been charged with crimes against humanity in connection with violence following a disputed 2010 election that left 3,000 dead and 500,000 displaced.
Mr Gbagbo was captured in 2011 in a presidential palace bunker by UN and French-backed forces supporting his rival, Alassane Ouattara.
He was the first former head of state to go on trial at the ICC.
What was Mr Gbagbo accused of?
The violence in Ivory Coast, the world's biggest cocoa producer, came after Mr Gbagbo refused to accept that he had lost a disputed election run-off to Mr Ouattara in 2010.
The five months of violence that followed were described as some of the most brutal clashes the country had ever seen.
During the political stand-off there were bloody clashes and targeted killings in Abidjan in the south, and several hundred were massacred in the western town of Duekoue.
Prosecutors said Mr Gbagbo clung to power "by all means" and charged him with four counts of crimes against humanity, murder, rape and other forms of sexual violence, persecution and "other inhuman acts".
He denied the charges, which he said were politically motivated.Image copyrightAFPImage captionVictims of the 2010 post-election violence are opposed to Mr Gbagbo's release
ICC judges ruled on Tuesday that he had no case to answer and ordered his immediate release.
Prosecutors had failed to demonstrate "the existence of a 'common plan' to keep Mr Gbagbo in power" which included crimes against civilians, or a "policy to attack a civilian population", the ICC said.
Presiding Judge Cuno Tarfusser said the prosecution had also "failed to demonstrate that public speeches by Gbagbo constituted ordering or inducing the alleged crimes".
Prosecutors can appeal after the court files its decision in writing.
Mr Gbagbo's supporters whooped, cheered and threw their firsts in the air in the public gallery following the announcement, the BBC's Anna Holligan reports from the court.Image copyrightAFPImage captionMr Gbagbo's supporters are jubilant
One of his supporters, Gragbayou Yves, who had travelled to the court from Paris, told AFP news agency: "I am very, very happy. Finally there is some justice."
However, victims of the violence are opposed to his release.
"If Laurent Gbagbo is released, we victims will not see justice," Karim Coulibaly, who was shot in the violence and had to have his arm amputated, told AFP earlier.
"I was a driver but now I am unemployed. I'm not against reconciliation but first you have to look after the victims."
Is this a blow to the ICC?
"Whenever a case involving mass atrocities essentially collapses at the ICC, it does damage to the perception of the court as a credible and effective institution of international justice," Mark Kersten, author of Justice in Conflict, told the BBC's Anna Holligan.
"Many are concerned that the court is emerging as an institution where only rebels can be successfully prosecuted," he added.
The prosecution at the ICC has also failed in its attempts to build successful cases against former DR Congo Vice-President Jean-Pierre Bemba, and Kenyan President Uhuru Kenyatta.
On the other hand, the ruling demonstrates the judges' independence and impartiality and makes it harder to push the narrative, popular among those who fear the long arm of the ICC, that the court is a biased weapon of neo-colonial justice used purely to convict African leaders, our correspondent says.
Janet Anderson, a writer for the Justice Tribune, told the BBC: "It's important also to find people not guilty or to find there isn't a case to answer if there isn't one."