JUBA, Jan 18 (Reuters) - South Sudanese government forces said they seized the flashpoint town of Bor back from rebels on Saturday and Uganda's army claimed credit for the operation, highlighting the depth of its involvement in the conflict.

A rebel spokesman in Addis Ababa, where talks aimed at securing a ceasefire have been grinding on, told Reuters his fighters had made a "tactical withdrawal" from Bor, which has been heavily fought over since the conflict erupted in mid-December.

The United Nations says thousands of people have been killed and more than half a million driven from their homes in the fighting in the world's newest nation.

It has pitted troops loyal to President Salva Kiir against rebels backing Riek Machar, who was sacked as vice president in July.

"The SPLA has defeated more than 15,000 forces of Riek Machar," Philip Aguer, spokesman for the government SPLA forces, told reporters in the capital Juba.

"The SPLA has frustrated Riek Machar's plan to advance and attack Juba, and install himself as the ruler of South Sudan."

Lul Ruai Koang, military spokesman of Machar's delegation at the talks in the Ethiopian capital, told Reuters the rebels had pulled out voluntarily on Friday.

"Our political leadership wanted to reorganize our forces for other important operations ... Not a single shot was fired when government troops entered today (Saturday)," he added.

Initially triggered by a political row, battle lines have increasingly followed ethnic lines with Kiir's Dinka battling Machar's Nuer. Bor was the scene of a massacre of Dinka by Nuer troops loyal to Machar, during an earlier conflict in 1991.

Uganda, which for years backed the SPLA in its conflict against Sudan's government before the south declared independence in 2011, has sent its troops to support Kiir. A spokesman said the Ugandan People's Defence Force was behind the success at Bor, the capital of restive Jonglei state.

"It's UPDF that captured Bor," Ugandan army spokesman Paddy Ankunda told Reuters after first announcing the UPDF's role on Twitter. "There was a lot of resistance but our force was overwhelming."

Uganda deployed its troops to South Sudan shortly after the fighting began. At first, Uganda said it troops were there to help stranded Ugandans and protect key facilities. But it has since declared its role in combat.

Uganda's involvement has raised worries of a broader conflict that draws other regional players into South Sudan, an oil-producing nation but one of the poorest in Africa.

Ethiopia, one of South Sudan's neighbours, has voiced its concerns about Uganda's role.

Machar and rebel officials have demanded Ugandan forces withdraw before they agree a ceasefire at the talks in Addis Ababa that are sponsored by the regional African body IGAD.

"The mediators have tabled their offer," said Dina Mufti, spokesman for Ethiopia's Foreign Ministry. "There is a good chance they will agree to its elements and sign an agreement on a cessation of hostilities within a week's time."

U.N. Assistant Secretary-General for Human Rights Ivan Simonovic said on Friday the fighting had "now reached the threshold of an internal armed conflict", a status that could lead to prosecutions for war crimes where deemed appropriate.

Simonovic, speaking after a four-day trip to South Sudan, said "mass atrocities" had been committed by both sides. New York-based Human Rights Watch has also reported crimes against civilians, such as targeted attacks based on ethnicity. (Additional reporting by Elias Biryabarema in Kampala and Aaron Maasho in Addis Ababa; Writing by Edmund Blair; Editing by Andrew Heavens)