About 50 Islamist militants have been killed in north-eastern Nigeria after the military raided Boko Haram camps, army spokesman Sagir Musa has said.

Troops tracked gunmen who attacked two towns on Wednesday and Thursday, reportedly killing 20 people.

Boko Haram, which wants to create an Islamic state across Nigeria, has waged a deadly insurgency since 2009.

In May, Nigeria declared an emergency in three north-eastern states in order to battle the militants.

‘Invaded from nowhere’

“Troops pursued the terrorists to their camps and destroyed them with air support,” Lt-Col Musa said on Friday in Maiduguri – the state capital of Borno state where Boko Haram was founded.

The operation began on Wednesday after gunmen attacked Gajiram, about 75km (46 miles) north of Maiduguri, when it was crowded with traders for market day.

Buildings were burnt and 15 people died in the market, said residents who fled to Maiduguri.

“Many traders and pupils in the school, including a few council workers at the secretariat complex, took to their heels for safety… We were shocked and terrified,” a Gajiram resident told Nigeria’s Guardian newspaper.

A further five people were killed by gunmen early on Thursday in Bulabilin Ngaura, a small town about 35km south-east of Maiduguri.

“They invaded the village from nowhere. They just opened fire… they killed only five people going to mosque for prayers,” a Bulabilin Ngaura resident told Nigeria’s Leadership paper.

Boko Haram has not commented on the camp raids or town attacks.

Last month, the army said it had killed Boko Haram’s leader Abubakar Shekau but this has not been confirmed and the militants’ attacks have continued.

Since the state of emergency was declared, the military has encouraged the formation of vigilante groups to help tackle the Islamists.

In recent weeks, these vigilantes have been the target of attacks.

Observers says it appears Boko Haram is taking revenge against such groups, adding weight to fears that the vigilante groups may trigger an escalation of the violence.