The Nigerian army said on Thursday it was in "full control" of a northeastern town where sources say hundreds of people have been taken hostage by jihadists.
Islamic State West Africa Province (ISWAP) fighters stormed the town Kukawa on Tuesday and seized hundreds of residents who had only just returned after fleeing their homes for nearly two years, according to locals and militia sources.
"The terrorists on 18 August 2020 attacked troops' location in Kukawa town in Borno state where the attack was vehemently thwarted," defence spokesman John Enenche said in a statement.
"The situation in Kukawa is now calm with troops in full control," he said.
Kukawa's residents had returned to their homes on August 2 under military escort, on the orders of the state government.
They had been living in camps in the regional capital Maiduguri, 180 kilometres (120 miles) away, where they fled following a bloody attack in November 2018.
"The attack by the terrorists was... a deliberate attempt to reverse the milestone achievements recorded regarding IDPs (internally displaced persons) in the areas of peace building, reconstruction, rehabilitation and resettlement efforts by the government," Enenche said.
Three soldiers lost their lives, two wounded while eight insurgents were killed during the gunbattle with the jihadists, he added.
The decade-long jihadist conflict in northeastern Nigeria has forced around two million people from their homes, mostly in the northern part of Borno.
Many have moved into squalid displacement camps in Maiduguri and rely on handouts from international charities.