South Sudan has released four top leaders accused of rebellion and treason, dropping charges for attempting to overthrow the government in a move aimed at ending a four-month-old civil war.
A court order issued on Friday said the men were released "in order to promote peace and reconciliation among our people".
An AFP reporter at the court said the four men were greeted by cheering supporters, who lifted them up onto their shoulders into the crowd.
"We were imprisoned without any reason," said detainee Pagan Amum, the former secretary general of the governing Sudan Peoples Liberation Movement (SPLM).
The court order made no mention of former vice president Riek Machar, the chief rebel leader, whom Justice Minister Paulion Wanawilla said on Thursday still had charges to answer.
Machar fled Juba, the capital, last December and is continuing to lead the rebellion.
In a speech thanking his supporters, Amum said he would work to end the conflict.
"We have to return South Sudan to peace and stability," Amum said, adding he would work with both the government and rebels "to end this senseless war that is killing our people".
The detention of the four had been a major sticking point in peace talks, and the gesture comes as the leaders on both sides of the conflict face the threat of UN sanctions amid worsening violence and atrocities.
In a strongly-worded statement, the 15 members of the Security Council "expressed horror and anger" over the killings of hundreds of people last week in the oil town of Bentiu - ethnic slaughter which UN officials have blamed on rebels.
The three other freed detainees are former national security minister Oyai Deng Ajak, ex-ambassador to the US Ezekiel Lol Gatkuoth, and former deputy defence minister Majak D'Agoot.
"We feel that our clients have been vindicated, they are innocent people," defence lawyer Monyluak Alor told AFP after the ruling.
"They were witch hunted, but then justice has prevailed ... peace and reconciliation are paramount now."
The four leaders were arrested in Juba after fighting broke out between members of the presidential guard.
The fighting rapidly escalated into all-out war between troops loyal to President Salva Kiir and defectors and ethnic militia loyal to sacked vice president Machar.
We have to return South Sudan to peace and stability
Kiir accused Machar and his allies of attempting a coup, and initially 11 of his loyalists were put on trial.
Machar denied the allegation, and in turn branded Kiir a "genocidal leader" who started the war by carrying out a purge.
Charges remain against Machar, as well as other two key rebels, former governor of the oil-rich Unity state Taban Deng, and ex-minister Alfred Ladu Gore.
Charges were also dropped against seven leaders who were arrested shortly after fighting broke out but released in January into the care of neighbouring Kenya.
The move comes amid worsening violence in South Sudan, the world's newest nation which only won independence from Khartoum in 2011.
The conflict has already left thousands dead, over a million displaced, and prompted UN warnings of the risk of famine.
Both sides have also been implicated in atrocities and war crimes, and fighting has intensified with the rebels saying they are closing in on northern oil fields and several key towns.
Last week, the rebels were accused of murdering hundreds of civilians after capturing the oil hub of Bentiu, and a mob killed dozens of civilians in an attack on a UN base in Bor where they were sheltering.