Kano - At least three Nigerian soldiers were killed when Boko Haram jihadists raided a military post near the country home of Nigeria's army chief in northern Borno state, military and civilian sources said Saturday.

The Islamist group however claimed to have killed five troops in the attack.

Armed jihadists from the Islamic State-supported Al-Barnawi faction of Boko Haram launched a midnight attack on Thursday on Nigerian troops in the village of Kamuya, around five kilometers from Buratai, the native home of army chief of staff General Tukur Yusuf Buratai, a military source told AFP.

"The terrorists who rode on camels attacked our checkpoint at Kamuya, killing three soldiers after a gun battle," said the military source who asked not to be identified.

"The troops retreated to Buratai where they teamed up with another detachment and went after the terrorists in the bush," the military officer said.

Troops sealed the area, preventing villagers from leaving and making it difficult to get a detailed account of the incident.

Nigerian military officials declined to comment on the attack.

In a tweet from the ISIS-affiliated Amaq news agency, Boko Haram claimed it killed five soldiers from the regional coalition fighting the jihadists.

"Killing of five African coalition soldiers and 11 injured after attack by Islamic Caliphate forces... in Kamuya town," the tweet read in part.

A civilian resident in the nearby Miringa village said the Kamuya assault was carried out by fighters from the Al-Barnawi faction who are known to be hiding in the area's Ajigin forest.

Umar Sanda told AFP that Ajigin forest was the bastion of the Al-Barnawi fighters and that "they are responsible for most of the attacks in the area including the one in Kamuya."

He added that the residents have repeatedly told the soldiers that "Ajigin is the hideout of Boko Haram in the area and as long as they are not dislodged there will no end to their attacks."

Boko Haram, which has pledged allegiance to the Islamic State group, has been in the grip of a power struggle.

One faction is led by Abu Musab al-Barnawi, the 22-year-old son of Boko Haram's founder Mohammed Yusuf, who was named leader by the ISIS high command in August.

Villages in the area have been razed and plundered in deadly raids by Boko Haram since Tukur Buratai became Nigerian army chief in June 2015.

The attacks are believed to be reprisals over the successes by the Nigerian troops who have pushed Boko Haram from swathes of Nigerian territory they had seized in their bid to carve out an Islamic Caliphate.

The military campaign which succeeded in substantually cutting off Boko Haram's food, fuel and weapons supplies has also seen Boko Haram losing its Sambisa forest stronghold to Nigerian forces.

Boko Haram violence is estimated to have killed 20 000 people and displaced 2.6 million since the start of its insurgency in 2009.