Boko Haram fighters have killed 21 people in attacks near the northern village of Chibok, according to a military source, as the armed group suffers major setbacks from a growing regional offensive.

The rebels were fleeing a land and air offensive to clear them out of the Sambisa forest when they raided the villages of Gatamarwa, Makalama and Layhawul and opened fire on residents on Friday, the source said.

Boko Haram fighters in many parts of Nigeria and the region are on the run, after being subjected to a major military offensive on all sides by Nigeria and its neighbours Chad, Cameroon and Niger.

Nigerian warplanes bombarded Boko Haram's training camps and caches of their weapons and vehicles in Sambisa on Thursday.

But when the armed group feels threatened, the civilian population often becomes a target. The security source said the fighters fleeing the Sambisa operation had taken revenge on the civilian population.

"They surrounded the market and started shooting," said Chibok resident and farmer Maina Chibok, who visited the Gatamarwa area afterwards. "There was pandemonium everywhere and more than 10 people were killed."

For most of the past year, Boko Haram has been gaining strength, seizing territory the size of Belgium and kidnapping hundreds of people, mostly women and children.

Pushed back

But victories against them have gathered pace in the past three weeks.

Nigeria's neighbours, where Boko Haram used to flee, are pursuing a strategy of pushing them back into Nigeria.

Colonel Moussa Barmou of Niger, the coordinator of the joint Niger-Chad mission, told the state-owned Le Sahel newspaper that operations had "dismantled all the supply and recruitment networks of the terrorist group" in Niger, the most obvious path of retreat for Boko Haram into the Sahara if Cameroon and Chad keep up the pressure.

"There remains much to do ... but slowly, we are getting there," he said. "There are still some pockets to flush out."

The attacks triggered global outrage and President Goodluck Jonathan, who faces an election on March 28, was pilloried for his perceived slow response to the crisis.

The crisis has also spawned more than a million internal and external refugees, who have trekked through deserts, crossed rivers and hidden in forests to escape to the relative safety of ever swelling refugee camps.