Ivory Coast's government has struck an agreement with mutinous soldiers, shortly after talks were interrupted by gunfire.
Shots were heard in the second-largest city, Bouake, late on Friday, and at the army barracks in the commercial capital, Abidjan, sparking fears that negotiations were failing.
The two sides met for hours in Bouake before reaching a deal.
It resolves a pay dispute that sparked a two-day uprising last week.
Last week's mutiny was calmed when the government agreed to the military's demands, but the terms were still in dispute.
A negotiator for the military said the renewed gunfire stemmed from fears that the government was going back on an agreement to pay the soldiers' bonuses.
About 8,000 soldiers were promised 12m CFA francs ($19,300) each, but none of this money had so far been paid.
"We've reached an agreement. They will pay 5m on Monday and the rest each month," Sergeant Mamadou Kone, one of the mutineers' negotiators, told Reuters news agency.
"We haven't finished up, but that's the most important thing."
Earlier on Friday evening, hundreds of soldiers surrounded the building in Bouake where talks were taking place, and fired weapons in the air.
Defence Minister Alain-Richard Donwahi was inside, having flown back into the city earlier in the day to lead negotiations.
Mr Donwahi was briefly held hostage by the military earlier this week.
President Alassane Ouattara appealed for calm following the mutiny, and dismissed the heads of the army, police and paramilitary gendarmes.
The mutiny began in Bouake a week ago, with soldiers firing rocket launchers.
Protests also took place in the cities of Man, Daloa, Daoukro, Odienne and Korhogo, and, the following day, soldiers took over the army headquarters in Abidjan.
President Ouattara went on national television on Sunday to announce a deal had been struck.
"I confirm that I have agreed to take into account the demands of the soldiers over bonuses and better working conditions," he said.
Aside from better pay, the agreement was reported to include an amnesty for the mutineers.
The mutiny raised fears of a resurgence of the violence seen during Ivory Coast's 10-year civil war, which ended in 2011.
Some of the mutineers were thought to be former rebels who joined the army after the conflict.