UN refugee agency said up to 65,000 people had fled the northeastern Nigerian town of Damasak following the latest militant attack on an army base, which left more than 20 people dead.

A woman walks past burnt vehicles in Damasak, Borno State, Nigeria on April 25, 2017.
A woman walks past burnt vehicles in Damasak, Borno State, Nigeria on April 25, 2017. (Reuters)

Tens of thousands of people have fled the northeastern Nigerian town of Damasak following militant attacks that killed more than 20 people, local officials and the UN said.

Fighters from the so-called Islamic State West Africa Province (ISWAP) stormed the town in Borno state three times in a week to strike a military garrison, torching homes, a police station and a UN office.

The attacks have underscored the militants' ability to launch sustained strikes at Nigeria's armed forces, more than a decade into a grinding insurgency.

In the latest violence on Wednesday, militants assaulted the army base before being forced back into Damasak town, where at least 18 people were killed, the local officials and military sources said.

Another four people, including a soldier, were killed in a previous attack. 

READ MORE: Bandits carry out another deadly attack on village in northwestern Nigeria

Damasak's 80% population 'forced to flee'

The UNCHR said up to 65,000 people had fled.

"Following the latest attack on Wednesday 14 April, the third in seven days, up to 80 percent of the town's population – which includes the local community and internally displaced people – were forced to flee," UNHCR spokesperson Babar Baloch said.

Some have fled towards the regional capital Maiduguri and other nearby towns while others have crossed the border into Niger's Diffa region, itself vulnerable to jihadist violence.

"Due to insecurity, however, humanitarian access is increasingly challenging in many parts of Nigeria's Borno State, including for UNHCR staff, who were forced to temporarily relocate out of Damasak in the past seven days," the UNHCR said.

The UN humanitarian coordination office said armed groups had been conducting house-to-house searches, reportedly looking for civilians identified as aid workers.

Nigeria's army dismissed reports militants had overrun Damasak and said on Thursday troops were in control of the area.

READ MORE: Nigeria steps up efforts to rescue dozens of kidnapped students

Spilling over borders

More than 36,000 have been killed and two million displaced by the fighting in Nigeria that has spread into neighbouring Chad, Cameroon and Niger.

In Niger, jihadists struck a town in the Diffa region overnight Thursday, killing a customs officer, a town official said.

Heavily armed assailants arriving in four vehicles hit the customs post, gendarmerie, national guard and police station in Maine-Soroa, about 60 km (35 miles) from Damasak, the source said, speaking on condition of anonymity.

Damasak is host to one of the military's so-called "super camps" – fortified garrisons the army has set up in an attempt to better defend against attacks.

Critics and local residents say the strategy to close smaller bases and pull back into larger camps has left jihadists freer to roam unchallenged in rural areas.

Due to worsening security in the region, humanitarian workers are struggling to provide aid, with the number of people requiring urgent assistance expected to rise to 8.7 million this year. 

ISWAP, which split from the jihadist group Boko Haram in 2016, has become a dominant threat in Nigeria, attacking soldiers and bases while killing and kidnapping civilians.

READ MORE: Several soldiers, militia fighters killed in Nigeria ambush

Source: AFP