Boko Haram militants have killed 24 people, mostly women, as they mourned at a funeral in a village in northern Nigeria, looting and burning their houses down.

Suspected Boko Haram militants also attacked a village in Niger while a delegation of ministers was visiting, killing seven police officers and wounding 12 in a gun battle.

Some women were still missing after Thursday’s attack on the village of Kuda in Nigeria’s Adamawa state, according to a resident, Moses Kwagh. Maina Ularamu, a local community leader, said the attack occurred during the “mourning celebration” for a local leader.

“They came on motorcycles and opened fire on the crowd, killing 24,” he said. “Most of the victims were women. They looted food supplies and burnt homes and they left almost an hour later.”

A police spokesman, Othman Abubakar, put the death toll at 18, adding that many more were injured. “Our people who fled their homes to escape Boko Haram attacks have been returning because they can’t live in the camps. But now they are facing threats from Boko Haram who launch nocturnal attacks,” he said.

Ularamu said that although Boko Haram had been chased out of the nearby town of Gulak, militants still lived in the villages surrounding it.

Boko Haram threatened to overrun Adamawa state in 2014, sweeping down from their stronghold in Sambisa forest, which lies just across the border in Borno state. That attack, which destroyed bridges and homes on the only road south to Yola, forced tens of thousands of people to flee from their homes into camps and host communities in the state capital.

The militants are well known for kidnapping schoolgirls in northern Nigeria but have been largely driven out of Adamawa state by a military counter-offensive that began in January 2015. Since then, there has been relative calm despite sporadic attacks in the north of the state.

The last attack in Adamawa was on 9 January, when seven people were killed and two others injured in a raid on Madagali. Two female suicide bombers blew themselves up at a market in Madagali on 28 December, killing 30, just days after the Nigerian president, Muhammadu Buhari, declared the Islamists “technically” defeated.

But the latest attacks show that the rebels, who want to create a hardline Islamic state in north-east Nigeria, still have the capacity to strike. At least 20,000 people have been killed and more than 2.6 million people forced from their homes since the insurgency began in 2009.