At least 20 people were killed when Islamist group Boko Haram attacked a town in northeast Nigeria, triggering clashes with troops stationed there.

A spokesman for Nigerian forces in northeastern Borno state,which lies at the heart of a four-year-old Islamist insurgency, said Boko Haram crept into the town of Damboa in the early hours of Saturday.

They killed five worshippers at a mosque as they said their morning prayers, he said.

"While they were unleashing their mayhem, troops ... engaged the terrorists, killing 15 in the process while others fled,"the military spokesman, Captain Aliyu Danja.

The military often gives significantly higher casualty figures for insurgents than for its own men, and it is usually not possible to verify them independently.

Despite a concerted military offensive meant to crush Boko Haram since May, it remains the biggest security threat to Africa's top energy producer.

Its targets have traditionally been security forces.

Christians or Muslim clerics who speak out against it also have been targets.

But Boko Haram's fighters have increasingly turned their sights on civilians in the past few months.

Hundreds have been massacred in roadside attacks or assaults on Western-style schools they consider sacrilegious.

Nigerian fighter jets last week bombed camps belonging to suspected Islamist militants in northeast Nigeria.

The bombing was in response to a massacre of students at an agricultural college that killed at least 41.