The South African retired army colonel was a former adviser to Riek Machar, South Sudan's vice-president-turned-rebel-leader. Five years into South Sudan's civil war, thousands have been killed and 2 million displaced.
South Sudan's high court sentenced a former South African army colonel to death by hanging on Friday for conspiracy and attempting to overthrow the government.
Retired army colonel William John Endley was a former adviser to ex-vice-president Riek Machar, whose rebel forces have been fighting against the government of President Salva Kiir since 2013.
"South African national William Endley has been in the country illegally since the outbreak of civil war and he has actively participated in activities that have harmed South Sudan," Judge Martin Kurikuri told dpa.
Endley's lawyer Gardit Abel Gar said his client would appeal a "mockery of justice."
The defense tried to get six witnesses to testify during the trial, but none went before the court.
According to the defense, Endley was performing his duties as a contractor to help Machar integrate his forces into the South Sudanese Army before being arrested in August 2016, South Africa's eNCA news reported.
South Africa's Department of International Relations said they would review the verdict.
"Our embassy in South Sudan will brief Head Office on the judgement and we will take it from there," said spokesman Nelson Kgwete.
Machar's former spokesman, James Gatdet Dak, was sentenced to death last month.
Possible war crimes
South Sudan gained independence from Sudan in 2011 and descended into civil war two years later, after Kiir sacked Machar as his deputy.
The conflict has killed tens of thousands of people and displaced another two million.
Repeated peace talk efforts have failed, with a December ceasefire agreement collapsing into renewed violence.
Read more: South Sudan: Starvation and violence
The UN said in a report on Friday that there is "sufficient evidence" both the government and rebels have committed war crimes.
The report documented widespread rape, pillaging, murder and forced displacement of civilians that has turned South Sudan into one of the world's largest humanitarian disasters. Millions of people face starvation.
What started as a conflict between Kiir's government forces and Machar's rebels has since morphed into a conflict involving an estimated 40 armed groups.
Machar is currently under house arrest in South Africa.