United Nations peacekeepers from Rwanda wait for orders at the UN Mission in South Sudan (UNMISS) base in Malakal, South Sudan on Thursday. (Jane Hahn/For The Washington Post)

The dead were being counted in South Sudan’s capital on Thursday, days after U.N. bases fell under fire and swaths of the city turned into an urban battlefield. The civil war, it appeared, had returned to the capital city of Juba.

Even though the fighting that tore through the capital last weekend had mostly stopped by Tuesday, many of the 45,000 people who fled the clashes searched for food and water, often without success. The United Nations had reached a critical shortage of basic aid supplies, officials said. Fear of continued fighting left markets bare and provisions scarce.

In the wake of yet another surge of violence, the fate of the government and the international humanitarian mission here were thrown into question.

Just months ago, the country’s most prominent leaders, President Salva Kiir and Vice President Riek Machar, signed a peace deal that was meant to put an end to more than two years of fighting between their forces. It fell apart last Friday when their soldiers shot at each other outside the presidential palace, where both Kiir and Machar had come for a news conference.

That clash sparked a larger battle that left nearly 300 dead, according to government figures, including 33 civilians. But U.N. officials and aid groups said they believed the death toll was higher.

Zlatko Gegic, Oxfam’s South Sudan country director, said in an interview from Nairobi that he had seen photos of bodies piled on the streets of Juba and doubted the official death toll.

“I hope the number will not reach 1,000 or more, but we may never know,” he said. “Relatives are collecting the bodies and burying them before they can be counted.”

Deepmala Mahla, the South Sudan country director for the aid group Mercy Corps, said there was a worrying lack of food and water for residents who had fled their homes in fear.

“At one camp, Kator, in Juba, there are 10,000 people and 6,000 of them are children. Mothers are telling us their children haven’t eaten in days. It is just too difficult to get supplies to these camps,” said Mahla, who was evacuated to Nairobi on Wednesday but is in touch with local staff in Juba.

She said that there was more movement of civilians in Juba in recent days and fewer military checkpoints, but that the atmosphere was very tense.

The rift between Kiir’s and Machar’s groups is deep, driven by the country’s sometimes ­vicious ethnic politics, as well as a fight for access to the government coffers, including hundreds of millions of dollars in foreign assistance.

Few expected the peace deal to hold, but the recent schism nonetheless stunned the city because of the shocking level of violence and lack of concern for civilian lives or U.N. facilities. There are about 13,000 peacekeepers stationed in South Sudan, and many civilians have sought refu­ge on U.N. bases.

“The question of the day is whether Kiir and Machar have the ability to prevent a return to large-scale conflict,” said Gegic, who was evacuated this week. “The future is very hard to predict for us.”

What is predictable, to an extent, is the weather. South Sudan is in its wet season, which should last for two more months. The rains render large-scale troop movements difficult, analysts say, as the rough track roads that cross the riverine country become muddy and impassable. That means fighting in the near future will likely be limited to cities.

Last weekend, two major U.N. bases in Juba were struck by heavy-weapons and small-arms fire, even as thousands of civilians were running toward them for safety. At least two Chinese peacekeepers were reported killed.

Government leaders from Kiir’s side claimed that the United Nations was knowingly harboring opposition fighters and said that was one of the reasons the compounds were struck.

“The U.N. will say what it wants, but it knows that there are [opposition] fighters there,” Martin Lomuro, South Sudan’s minister of cabinet affairs, said in a telephone interview on Thursday. The United Nations denies taking sides in the conflict.

South Sudan became independent from Sudan almost exactly five years ago, after a referendum that was lauded by the international community, even as signs of internal fractures emerged in the country’s leadership. In late 2013, the country exploded into civil war that took on ethnic overtones between the Dinka tribe, to which Kiir belongs, and the Nuer, Machar’s tribe.

Tens of thousands were killed.

While both Kiir and Machar have said they still back the peace process, many here are worried that the cycle of violence could repeat itself, with battles spreading outside the capital.

In recent days there has been fighting in Leer, a small city in northern Unity state that is Machar’s home town. Fighting also escalated in Eastern Equatoria state, and aid groups were forced to suspend their work there. Although those clashes appeared to be limited, other cities waited nervously as rumors swirled that Machar’s men were moving north.

In parts of the country, the tension between factions is grounded in local feuds, often over land rights. The town of Malakal, for example, changed hands roughly a dozen times during the course of the civil war and is now controlled by Dinkas. But leaders of a third ethnic group, the Shilluk, who are loosely aligned with Machar’s Nuer forces, have vowed to take it back.

The U.S. government played an integral role in the country’s creation and has been at the center of post-independence peace negotiations. The U.S. government is the largest provider of aid to South Sudan, and Machar’s wife is an American citizen, both of which give the United States extra leverage if it decides to impose new sanctions. But some analysts say that U.S. officials have failed to realize the intensity of the hostility between the country’s leaders.

“The U.S. engaged in a bit of wishful thinking: They arranged a shotgun marriage between two men with a history of animosity towards each other,” said J. Peter Pham, the director of the Atlantic Council’s Africa Center.

American officials say privately that they have become increasingly frustrated with the two South Sudanese leaders. The State Department has expressed “grave concern” about the fighting and called on Kiir and Machar to instruct their forces to refrain from violence.

Several months ago, the United Nations brokered an agreement allowing 1,300 of Machar’s troops back to Juba, which was seen as a move toward peace. But it was that same force that participated in the week’s fighting. South Sudanese officials on both sides of the divide have said that the agreement that mandated that both forces have a presence in Juba only made the city a tinder keg.

“You can’t unite two forces that have no trust, that do not share commands,” said Deng Dau, a member of parliament. “The agreement created many unresolved issues.”

Bearak reported from Washington.