* Government forces, rebels clash again in Bor
* African Union threatened targeted sanctions
* Conflict risks sucking in South Sudan's neighbours (Recasts with agreement on ceasefire)
By Carl Odera and Aaron Maasho
JUBA, Dec 31 (Reuters) - South Sudan's government and rebels agreed a ceasefire on Tuesday, mediators said, though there was no immediate confirmation from either side or sign of an end to ethnic fighting that has ravaged the world's youngest nation.
Less than two hours before the deal was announced, officials said militias loyal to ex Vice President Riek Machar were still fighting in Bor, the main town in the vast, underdeveloped Jonglei state and the site of an ethnic massacre in 1991.
"We will retake the part we lost very soon," Bor's mayor, Nhial Majak Nhial, told Reuters. A rebel spokesman in neighbouring Unity state said the rebels had taken the town.
The IGAD group of East African countries said both sides had appointed teams to start negotiations.
"President Salva Kiir Mayardit and Dr. Riek Machar agree on a cessation of hostilities and appoint negotiators to develop a monitored and implemented ceasefire," it added, without saying when any ceasefire or talks might start.
Western and regional powers have pushed both sides to end the fighting that has already killed at least 1,000 people, cut South Sudan's oil output and raised fears of a full-blown civil war in the heart a fragile region.
The clashes erupted on Dec. 15 with fighting among a group of soldiers in Juba. The violence quickly spread to half of the country's ten states, cleaving the nation along the ethnic faultline of Machar's Nuer group and Kiir's Dinkas.
Kiir accused his long-term political rival Machar, who he sacked in July, of starting the fighting in an effort to seize power.
Machar denied the charge, but took to the bush and acknowledged leading soldiers battling the government. There have been conflicting reports on whether Machar was in full control of the Nuer "White Army" militia fighting in Bor, though on Tuesday he told the BBC they were part of his forces.
The fighting has revived memories of the factionalism in the 1990s within the Sudan People's Liberation Movement - the group that fought Sudan's army in the north for two decades. Machar led a splinter faction and fighters loyal to him massacred Dinkas in Bor.
Both the government and the rebels earlier said they were sending teams to start talks in neighbouring Ethiopia, though Machar at the time told the BBC he was not prepared to lay down weapons.
The U.S. special envoy to South Sudan, Donald Booth, said the commitment to send negotiators was an "important first step" towards a negotiated settlement.
Ugandan President Yoweri Museveni said on Monday east African nations had agreed to move in and defeat Machar if he rejected the ceasefire offer, threatening to turn the fighting into a regional conflict.
There was no immediate confirmation of the pact from other nations.
Bor was briefly seized by the rebels early in the conflict before being retaken by government troops after several days of heavy fighting.
"The town is still partly in our hands and partly in the hands of the rebels," Mayor Nhial Majak Nhial told Reuters on Tuesday from the government's military headquarters inside Bor, 190 km (120 miles) north of Juba by road.
About 70,000 civilians have fled Bor and sought refuge in the town of Awerial in neighbouring Lakes state, with no access to food, clean water or shelter, medical charity Medecins Sans Frontieres (MSF) said. Others were hiding in swamps.
"Living conditions are verging on the catastrophic," MSF said.
Fighting across the country has displaced at least 180,000 people, including 75,000 seeking refuge inside different U.N. bases, according to U.N. figures.
The African Union said late on Monday it was dismayed and disappointed by the bloodletting that came two years after South Sudan won independence from its northern neighbour, Sudan.
The AU's Peace and Security Council said it would "take appropriate measures, including targeted sanctions, against all those who incite violence, including along ethnic lines, continue hostilities (and) undermine the envisaged inclusive dialogue."
South Sudan's neighbours have given the warring sides until Tuesday to lay down their arms and begin talks, without giving a precise time when the deadline would end. (Additional reporting by Drazen Jorgic and Richard Lough in Nairobi; Writing by Richard Lough; Editing by Andrew Heavens)