There were loud celebrations outside court as the men were lifted onto the shoulders of supporters
Four senior politicians accused over an alleged coup plot that sparked South Sudan’s civil war have been freed after the government dropped the treason charges against them.
The four, who include a former leader of the governing SPLM party, denied the plot as well as links to the fighting.
Their release had been a key demand of the rebels.
Some one million people have been forced from their homes since fighting broke out in December 2013.
The four men were greeted by cheering supporters, who lifted them onto their shoulders and into the crowd.
They were due to fly to neighbouring Kenya but one of their allies, Rebecca Garang, told the BBC that their passports had been confiscated.
President Salva Kiir told journalists that they had been “encouraged” to stay in the country and work for peace.
He also said the prosecution could be revived “any time they are needed”.
The trial had been seen as a stumbling block to peace talks in the Ethiopian capital, Addis Ababa.
Justice Minister Paulino Wanawilla said on Thursday that the case was being dropped in the interest of peace and reconciliation.
The charges against the four politicians carried the maximum sentence of death and related to an alleged coup attempt on 15 December.
Pagan Amum, ex-secretary general of the Sudan People’s Liberation Movement (SPLM), told reporters that the withdrawal of the case meant that justice had been denied, and he would have preferred a not guilty verdict.
“We were imprisoned without any reason,” Mr Amum told supporters in a speech outside the court.
“We have to return South Sudan to peace and stability,” he said, adding that he would work with both the government and rebels “to end this senseless war that is killing our people.”
The other three politicians released were ex-National Security Minister Oyai Deng Ajak, former Defence Minister Majak D’Agoot and former ambassador to the US Ezekiel Lol Gatkuoth.
As well as treason, they were accused of inciting the army and fuelling an insurgency in South Sudan, the world’s newest state which became independent in 2011.
On Thursday, the UN Security Council threatened sanctions against those responsible for the continuing violence.
In a strongly worded statement, council members expressed “horror and anger” over the mass killings of hundreds of civilians in the town of Bentiu, capital of the oil-rich Unity State, last week.
Correspondents say the killings in Bentiu are among the most shocking since the violence began.
Conflict first broke out in the capital, Juba, between troops loyal to South Sudan President Salva Kiir and those allied with his sacked deputy, Riek Machar.
It later spread to other parts of South Sudan, with numerous reports of ethnic killings.
President Kiir accused Mr Machar of instigating a coup – but Mr Machar denied the allegation and branded Mr Kiir a “genocidal leader” who started the war by carrying out a purge of his enemies.
Charges remain against Mr Machar, who fled the capital and is leading the rebellion.
Both sides have 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.
Thousands of civilians have been killed so far in the conflict and the United Nations has warned of the added risk of a famine.