French and Malian troops have clashed with Islamists on the streets of Gao, as fighting showed little sign of abating weeks before France plans to start withdrawing some forces.
Reuters reporters in Gao in the country's desert north said French and Malian forces fired at the mayor's office with heavy machineguns after Islamists were reported to have infiltrated the Niger River town during a night of explosions and gunfire.
French Defence Minister Jean-Yves Le Drian told a news conference in Brussels that Gao was back under control after clashes earlier in the day.
"Malian troops supported by French soldiers killed five jihadists and the situation is back to normal," he said.
In Kidal, a remote far north town where the French are hunting Islamists, residents said a car bomb killed two. A French defence ministry source reported no French casualties.
French troops dispatched to root out rebels with links to al Qaeda swiftly retook northern towns last month. But they now risk being bogged down in a guerrilla conflict as they try to help Mali's weak army counter bombings and raids.
"There was an infiltration by Islamists overnight and there is shooting all over the place," Sadou Harouna Diallo, Gao's mayor, told Reuters by telephone earlier in the day, saying he was not in his office at the time.
Gao is a French hub for operations in the Kidal region, about 300km northeast, where many Islamist leaders are thought to have retreated and foreign hostages may be held.
"They are black and two were disguised as women," a Malian soldier in Gao who gave his name only as Sergeant Assak told Reuters during a pause in heavy gunfire around Independence Square.
Six Malian military pickups were deployed in the square and opened fire on the mayor's office with the heavy machineguns. Two injured soldiers were taken away in an ambulance.
French troops in armoured vehicles later joined the battle as it spilled out into the warren of sandy streets, where, two weeks ago, they also fought for hours against Islamists who had infiltrated the town via the nearby river.
Helicopters clattered over the mayor's office, while a nearby local government office and petrol station was on fire.
A Gao resident said he heard an explosion and then saw a Malian military vehicle on fire in a nearby street.
Paris has said it plans to start withdrawing some of its 4,000 troops from Mali next month. But rebels have fought back against Mali's weak and divided army, and African forces due to take over the French role are not yet in place.
Islamists abandoned the main towns they held but French and Malian forces have said there are pockets of Islamist resistance across the north, which is about the size of France.
Residents reported a bomb in the east of Kidal on Thursday.
"It was a car bomb that exploded in a garage," said one resident who went to the scene but asked not to be named.
"The driver and another man were killed. Two other people were injured," he added.
A French defence ministry official confirmed there had been a car bomb but said it did not appear that French troops, based at the town's airport, had been targeted.
Earlier this week, a French soldier was killed in heavy fighting north of Kidal, where French and Chadian troops are hunting Islamists in the Adrar des Ifoghas mountains, which border Algeria.
Operations there are further complicated by the presence of separatist Tuareg rebels, whose rebellion triggered the fighting in northern Mali last year but were sidelined by the better-armed Islamists.
Having dispatched its forces to prevent an Islamist advance south in January, Paris is eager not to become bogged down in a long-term conflict in Mali. But their Malian and African allies have urged French troops not to pull out too soon.