The UN's top human rights official warned South Sudan's leaders that they would be responsible should the "real danger" of famine become a reality.

UN High Commissioner for Human Rights Navi Pillay also said more than 9,000 children have been recruited as soldiers on both sides of the brutal four-month civil war, which has already left thousands dead and more than a million displaced.

"I was appalled by the apparent lack of concern about the risk of famine displayed by both leaders," Ms Pillay told reporters, after meeting with both President Salva Kiir and rebel chief Riek Machar.

"If famine does take hold later in the year - and the humanitarian agencies are deeply fearful that it will - responsibility for it will lie squarely with the country's leaders, who agreed to a cessation of hostilities in January and then failed to observe it themselves while placing all the blame on each other."

Both government and rebel forces are guilty of recruiting children to fight, as well as a string of other abuses.

"More than 9,000 children have been recruited into armed forces by both sides...children have also been killed during indiscriminate attacks on civilians by both sides," she said, speaking in the capital Juba as she wrapped up a three-day visit to the country.

The UN has repeatedly made dire warnings on the extent of the humanitarian crisis, with more than 1.2 million people forced from their homes since fighting began on 15 December, including almost 300,000 civilians fleeing to neighbouring countries.

"The prospect of widespread hunger and malnutrition being inflicted on hundreds of thousands of their people, because of their personal failure to resolve their differences peacefully, did not appear to concern them very much," Ms Pillay said of the rival leaders.

Meanwhile, the UN’s Special Adviser on the Prevention of Genocide has said that South Sudan will not become another Rwanda after touring massacre sites amid a wave of atrocities and ethnic killings in the young nation.

"To the survivors of the genocide, we owe a pledge to take all possible measures within our power to protect populations from another Rwanda, there is no excuse for inaction," Adama Dieng told reporters in the capital Juba.

"It is clear that the conflict has taken a dangerous trajectory, and civilians are being deliberately targeted based on their ethnicity and perceived political affiliation," Mr Dieng, who has served on the International Criminal Tribunal for Rwanda, added.

"South Sudan should not be led down this slippery slope."

"I beseech everyone; the South Sudanese, your leaders, the regional and international community, to take immediate measures to end the violence and uphold our collective responsibility to protect the populations of South Sudan from genocide, war crimes, ethnic cleansing and crimes against humanity."

UN bases have come under attack, and peacekeepers struggled to contained the waves of violence.

UN Secretary General Ban Ki-moon is "strongly concerned, and will make sure that never again what happened in Rwanda happens in another place in this continent," Mr Dieng said, adding that "the world is watching."