Hundreds of Islamic extremists posing as soldiers attacked a northeast Nigerian town for hours, killing 39 people and razing a mosque and more than 1,000 homes, survivors said Wednesday.

In the ruins of the burned-out mosque, bodies covered in cloth lay ready for burial Wednesday, including three small shrouds covering children who did not look more than 10 years old.

"Why us? Why us?" one woman wailed, trying to understand why militants set on creating an Islamic state in Nigeria would attack a town of mainly Muslim farmers.

Numerous villages in the area have been attacked and hundreds have been killed in recent months despite a nine-month-long military state of emergency to halt the uprising in three northeastern states covering one-sixth of Africa's biggest oil producer and most populous nation divided almost equally between Muslims and Christians. Thousands have been made homeless and thousands more have fled to other parts of Nigeria and to neighbouring states.

Farmers described Tuesday night's attack to visiting Borno state Gov. Kashim Shettima. They told the governor that about 400 attackers in military camouflage drove in from all directions in apparently stolen army trucks led by an armoured personnel carrier. They called people to them, then opened fire, the survivors said.

The few soldiers and police stationed in the town fled, outnumbered and outgunned, they said.

70 per cent of town destroyed

The extremists arrived at 6 p.m. local time and went from house to house, using homemade bombs to set them ablaze, and Shettima said about 70 per cent of the town was destroyed.

The attackers only fled around 10 p.m. when a military aircraft strafed them into flight, survivors said.

Angry residents asked the governor why it took hours for the military to respond.

The attack occurred at Konduga, an agrarian centre of about 10,000 farmers that is just 35 kilometres and 30 minutes' drive from the Borno state capital of Maiduguri. The city is the headquarters for the military offensive and includes an air force base with bombers.

Shettima told reporters who accompanied him on the trip that the extremists, called Boko Haram, "are better armed and better motivated" than the Nigerian military. He said the soldiers were doing their best but were not as well-equipped.

Shettima told residents he would remain with them until promised food, clothing and other emergency supplies arrived later Wednesday.