DAKAR, Senegal — An attack by suspected Islamist militants on motorbikes killed at least 25 soldiers Thursday in the West African nation of Niger, adding to a death toll that has surged in recent weeks as troops struggle to contain violent extremism in the region.

The clash unfolded in the western village of Chinegodar near the border with Mali, according to Nigerien defense officials, as fighters with ties to the Islamic State and al-Qaeda look to seize new swaths of territory.

The bloodshed came about a month after gunmen ambushed a Nigerien army post in another border town, killing 71 soldiers in the deadliest strike on the nation’s forces in recent memory.

The Islamic State West Africa Province asserted responsibility for that massacre two days later.

Extremist groups routinely carry out attacks across the Sahel region, which lies south of the Sahara Desert. The scourge took root nearly a decade ago, and authorities warn it is spreading as governments struggle to combat it amid limited resources.

The Thursday battle in western Niger also killed 63 “terrorists,” Col. Souleymane Gozobi, a Nigerien defense spokesman, said on national television.

No group immediately asserted responsibility for the attack.

The Niger ambush followed a rocket attack on a U.N. military base Thursday in northern Mali that wounded 20 people, including 18 peacekeepers from Chad.

Thousands of troops from Niger, neighboring countries, France and the United Nations have been enlisted in the fight against extremist organizations seeking influence and safe haven in the region. The militants are using remote patches of West Africa to train and plot attacks, U.S. officials have warned.

Nigerien President Mahamadou Issoufou and other West African leaders are slated to meet Monday with French President Emmanuel Macron to discuss the French military’s role in the region as conflict escalates. The conference was delayed after the Dec. 10 assault.

Terrorist attacks have increased fivefold in Niger, Mali and Burkina Faso since 2016, with more than 4,000 deaths recorded, Mohamed Ibn Chambas, the top U.N. official in West Africa, told the U.N. Security Council on Wednesday.

The region has suffered a “devastating surge in terrorist attacks against civilian and military targets,” Chambas said.

The extremists appear to be pushing south and west toward coastal countries that have not previously grappled with such threats, he added.

Burkina Faso, which neighbors Niger, is a particularly troubling case. Its citizens, a mix of Muslims and Christians, moved freely without fear before extremists started unleashing havoc in the country about four years ago.

The number of deaths from the violence swelled from 80 in 2016 to 1,800 by last year, according to the United Nations.

The collapse of the Libyan government triggered the chaos in 2011, analysts say, after mercenaries once employed by Moammar Gaddafi streamed back to their native Mali and aligned with al-Qaeda fighters.

The unrest that ebbed and flowed over the years has spilled over borders and gained serious momentum in recent months as militants attack army posts, steal equipment and carry out increasingly sophisticated assaults.