* Uganda has previously denied any active combat role
* Machar has accused Ugandan troops of taking sides
* Ceasefire in balance over detainees' release
By Elias Biryabarema
KAMPALA, Jan 15 (Reuters) - Uganda's president Yoweri Museveni admitted for the first time on Wednesday to helping his South Sudanese counterpart fend off a rebellion that has driven the world's youngest nation to the brink of full-blown civil war.
Ugandan officials have previously denied the country's troops were involved in partisan combat, insisting they were only involved in evacuating stranded Ugandans and helping protect Juba airport and the presidential palace.
Uganda's troop involvement in combat in South Sudan could raise concerns that other regional countries could be sucked into the conflict, fighting their own proxy wars as has happened elsewhere on the continent, such as Congo.
A spokesman for the prime minister of Ethiopia, where peace talks are taking place, said earlier this month having Ugandan troops engaged in combat would be "absolutely unwarranted".
A month of fighting between President Salva Kiir's SPLA government forces and rebels loyal to former vice president Riek Machar has killed more than 1,000 people - up to 10,000 by one think tank's estimate - and forced a cut in oil production.
The United Nations says 500,000 people have fled their homes, with more than 70,000 of them fleeing abroad.
Museveni said Ugandan troops had this week helped defeat rebels outside Juba, and some had been killed in battle. Museveni also blamed Machar for turning a political difference into a military confrontation.
"Only the other day, Jan. 13, the SPLA and elements of our army had a big battle with these rebel troops at a point about 90 km from Juba," Museveni said.
"We inflicted a big defeat on them. Unfortunately, many lives were lost on the side of the rebels. We also took casualties and also had some dead."
Kuol Manyang, South Sudan's defence minister, said the Ugandan forces in his country numbered "a battalion", and that they were there to help quell the rebellion by Machar.
"They are in Juba and are supporting the SPLA which is moving to Bor," he said, referring to a town just north of the capital that fell into rebel hands after the conflict flared up.
There was no immediate comment from the rebels' delegation at the Addis Ababa peace talks, where both sides have held talks to try to agree a ceasefire, but there has been little progress.
The Ugandan president sent his soldiers to South Sudan days after fighting erupted on Dec. 15, pitting ethnic Dinka Kiir's troops against forces loyal to Machar, an ethnic Nuer, reopening ethnic fault lines.
Their presence has attracted criticism from Machar who accused Ugandan military aircraft of bombing their positions.
In December, Museveni threatened Machar with defeat if he did not accept a ceasefire.
On Wednesday, he warned him to withdraw "to a remote area of the country to avoid attack and to start talks unconditionally so as to resolve the problem quickly".
African envoys met Machar on Saturday, to persuade him to accept a ceasefire deal, and the rebel leader again expressed concern about Ugandan military intervention in South Sudan.
The rebels' delegation had sought a deal that would condemn Uganda's involvement, saying it had been bombarded by Ugandan helicopter gunships during the conflict.
Machar's demand for the release of detainees remains a stumbling block to a ceasefire deal to end the violence.
On Tuesday, Uganda's parliament retrospectively endorsed Museveni's troop deployment although opposition legislators criticised it as unwarranted interference in South Sudanese internal politics.
They demanded that the mission should be restricted to rescuing Ugandans and have a specific timeframe.
Museveni had been speaking at a summit of the regional body International Conference on the Great Lakes Region, in the Angolan capital Luanda. (Additional reporting by Carl Odera in Juba; Writing by James Macharia; Editing by Alison Williams)
Our Standards: The Thomson Reuters Trust Principles.