JUBA (Reuters) - South Sudan’s rebels said on Sunday they had released seven aid workers detained for nearly three weeks in the country’s Central Equatoria region on accusations of spying for the government.

Rebel spokesman Lam Paul Gabriel told Reuters the workers were released to a U.N. delegation near the border with Uganda and Ugandan police witnessed the handover.

South Sudan has been gripped by conflict since 2013 after a disagreement between President Salva Kiir and his former deputy Riek Machar deteriorated into a military confrontation.

The war has killed tens of thousands of people, including nearly 100 relief workers.

In one of the latest incidents, an aid worker was killed when gunmen shot at a vehicle marked with logos of the Catholic Organization for Relief and Development Aid as it traveled on a road near the town of Bentiu on March 7.

Both rebels and the government forces stand accused of targeting humanitarian workers and sometimes blocking access to relief and hijacking food and other aid.

Gabriel said the aid workers were detained after two of them were discovered to be government spies “intentionally deployed to carry out hostile surveillance on our controlled areas.”

Humanitarian agencies should “avoid being infiltrated by the regime,” he said and added the aid workers had been released on orders from Machar.