Kenya has announced it is withdrawing troops from a UN peacekeeping mission in South Sudan (Unmiss). The move followed UN Secretary-General Ban Ki Moon's decision to fire the head of the mission, Kenyan Lieutenant General Johnson Mogoa Kimani Ondieki.

The dismissal came after a UN probe concluded Unmiss failed to protect civilians during deadly violence in the capital Juba in July due to "a lack of leadership on the part of key senior mission personnel".

"What is clear is that Unmiss suffers from fundamental structural and systemic dysfunctionality, which has severely hindered its ability to discharge its mandate since its inception," the Kenyan ministry of foreign affairs said in a statement.

"Regrettably, instead of addressing these shortcomings directly, the United Nations has instead opted to unfairly attribute them to a single individual, in the name of the Lieutenant General Ondieki."

Deadly clashes erupted between government troops and forces loyal to rebel leader and former vice-president Riek Machar in July. The clashes sparked a three-day-long spate of violence that resulted, among other things, in the rape and killings of civilians and aid workers and failure to implement a peace deal signed in August 2015.

The UN conducted the probe after witnesses and rights groups alleged peacekeepers had not intervened when government troops assaulted civilians.

It is not clear how many Kenyan soldiers are part of the 13,000-strong peacekeeping missions.

Kenya, along with Ethiopia and Sudan helped brokered the August 2015 peace deal to end war in South Sudan.

South Sudan war

South Sudan became the world's newest nation after declaring independence from Sudan in 2011. In 2013, the country was plunged into civil war, as President Salva Kiir – of the Dinka ethnic group – fired his deputy Machar – from the Nuer group – and his cabinet.

Ethnic-related violence spread, with militia groups carrying out attacks in villages and areas known to be inhabited by either the Dinka or Nuer tribes.

An estimated 50,000 people have been killed, hundreds of thousands are either facing starvation in the country or have fled, amid allegations of crimes against humanity committed by both sides, including rape, torture and the use of child soldiers.

Kiir and Machar have agreed on several peace deals – the last of which was signed in August 2015 – but have failed to control their troops, who have broken every ceasefire signed since 2014.

The two leaders are facing increasing accusations of failing to commit to the latest peace agreement and continuing their rivalry in spite of the ravaging civil war.

After fleeing South Sudan following deadly fighting in Juba in July, Machar was replaced by Taban Deng Gai. The rebel leader, who is now believed to be in South Africa, has been calling for an armed struggle against Kiir's government.