South Sudan released four top leaders accused of rebellion and treason, dropping charges of attempting to overthrow the government in a move aimed at ending a four-month-old civil war.
President Salva Kiir said their release was the "price of peace", adding: "Even if we hang them, they cannot compensate those who were killed."
The court order said the men were freed "in order to promote peace and reconciliation among our people", while Kiir urged people to respect those released.
"This is the only way of getting out" of war, he said in a speech. "Let's all work together."
The four men were greeted by cheering supporters who carried them on their shoulders into the crowd.
"We were imprisoned without any reason," said freed detainee Pagan Amum, the former secretary general of the ruling party.
In a speech thanking his supporters, he vowed to work to end the vicious conflict. "We have to return South Sudan to peace and stability," Amum said, adding that 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 United Nations sanctions amid worsening violence and atrocities.
Amid a wave of killings, UN human-rights chief Navi Pillay is heading to the country tomorrow on a joint mission with Adama Dieng, the UN's special envoy for the prevention of genocide.
The three other freed detainees are ex-national security minister Oyai Deng Ajak, former ambassador to the US Ezekiel Lol Gatkuoth, and ex-deputy defence minister Majak D'Agoot.