At least two UN peacekeepers from India have been killed in an attack on a United Nations base in South Sudan, a UN spokesman said.

The UN said attackers from the country's second-largest ethnic group forced their way into the Akobo base in conflict-wracked Jonglei state on Thursday, pursuing civilians from a rival ethnic group who had taken refuge there.

India's UN envoy said earlier that three peacekeepers were killed.

Contact with the base was lost after the assault and UN deputy spokesman Farhan Haq said the fate of more than 30 ethnic Dinka civilians sheltering at the base was not known.

A statement said UN Secretary-General Ban Ki-moon was "appalled" to learn of the attack.

"There are indications that civilians may have been killed and wounded in the attack, but this remains to be verified. Should these reports prove true, those responsible must be held accountable for their crimes," the statement said.

Ambassador Asoke Mukerji said the three peacekeepers were "targeted and killed" during an attack by ethnic Nuer youths.

Rapidly escalating ethnic violence has raised fears of instability in the world's newest country.

At 'precipice' of civil war

Meanwhile, Barack Obama, the United States president, called for an immediate end to the fighting in South Sudan on Thursday, warning the country stands at the "precipice" of civil war.

Recent fighting threatens to plunge South Sudan back into the dark days of its past. Barack Obama, US president

Obama, who earlier announced he had deployed 45 troops to the violence-wracked country on Wednesday to protect US personnel and interests, warned that "recent fighting threatens to plunge South Sudan back into the dark days of its past".

"Fighting to settle political scores or to destabilise the government must stop immediately. Inflammatory rhetoric and targeted violence must cease," the US president added in his statement.

"All sides must listen to the wise counsel of their neighbours, commit to dialogue and take immediate steps to urge calm and support reconciliation. South Sudan's leaders must recognise that compromise with one's political enemy is difficult; but recovering from unchecked violence and unleashed hatred will prove much harder."

The attack on Indian peacekeepers on the UN base came after troops loyal to fugitive former vice president Riek Machar seized the town of Bor late on Wednesday, as fighting continued in eastern Jonglei state.

President Salva Kiir has blamed the bloodshed on a coup bid by his perennial rival Machar, who says the alleged overthrow was a fabrication to cover up a regime purge.

Machar denies coup