Nigerien commandos simulate a raid on a militant camp during the US-sponsored Flintlock exercises in Ouallam. File picture: Aaron Ross/Reuters

Niamey - An attack on a military camp in western Niger has left 71 military personnel dead, according to an army statement read on national television late Wednesday.

Fifty-seven of the attackers were also killed, the statement said, while 12 people were injured and several others were missing.

The assault took place on Tuesday evening. Unidentified armed attackers arrived at the camp in the town of Inates - near the border with Mali - on motorbikes and pickup trucks as soldiers were preparing for evening prayers, according to a local source.

It was the second attack in less than six months on the camp. Eighteen soldiers had been killed in an attack in July for which the Islamic State in West Africa Province - a splinter group of the Boko Haram terrorist group - had claimed responsibility.

Islamist terrorist groups are especially active in Niger's west, not far from the borders with Mali and Burkina Faso. Some of them are loyal to al-Qaeda while others are tied to Islamic State.

Tuesday's attack led President Issoufou Mahamadou to cut short a trip to Egypt, where he was attending a conference on sustainable peace, security and development in Africa. His office called the attack a "tragedy" on Twitter.

Mahamadou arrived back in the Nigerien capital Niamey on Wednesday evening and is due to chair a meeting of the National Security Council on Thursday, his office tweeted.

The Inates attack came 24 hours after another assault on a military base in the region of Tahoua, which left three soldiers and 14 "terrorists" dead, according to the Nigerien Defence Ministry.