JUBA, South Sudan (AP) — South Sudan's special high court has sentenced a South African military veteran to execution by hanging.

Retired colonel William Endley, a former adviser to past Vice President Riek Machar, had been convicted on charges of conspiracy and attempting to overthrow the government.

His lawyer, Gar Adel Gar, calls the sentence a "mockery of justice" and says they plan to appeal it next week.

Endley has been detained since August 2016. He is one of two people associated with opposition leader Machar who now face a death sentence for allegedly conspiring against the government. The other is James Gatdet Dak, Machar's former spokesman.

Rights groups have condemned the death sentences and called on South Sudan's government to reconsider.

The country's civil war is now in its fifth year.