NAIROBI (Reuters) - South Sudan has released at least 30 political prisoners since President Salva Kiir declared an amnesty in May to facilitate national dialogue and douse a four-year civil war, a senior security official said.

Jalban Obaj, director of legal affairs at the Internal Security Bureau told SSBC state television late on Thursday that the prisoners had been set free at different times since the declaration of the amnesty.

Nearly all the ex-detainees, including Justin Wanawila Bilal, a religious cleric, had been accused of supporting opposition leader and former vice president Riek Machar.

"The release of the political detainees came as a gesture of good will," Ateny Wek Ateny, Kiir's spokesman, told Reuters on Friday.

He said the freeing of the detainees without any precondition also demonstrated that Kiir was determined to resolve the country's conflict.

South Sudan was plunged into war in 2013 after a political disagreement between Kiir and Machar strained relations between the two. Kiir then sacked Machar as his deputy, triggering fighting between forces loyal to both men.

Kiir hails from the Dinka while Machar is a Nuer and the rivalry between the two tribes has meant much of the fighting and violence has unfolded along ethnic divisions.

South Sudan Human Rights Observatory (SSHRO), a local non-governmental organization, said in a statement the release of only 30 prisoners was "cosmetic because thousands of South Sudanese... are still unlawfully detained".

The SSHRO also accused the government of continuing a campaign of "hunting, harassing and kidnapping political opponents" - a charge Kiir's administration denies.

An estimated quarter of South Sudan's 12 million people have been uprooted by the conflict, with neighboring Uganda hosting a million of those displaced.

Machar is being held as a "guest" in South Africa to prevent him stirring up trouble, diplomats and political sources told Reuters last December.

Last month an international mediator said Machar had declined to renounce violence or declare a unilateral ceasefire and instead demanded new peace talks outside South Sudan.

(Writing by Elias Biryabarema; Editing by Gareth Jones)