Secretary-General Ban Ki-moon fired the commander of the peacekeeping force in South Sudan on Tuesday after an independent investigation sharply criticized the military response to deadly attacks in July on a U.N. compound housing 27,000 displaced people.

BLOOD AND WAR: HOW A UNITED NATIONS AGENCY COOPERATES WITH ASSAD

U.N. spokesman Stephane Dujarric announced the dismissal of Kenyan Lt. Gen. Johnson Mogoa Kimani Ondieki shortly after the investigators' report was released, saying the U.N. chief was "deeply distressed" by the findings.

South Sudan, the world's youngest country, has been riven by ethnic violence since shortly after gaining its independence from Sudan in 2011. Civil war broke out in 2013 when government forces loyal to President Salva Kiir, an ethnic Dinka, battled rebels led by his former vice president Riek Machar, who is a Nuer. A peace agreement was signed in August 2015, but fighting, that has left tens of thousands dead and more than 2 million displaced, continues.

A confidential U.N. report obtained by The Associated Press in September said the deadly fighting in July was directed by the highest levels of Kiir's government. Among the targets were the U.N. peacekeeping base known as UN House and the adjacent camp where some 27,000 displaced civilians, who are Nuer, had sought safety and the Terrain Camp, a private compound just 0.6 miles away where U.N. staff, aid workers and local staff were housed.

RUSSIA VOTED OFF UNITED NATIONS HUMAN RIGHTS COUNCIL

The report said "a lack of leadership on the part of key senior mission personnel culminated in a chaotic and ineffective response to the violence" at UN House and the compound for displaced civilians.

"The force did not operate under a unified command, resulting in multiple and sometimes conflicting orders to the four troop contingents from China, Ethiopia, Nepal and India, and ultimately underusing the more than 1,800 infantry troops at UN House," it said.

In three days of fighting in July, at least 73 people were killed including more than 20 internally displaced people who had sought U.N. protection. Two Chinese peacekeepers were among those killed and several were wounded; 182 buildings on the UN House compound were struck by bullets, mortars and rocket-propelled grenades, and thousands of internally displaced people fled into UN House, the report said.

The report said confusing senior leadership and the lack of leadership on the ground, where the Chinese battalion commander had been appointed as the incident commander, "contributed to incidents of poor performance among the military and police contingents at UN House."

This included "at least two instances in which the Chinese battalion abandoned some of its defensive positions" and an "inadequate" performance by Nepalese police to stop looting inside UN House by some displaced people and control the crowd, it said.

The investigators also criticized the U.N. mission and its peacekeepers for failing to respond to the attack on the Terrain Camp, where U.N. staff, aid workers and local staff were robbed, beaten, raped and killed by armed soldiers.

The report said peacekeepers and international police were "risk-averse."

The investigators, led by retired Dutch Maj. Gen. Patrick Cammaert, recommended that "peacekeepers, commanders and relevant troop contributing countries should be held accountable for failures to protect" civilians.

Dujarric, the U.N. spokesman, told reporters that Ban asked "for the immediate replacement of the force commander."