French and Malian troops have fought rebel fighters on the streets of Gao, and a car bomb has exploded in Kidal as fighting shows little sign of abating weeks before France plans to start withdrawing some forces.
Reuters reporters in Gao in the country's desert north said on Thursday that French and Malian forces fired at the mayor's office with heavy machine-guns after fighters were reported to have infiltrated the Niger River town during a night of explosions and gunfire.
Jean-Yves Le Drian, the French defence minister, said 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 fighters, residents said a car bomb killed two.
A French defence ministry source reported no French casualties.
French troops dispatched to root out fighters 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 the Reuters news agency 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 rebel leaders are thought to have retreated and foreign hostages may be held.
French troops in armoured vehicles joined the battle as it spilled out into the warren of sandy streets, where two
weeks ago they also fought for hours against fighters 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.
France has said it planned 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.
The fighters abandoned the main towns they held, but French and Malian forces have said there are pockets of resistance across the north, which is about the size of France.
Residents reported a bomb in the east of Kidal earlier on Thursday.
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.