Niger says its troops fended off an attack on its territory by Boko Haram and destroyed a base used by the Islamic extremists inside neighboring Nigeria.

Niger's Defense Ministry said in a statement Tuesday that the militants tried to attack Bosso, on the border with Nigeria, on Monday. But troops from Niger and Chad — who are helping Nigeria root out the insurgents — intervened, killing 47 militants and destroying several of their vehicles and mortars.

On Saturday, troops from Niger and Chad destroyed a Boko Haram base inside Nigeria, near Talagam, killing 54 militants. Three troops from Niger were wounded.

The two confrontations come as Nigeria elected a former military dictator as its new president amid anger over the insurgency that has claimed thousands of lives.