French and Malian government forces have regained control of the strategic northern city of Gao after Islamic fighters tried to retake it.

Hundreds of residents gathered around the heavily damaged police headquarters building in the centre of the city where body parts lay strewn about a day after al Qaeda-linked militants launched a surprise attack on the city.

"We heard the gunfire and hid in our homes all evening," said Soumayla Maiga as he stood with his friends near the rubble of the police offices. "We were stunned when we came out and saw what happened."

The radical Islamic fighters, who had ruled Gao for nearly 10 months before they were thrown out at the end of January, returned to the city by crossing the Niger River in boats to launch their assault on Sunday. The fighting lasted more than five hours.

The walls and ceiling inside the police building were heavily stained with blood and the damage was consistent with an explosion, suggesting a suicide bomber blew himself up in the police offices.

Two civilians died from gunshot wounds, while 10 others were wounded, the local hospital confirmed. The body of a third man was taken away later.

Residents said he had been hit by a stray bullet while riding by on his motorcycle.