Nigeria’s military has said it has restored order after Boko Haram fighters took control of a town in the country’s remote north-east, sparking fears about the group’s resurgence.

Scores of jihadists believed to be loyal to a faction backed by Islamic State overran troops in Gudumbali on Friday, according to local officials and security sources.

At least eight civilians are thought to have been killed and thousands were more forced to flee, in the extremists’ first major seizure of a town in two years.

It followed a series of deadly attacks on troops, which have called into question repeated government and military claims that Boko Haram is weakened to the point of defeat.

A Nigerian army spokesman, Brig Gen Texas Chukwu, said on Saturday he was “not aware” of the attack but on Sunday confirmed the incident.

“The encounter took place when the insurgents attacked the community, set some buildings ablaze and quickly withdrew from the community,” he said. “However, no human casualty was recorded in the encounter. The troops have regrouped and normalcy has been restored. The troops have also been reinforced with additional troops to dominate the general area.”

Nigeria’s military regularly trumpets its apparent successes against Boko Haram and has strongly denied previous reports of army casualties in attacks.

There was no independent verification of Chukwu’s claim, as access to areas outside the Borno state capital, Maiduguri, is tightly controlled by the military.

Nine years of conflict has claimed at least 20,000 lives in north-east Nigeria and also destroyed telecommunications infrastructure in rural areas.

Profile Who are Boko Haram? Show Commonly known as Boko Haram, the Islamic State in West Africa is a terrorist organisation based in Northeast Nigeria. Formed in 2002 as Jamā'atu Ahli is-Sunnah lid-Da'wati wal-Jihād meaning “Group of the people of Sunnah for Dawa and Jihad”, the term Boko Haram is loosely translated as ‘Western education is forbidden’ or ‘Western influence is a sin’. Boko Haram started an armed rebellion against the Nigerian government in 2009. Their activities have included suicide bombings and the kidnapping of female students from a college in Chibok in 2014. A mass prison break-out in 2010 swelled their ranks. Their insurgency has also spread into neighbouring Cameroon, Chad and Niger.

In 2015 a coalition of troops from those three countries, alongside Nigerian forces, mounted a concerted effort to push back against Boko Haram. For their part, since 2015, Boko Haram has aligned itself with Islamic State. The UN estimates that at least 20,000 people have been killed in the conflict to date, but that is widely held to be far below the true number. At the peak of its strength it held territory equal to the size of Belgium Nigeria’s President Muhammadu Buhari and his generals have repeatedly declared that they have “beaten”, “defeated”, “technically defeated”, “routed” and “broken the heart and soul” of Boko Haram. Studies suggest casualties have dropped drastically in recent years. But the suicide bombings, child abductions and displacement of the local population continues. Estimates of the group’s strength vary between 4,000 and 20,000 fighters, and the number of people who have fled Boko Haram’s territory in the Lake Chad Basin is thought to be in the order of 2.4 million.

Gudumbali is in the Guzamala area of Borno and one of a number of places where people displaced by the long-running conflict have been encouraged to return.

Aid agencies dealing with the humanitarian effects of the insurgency believe the returns are being dictated by politics, with elections scheduled for February next year.

President Muhammadu Buhari, who was elected in 2015 on a promise to defeat Boko Haram, is hoping to secure a second four-year term.

He first said Boko Haram was “technically defeated” in late 2015 and recently said Borno was in a “post-conflict stabilisation phase”, despite the continued attacks.

The Islamic State West Africa Province (ISWAP) faction broke away in 2016 because of the long-time Boko Haram leader Abubakar Shekau’s indiscriminate targeting of civilians.

ISWAP is believed to be trying to get the support of local people in the Muslim-majority region by attacking only government and military targets.

Chukwu called for people to “remain calm and resilient” but also to be aware of “strange faces, to prevent fleeing Boko Haram terrorists from infiltrating and hibernating in their communities”.