CAIRO (Reuters) - Islamic State said on Wednesday its West African branch carried out an attack on a Nigerian army base in northeastern Borno state and that its fighters killed 12 soldiers.

A military source put the toll higher, saying up to 25 soldiers were killed after insurgents traveling on trucks mounted with guns attacked the base on Monday around 5:30 p.m. (1630 GMT). He said fighting lasted for about three hours. A local resident said he saw the bodies of six dead Nigerian soldiers.

The attack in the town of Gajiram, in which the insurgents said the barracks were burned, followed a similar assault on a base last week and suicide bombings that killed 30 people on Sunday. The attacks raise questions about government assertions to have almost defeated the insurgents.

“Twelve Nigerian soldiers were killed and others injured following an attack by Islamic State fighters on their barracks in the northern Nigerian town of Gajiram,” Islamic State in West Africa Province (ISWAP) said in a statement published on the SITE Intelligence website.

A Nigerian army spokesman did not immediately respond to a request for comment.

The insurgency in northeast Nigeria has killed more than 30,000 people and displaced about 2 million since 2009. President Muhammadu Buhari, a retired general, was re-elected in February after a campaign in which he vowed to improve security.

Buhari, in his second-term inaugural speech earlier this month, said the government would provide more support for the security forces in terms of money and equipment.