Black-robed Islamic extremists armed with AK-47 automatic rifles invaded Gao in wooden boats on Sunday to launch a surprise attack on the most populous city in northern Mali, two weeks after French and Malian troops ousted the jihadists.

Gunfire echoed for hours across the city of mud-walled buildings. The combat started at about 2pm in downtown Gao and the fighting was continuing as night fell. Later the sound of gunfire was replaced by that of French military helicopters overhead.

The attack in Gao shows the Islamic fighters, many well-armed and with combat experience, are determined and daring and it suggests it will take a protracted campaign by France and other nations to restore government control in this vast Saharan nation in northwest Africa .

The Islamic radicals fought against the Malian army throughout the afternoon and were seen roaming the narrow streets and on rooftops in the centre of Gao, which had a population of 90,000 before the conflict caused thousands to flee.

Families hid in their homes. One family handed plastic cups of water through the locked iron gate to others hiding on their patio. Piles of onions lay unattended where market women fled when the Islamists arrived. There were no signs of civilian casualties in the city.

The fighting appeared to centre near the police headquarters, where Malian soldiers with rocket-propelled grenades traded fire with the combatants, believed to be from the Movement for Oneness and Jihad in West Africa, or Mujao. The only sound in the city was gunfire and the bleating of goats. Soldiers were positioned at every corner in the neighbourhood.

Ever since French forces took Gao on 26 January, the Islamic rebels had clashed with security forces on the city's outskirts. This was the first time they succeeded in entering the strategic city.

The Islamic fighters used pirogues, large wooden dugouts with motors, and other boats to cross the Niger river and penetrate Gao, according to France's General Bernard Barrera, who cited Malian officials as his source.

The Islamic radicals had already tried to spread violence into Gao. On Saturday night, a suicide bomber targeted a checkpoint at the entrance to the city, killing himself and wounding one Malian soldier. An earlier suicide bomber on a motorcycle blew himself up at the same spot on Friday, killing only himself.

Besides Gao, French and Malian forces have also retaken the fabled city of Timbuktu and other northern towns, pushing the Islamic extremists back into the desert, where they pose a constant threat to Malian and allied forces. But the Islamic fighters made strategic retreats and are dug into desert hideouts, from where they are expected to continue challenging the control of the cities by French, Malian and allied forces. Several African nations have contributed troops to battle the extremists, who imposed their harsh version of Islamic sharia law when they controlled the northern cities.

The armed Islamic fighters seized the northern half of Mali in April 2012, sending poorly disciplined and equipped Malian forces retreating in disarray. France launched its military intervention in its former colony on 11 January when the Islamic radicals, many of whom had fought for ex-Libyan leader Muammar Gaddafi, began encroaching on the south, threatening the capital Bamako which lies deep in southern Mali, 1,200km (750 miles) from Gao.

France has said that it wants to hand over responsibility to the Malian military and other African nations who have contributed troops and has raised with the United Nations Security Council the possibility of establishing a UN peacekeeping operation in Mali.

Sunday's open combat and the two suicide bomb explosions have frightened many Gao residents.

Fears of suicide attacks in Gao have been high since the discovery of industrial-strength explosives in the city last week. Four Malian soldiers were killed by a land mine in the town of Gossi, raising fears the militants were planting explosives in the road.

Friday's suicide bomber had been living at a known jihadist hideout in Gao, according to local residents. A guard at the home said that it had been visited three months ago by Moktar Belmoktar, who claimed responsibility for the attack on the BP-operated natural gas plant in Algeria last month.

Other jihadist leaders from Mujao had stayed in the luxurious two-storey home which the militants took over when they captured Gao last year, the guard said.

On Sunday, crowds of nearby residents gathered under the shade of a few trees by the site of the suicide bombing attack. It was the second time in as many days that their homes had been shaken by blasts from suicide bombers.

"I am really afraid. You hear about these kinds of things in Pakistan or Afghanistan," said Maouloud Dicko, 30, as he sat on his motorcycle. "Gao is becoming like Pakistan."