JUBA (Reuters) - South Sudan freed two associates of rebel leader Riek Machar from prison on Friday, advancing a peace agreement to end almost five years of civil war.

Slideshow ( 4 images )

The two - retired South African colonel William Endley, an adviser to Machar, and James Gatdet, Machar’s spokesman, had been sentenced to death.

President Salva Kiir on Wednesday ordered their release on Wednesday to reinforce the peace accord signed in September.

“We are here to implement the orders of the president. Their release comes as part of the peace process. They are now free,” Interior Minister Michael Chiangjiek said after signing the paperwork confirming their release.

Sudan erupted in conflict in 2013 after Kiir sacked Machar as vice president. Ethnically charged fighting soon spread, shutting down oil fields and forcing millions to flee.

At least 383,000 South Sudanese have died as a result of the war, through combat, starvation, disease or other factors,

according to a recent study by London School of Hygiene and Tropical Medicine researchers.

Under pressure from governments in East Africa and from United Nations and Western donors, Machar’s group, other rebel factions and the government signed the peace accord under which he will again become vice president.

Endley was sentenced to death in February for trying to bring down the government, while Gatdet was sentenced to death in the same month on charges of treason and incitement against the government.

A Reuters witness at the prison where they had been said the two were brought out of their cells and told to put on civilian clothes.

Gatdet will go to Khartoum, Sudan’s capital. Endley left South Sudan on Friday afternoon to return to South Africa, a Reuters witness at Juba international airport said.

Before their release, the two had expressed excitement at their impending freedom.

“I hope to see peace in South Sudan,” Gatdet told Reuters from his jail cell, seated next to Endley.

“After two years and two months. It is finally a few minutes to go and also very happy today for the signed peace for the Republic of South Sudan,” Endley said.

Machar returned to Juba on Wednesday.

He fled to neighboring Democratic Republic of Congo in 2016 after fighting broke out again in the capital, wrecking an earlier peace deal. He later traveled to South Africa, where he was held under house arrest.