JUBA - Government troops and rebels in South Sudan still fought sporadic battles after a ceasefire came into force Friday, the United Nations said.

The ceasefire came into effect at 1730 GMT despite rebel accusations that the army had attacked their positions in two separate regions just hours earlier.

"The UN Mission in South Sudan says that sporadic fighting took place in parts of the country today," including after the ceasefire, UN deputy spokesman Farhan Haq said.

Rebel spokesman Lul Ruai Koang said before the ceasefire deadline that "simultaneous attacks have been launched" by the army on positions in the northern oil state of Unity, and in the volatile eastern Jonglei region.

But army spokesman Philip Aguer said he had "no reports of fighting", and that clashes in Jonglei had taken place before the deal was signed, when rebels attacked government forces.

Both sides pledged on Thursday to halt fighting within 24 hours and end five weeks of bitter conflict that has left thousands dead, but both sides have said they doubt the other can fully control the forces on the ground.

Koang alleged that South Sudanese government troops -- as well as Ugandan soldiers and rebels from neighbouring Sudan's war-torn Darfur region, the Justice and Equality Movement (JEM) -- had attacked rebel positions, warning they had the "right to defend themselves against this senseless aggression."

The ceasefire agreement was signed late Thursday in the Ethiopian capital Addis Ababa by representatives of South Sudan's President Salva Kiir and rebel delegates loyal to ousted vice president Riek Machar, and was greeted by cheers from regional peace brokers and diplomats.

"It is critical that both parties implement the cessation of hostilities agreement in full and immediately," the UN spokesman said.

US President Barack Obama, whose country provided crucial backing on South Sudan's path to statehood, described the deal as "a critical first step toward building a lasting peace".

Kiir urged those rebels not under Machar's control to also respect the deal.

"Now that people have fought, people should come back to their senses and we sit down so that we can resolve this conflict through negotiation," Kiir said in address Friday.

Fear of revenge attacks

Up to 10,000 people are believed to have been killed in the fighting pitting forces loyal to Kiir against a loose coalition of army defectors and ethnic militia nominally headed by Machar, a seasoned guerrilla fighter.

The fighting has been marked by atrocities on both sides with some 700,000 people forced from their homes in the impoverished nation.

There has also been a wave of brutal revenge attacks, as fighters and ethnic militia use the violence to loot and settle old scores.

Food to feed a quarter of a million people for a month has been looted from UN World Food Programme stores -- a staggering 3,700 metric tons -- with the agency warning that "humanitarian needs will continue long after the fighting stops".

More than 76,000 people are crowded inside UN peacekeeper bases across the country -- the highest number since the start of the conflict -- with most hesitant to leave the protection offered by the compound.

"No one I know is preparing to leave yet, they want to wait to see how things turn out," said David Choul, one of thousands squeezed into a former sports ground turned into a UN base in Juba.

Government delegation head Nhial Deng Nhial said he was sceptical of the rebels' capacity to curb the violence, "given that the bulk of the rebels are made up of civilians" -- essentially any one of the countless people who have kept hold of their guns after decades of conflict.

"It won't happen overnight when there was so much fighting going on," said one UN Security Council diplomat following the crisis.

But Rebecca Garang, widow of South Sudan's independence leader John Garang, and who stood with Machar to make a political challenge to the government in December before fighting began, dismissed such concerns.

"The ceasefire did not just come alone in isolation without Dr Riek (Machar) knowing what is going on... so I think he will be able to talk to all of them and control them," she told the BBC.