UN peacekeepers cowered in their bases rather than risk doing their job of protecting civilians during an outbreak of fighting in South Sudan in July, a rights group said Wednesday.

Some peacekeepers in the capital Juba abandoned their posts inside so-called "Protection of Civilian" sites -- where tens of thousands have sought safety from successive bouts of fighting -- while outside the fortified bases peacekeeper presence was "non-existent".

When foreign aid workers were attacked and some of them gang-raped in a hotel close to a UN base, peacekeepers refused to help.

"The United Nations needs to ensure transparency and accountability for the inadequate response of its peacekeepers," the Washington-based Center for Civilians in Conflict (CIVIC) said in a statement.

CIVIC also called for a UN arms embargo on South Sudan which gained independence in 2011 and was plunged into conflict in December 2013, when President Salva Kiir accused his former deputy Riek Machar of plotting a coup.

A patchily-implemented August 2015 peace deal saw Machar return to the capital earlier this year but fresh fighting between his forces and government soldiers loyal to Kiir erupted in July.

During four days of fighting between the rival forces artillery rounds and gunfire hit two UN bases and two Chinese peacekeepers were killed. Civilians died both inside and outside the UN bases and many women were raped by soldiers outside -- some within sight of UN sentries.

CIVIC said the failings in July were nothing new. The group previously investigated an incident in February when peacekeepers from Ethiopia, India and Rwanda stood by as government soldiers attacked another "Protection of Civilian" site in the northern town of Malakal, killing at least 30 civilians.

Months later the UN admitted to peacekeeper "inaction, abandonment of post and refusal to engage" during the Malakal attack but did not to hold any commanders or troops to account.

CIVIC said the UN Mission in South Sudan (UNMISS) is hampered by "inadequate support" from UN headquarters and has been "repeatedly blocked, harassed, and, at times, even attacked by the parties to the conflict".

Machar is currently exiled in Khartoum from where he has called for "armed resistance" against Kiir's government.