ABIDJAN (Reuters) - Gunmen attacked military bases in Ivory Coast’s main city of Abidjan and the northern city of Korhogo in the early hours of Saturday, but were repulsed, a senior military official said.

Three military sources blamed demobilized former rebel fighters - forces caught up in years of instability in Francophone West Africa’s most important economy - though no group claimed responsibility.

“There was an attack overnight at Abobo (north Abidjan), but there were no deaths. In Korhogo, three of the assailants were killed,” Colonel Zakaria Kone, commander of the Abobo camp, told Reuters by telephone. “The situation is now calm.”

He added that a police station in Abobo was also attacked, saying he did not know who had done it or for what motive.

The three military sources in the northern city of Bouake, which sent reinforcements to Korhogo, said the attackers were demobilized fighters from former rebels who controlled the north of the country during Ivory Coast’s crisis from 2002 to 2011.

During that period, northern rebels hostile to then president Laurent Gbagbo seized half the country. An election meant to end the crisis instead triggered a short civil war when Gbagbo refused to concede to President Alassane Ouattara.

Sporadic unrest since then has revealed just how precarious security still is in Ivory Coast, the world’s leading cocoa producer, six years since the war killed thousands of people.

Security has been particularly tense since soldiers made up mostly of former rebels that had backed Ouattara during the crisis mutinied in January. The 8,400 troops involved demanded bonuses they claimed they were owed and were partly paid in order to put it to rest.

But they mutinied again in May, and were paid the remainder of what they had demanded in a deal that risks both angering other factions in the military and encouraging other former rebel fighters to take up arms.

About a week after the mutiny ended, three demobilized ex-rebel fighters were killed in Ivory Coast’s second-biggest city of Bouake, as they clashed with police attempting to end a separate protest over bonus payments.

President Ouattara’s grip on the military and other former rebel fighters is tenuous and many fear that power struggles around a 2020 election to replace him could easily erupt into more violence and instability.

“The soldiers are patrolling everywhere in the town to ensure there is nothing else suspect,” said Korhogo resident Adama Coulibaly.