Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

South Sudan has agreed to the deployment of a 4,000-strong regional protection force approved by the U.N. Security Council after first rejecting the peacekeepers as a violation of its sovereignty.

Sunday's announcement came after the Security Council met with South Sudan President Salva Kiir in Juba, the capital, during a rare visit to the turbulent East African country.

South Sudan President Salva Kiir walks with Samantha Power, the U.S. ambassador to the United Nations, and other members of the U.N. Security Council in Juba, South Sudan, on Sunday. Justin Lynch / AP

The threat of an arms embargo loomed over the meeting, as the council has said it would pursue one if South Sudan didn't accept the additional peacekeepers. The U.N. already has 12,000 peacekeepers in the country, and South Sudan has been wary of giving it more authority.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

"The Security Council came to achieve what we have secured," U.S. Ambassador Samantha Power said.

Protecting civilians has become an even more critical issue after fighting erupted in Juba in July, killing hundreds of people and sparking fears of a return to civil war in the already devastated country.

Both civilians and foreigners, including aid workers, were targeted in the July chaos by South Sudanese soldiers who raped women and girls, conducted mock executions and forced people at one hotel compound to watch as a local journalist was shot dead.

Related: Ex-Dutch General to Lead Probe Into South Sudan Attacks

Challenges already lie ahead for the 4,000 additional peacekeepers, who are tasked with protecting civilians in Juba and perhaps beyond. U.N. officials say the new force needs more than two months to deploy.

Senegal's ambassador to the U.N., Fode Seck, said there has been difficulty getting enough troops pledged by regional countries that will make up the force. The council meets with African Union officials in Ethiopia on Monday.

Both government and rebel forces have been accused of widespread abuses in the civil war that began in December 2013 between supporters of Kiir, an ethnic Dinka, and former Vice President Riek Machar, a Nuer. Tens of thousands of people have died.

Ethnic tensions remain. Kiir told council diplomats that the peacekeeping mission's neutrality has been compromised because its camps that shelter tens of thousands of South Sudanese mostly are protecting supporters of the opposition, the U.N. official and council diplomat said.