Witnesses said heavy gunfire erupted outside the compound of South Sudan's president Friday evening as Salva Kiir was preparing to address the nation on the latest deadly fighting in the capital.

South Sudan TV urged residents to "be calm and stay in your house. ... The security is well-maintained in this country."

Five South Sudanese government soldiers were killed in a shootout late Thursday between opposing army factions in the capital, a military official said Friday, amid fears of a return to civil war in the world's newest country. The U.N. mission also reported an attack on a senior official.

The violence echoed the skirmish between soldiers in Juba in December 2013 that sparked the country's civil war in which tens of thousands of people were killed.

Late Thursday, a convoy of soldiers loyal to former rebel leader and sitting First Vice President Riek Machar opened fire on a checkpoint in Juba manned by troops from President Salva Kiir's faction, said Lul Ruai Koang, a spokesman for government troops. Koang said five soldiers were killed.

"We returned fire but it was limited fire," he said.

But Machar's faction accused Kiir's soldiers of firing on an opposition convoy as it approached the checkpoint in the Gudele area of Juba. Two soldiers from his side were wounded, said William Gatjieth, a spokesman for Machar's group.

The new fighting comes just before South Sudan marks its fifth independence anniversary on Saturday.

Separately, the U.N. mission reported an "indiscriminate shooting attack on a senior United Nations agency official" on Thursday evening in the Tomping area of Juba. The U.N. statement urged South Sudan authorities to investigate.

A U.N. source identified the U.N. official as Salah Khaled, the UNESCO country director. The source insisted on speaking on condition of anonymity for fear of retribution from security forces in Juba.

South Sudan's opposing army factions have been stationed in Juba since April, part of a peace deal signed last year to unite the warring sides. They are meant to hold joint patrols to keep peace in the city, but they have yet to work together in Juba and remain stationed in separate areas.

South Sudan is at risk of returning to full-scale war because the two sides are not showing willingness to implement security arrangements, the conflict research group International Crisis Group warned last week.

In a statement Friday, the Joint Monitoring and Evaluation Commission that monitors the cease-fire said the recent fighting in many parts of the country could be in "flagrant violation" of the peace deal, and it said security in the capital was "deteriorating."

As a result of the rising tensions in Juba, international organizations have limited their movements in recent days. The U.N. mission said it had stepped up patrols around its base but would not increase patrols in the capital.

"The danger all along is with so many soldiers in this so-called demilitarized city of Juba that some kind of spark could set the whole thing off," said John Young, a South Sudan expert with the Geneva-based Small Arms Survey research group.