Fear gripped Nigeria's northeastern city of Maiduguri on Saturday with many men fleeing after the alleged execution style killings of around 40 young men, mostly teenagers, who residents said were rounded up and shot.

"All male residents have left the neighbourhood.... Those that remain are women, children and elderly men," said resident Fatima Mustapha.

The city is the stronghold of an insurgency by Boko Haram Islamists, blamed for the death of hundreds of people in northern and central Nigeria since 2009.

"The neighbourhood has been under siege since yesterday (Friday) with soldiers taking over the entire area," said Mustapha, a resident of the Gwange area where a retired army general, Mohammed Shuwa, was shot dead on Friday.

She said the men had fled fearing a heavy handed military response to the murder of the general who was being buried on Saturday.

A military source on Friday declined to comment on Thursday's killings saying only that if such shootings had taken place, they would have been "unjustified".

The killings came on the same day that Amnesty International accused Nigerian security forces of massive rights violations, including summary executions, in its campaign to crush the Islamists.

Residents said troops conducting raids in areas of Maiduguri on Thursday separated males in their teens and twenties from older men and shot them.

In the Kalari neighbourhood they told the young men "to lie face down on the ground," then asked the rest to look away, one resident said.

"All we heard were gunshots. They shot them on the spot," said the elderly religious leader, who did not want to be named, adding that the troops did the same in three other neighbourhoods.

Most Maiduguri residents were on Saturday shut up at home.

Residents spoke of a heavy military presence in many areas of the city.

Sheu Aliu said the fear of new attack either by Boko Haram or soldiers had created a sense of panic.

"You can't say when the next gun or bomb will go off. This is why it is wise to remain in your house. There is fear everywhere," he said.

Another resident, teacher Adamu Abu, said he preferred to remain indoors especially at weekends due to his fear of attacks.

"From antecedents of the sect (Boko Haram), they usually strike by weekend and for me, it is safer not to venture into going out," he told AFP.

"My wife does the shopping on Thursdays and nobody goes out again until Monday because you can either be hit by stray bullets during an encounter between Boko Haram and soldiers or be a victim of attacks by the sect," he said.

The military spokesman, Sagir Musa, described the presence of soldiers as normal.

"There is nothing unusual about the patrol by our men. Our normal stop and search is still in force and it is the usual thing in this situation," he said.

Meanwhile, three people, including a fire service chief, were shot dead on Friday in the town of Damboa, south of Maiduguri.

"A group of gunmen set fire to the Damboa local government secretariat and a nearby 20-unit housing estate built by the state government," a police officer who did not want to be named told AFP.

He said as the fire service mobilised to extinguish the blaze gunmen appeared from nowhere and opened fire on them.

"It is not clear who was behind the attack. But from all indications, it was the handiwork of Boko Haram," the police officer added.

Boko Haram's insurgency in northern and central Nigeria and the state's military response are believed to have left more than 2,800 people dead since 2009.

The group has claimed to be seeking an Islamic state in Nigeria, though its demands have repeatedly shifted.

Nigeria, Africa's most populous nation and largest oil producer, is divided between a mainly Muslim north and predominantly Christian south.

[Image via Agence France-Presse]