Boko Haram fighters killed at least 50 Nigerian soldiers in an ambush near Goneri village in northern Yobe state, according to military officials and villagers.

"The Nigerian military suffered some casualties in the unfortunate attack," defence ministry spokesman John Enenche told journalists in the capital, Abuja, on Tuesday.

Enenche did not disclose the exact number of casualties, but local witnesses who spoke to German press agency dpa on the telephone placed the death toll at between 50 and 75 people.

More:

The ambush occurred near the town of Goneri in eastern Borno State on Monday, according to Enenche.

"The army is saying the situation has subsided," Al Jazeera's Ahmed Idris reported from Abuja.

"After the attack they called in the air force and raided the position of the fighters and succeeded in killing all of them - although the military here did not give the actual number of Boko Haram fighters that were killed."

The attack, one of the deadliest against troops recently, came as the military tried to launch an offensive against the armed group that began over the weekend, a military official with knowledge of the operation told The Associated Press. The official spoke on condition of anonymity because he was not permitted to speak to the media about the matter.

The troops were able to fight back and escape from the ambush on Saturday, he said. At a place called "the Gorge", the soldiers were attacked from the rear when they advanced.

Boko Haram fighters inflicted heavy casualties by firing on the vehicles with rocket-propelled grenades and assault weapons, he said. Those who survived are being treated at hospitals in Damaturu and Maiduguri.

A senior army officer also confirmed the attack, saying he lost a friend and calling it a huge setback for Nigeria's army.

Boko Haram has killed tens of thousands in its 10-year armed uprising in northern Nigeria.