By Aaron Maasho
ADDIS ABABA (Reuters) - South Sudan's government and rebels are scheduled to sign a ceasefire on Thursday, the mediator said, after more than five weeks of fighting that has divided Africa's newest nation and brought it to the brink of civil war.
Fighting between troops loyal to President Salva Kiir and those backing the vice president he sacked in July, Riek Machar, erupted in mid-December.
One rebel spokesman in Addis Ababa, where peace talks have been taking place, said they were "very likely" to sign the deal in the afternoon. Mabior Garang, spokesman for Machar's delegation at the talks, went further, telling Reuters: "We will sign the deal."
The conflict has turned along ethnic fault lines, pitting Machar's Nuer against Kiir's Dinka people. Thousands of people have been killed and hundreds of thousands driven from their homes in the oil-producing nation, one of Africa's poorest.
"Signing ceremony of Agreements on Cessation of Hostilities and Question of Detainees between the South Sudanese parties at Sheraton Hotel," the regional grouping IGAD, which has been mediating the talks in the Ethiopian capital, said in a text message. It said the timing was set for later on Thursday.
Both sides have previously said they were close to a deal, but disagreements have until now pushed back any signing.
Rebels had demanded the release of 11 of Machar's allies, detained by the government and accused of attempting a coup. That demand was dropped as a precondition but both sides agreed to discuss the issue of detainees on a separate track.
Rebel spokesman Garang said freeing the detainees was "not so much of a demand since everyone recognises the need for their release".
The rebels have also demanded that Uganda, which openly admitted to helping Kiir's forces in combat, must leave South Sudan. Diplomats at the talks said the deal would call for an end to "involvement by foreign forces".
Government forces have retaken control of major towns that had been captured by rebels, though often with the assistance of Ugandan forces.
South Sudan won its independence from Sudan in 2011 after decades of conflict between the northern and southern Sudanese.
(Reporting by Aaron Maasho; Writing by Edmund Blair and Duncan Miriri; Editing by Richard Lough and Mark Trevelyan)