ABIDJAN, Ivory Coast — Negotiations on Saturday appeared to have averted a protracted standoff between soldiers and the government in a military revolt in Ivory Coast, a country that has prided itself on political and economic stability in recent years.

President Alassane Ouattara said late in the day that the government had reached an agreement with disgruntled soldiers who had demanded higher salaries and better living conditions. But Mr. Ouattara criticized the soldiers for the way they had protested.

“I want to say that this way of making demands is not appropriate,” Mr. Ouattara said. “In fact, it tarnished the image of our country after all our economic development efforts.”

According to witnesses, gunfire erupted early on Saturday at a military camp known as “old Akouedo” in a residential area of Abidjan, Ivory Coast’s largest city and its economic capital.