JUBA, South Sudan — Heavy gunfire erupted outside the compound of South Sudan’s president Friday as Salva Kiir was preparing to address the nation on the latest deadly fighting in the capital, Juba, that has sparked fears of a return to civil war.

Fighting continued Friday night outside a U.N. base sheltering thousands of civilians, and one displaced person said that a few had been hit in the crossfire. People lay on the ground to avoid the bullets, he said.

The gunfire began when Kiir and First Vice President Riek Machar, the former rebel leader, were meeting about a clash among opposing army factions the previous night. They told reporters they did not know what was happening outside. Panicked residents struggled to determine who was shooting.

Both Kiir and Machar urged calm, and Machar said “measures will be taken so that peace is restored even to the heart of the city,” South Sudan’s Radio Tamazuj tweeted. Kiir and Machar were safe, Machar’s chief of staff, Ezekial Lol Gatkuoth, said later.

The gunfire came a day after five South Sudanese government soldiers were killed in a shootout between opposing army factions in the capital.