Attack comes as the government holds peace talks with one faction of the extremist group
Boko Haram kills 18 in attack on Nigerian army base and villages
Nigeria's Boko Haram militants attacked a military base and two villages near the city of Maiduguri on Sunday night, killing at least 18 people and wounding 84.
It was one of the most brazen attacks in recent months and was a precursor to a planned strike on Maiduguri, the capital of Borno state and the birthplace of the extremist group.
Boko Haram fighters attacked the base in the Cashew Plantation area with suicide bombers, mortars and guns, leading to a prolonged battle, a senior army officer in Maiduguri said.
"Eighteen Boko Haram terrorists on foot attacked the military base while seven suicide bombers targeted residents of nearby Bale Shuwar and Alikaranti villages at 8.50pm [11.50pm UAE]," said the officer. "The terrorists fired mortars at troops."
Benlo Dambatto, an official from the State Emergency Management Agency, said 18 bodies had been recovered from the two villages.
"The victims were killed while trying to escape the fight between the insurgents and the military," he said.
The attackers were trying to infiltrate into Maiduguri, said Ba'Kura Abba Ali, leader of a local militia that is helping soldiers in fighting Boko Haram.
The militants attacked after climbing up a moat dug around the city to stave off Boko Haram suicide and gun attacks, Mr Ali said.
Maiduguri residents reported hearing at least five explosions and sounds of gunfire coming from the Cashew Plantation area.
"Huge blasts and sounds of gunshots were heard all over the city last night and they continued for more than an hour," said one resident, Ibrahim Gremah.
On Friday, four teenage female suicide bombers killed two people in Zawuya settlement on the outskirts of Maiduguri. It was the first attack since the government announced it was in ceasefire talks with Boko Haram.
Senior security officials say that reaching any agreement with the group would be difficult, as it is split into competing factions with different goals.
The ISIL-affiliated faction reportedly in talks with the government is led by Abu Mus'ab al-Barnawi and is known for attacks on military targets, while another faction led by Abubakar Shekau is notorious for suicide bombings killing civilians.
Late last month, when more than 100 schoolgirls were returned to Dapchi after being kidnapped by the militants, Nigerian President Muhammadu Buhari said his government was offering amnesty to "repentant" extremists.
Boko Haram's nearly nine-year fight to establish a hardline Islamic state in north-east Nigeria has claimed at least 20,000 lives and displaced more than two million people.