The Kenyan presidency condemned the decision to dismiss Lt. Gen. Johnson Mogoa Kimani Ondieki as unfair and said it would withdraw its troops from the UN mission in South Sudan.
Ban Ki-moon dismissed the head of the UNMISS after a report said it had failed to protect civilians in July.
The report said peacekeepers did not act when soldiers attacked an aid compound in the capital, Juba.
Thousands of UN peacekeepers have been deployed to South Sudan since the country gained independence from Sudan in 2011. Tens of thousands have been killed and more than 2 million displaced since the fighting began.
Ethiopia, Kenya and Sudan are the three countries that brokered a peace agreement last August to end the South Sudanese crisis.
The security situation in South Sudan has been of concern to countries in the Horn of Africa region and the withdrawal of Kenya’s over 1000 strong contingent will affect the already volatile security situation.