Nigeria's military has repelled a Boko Haram assault on the key city of Maiduguri as violence raged across the country's northeast just two weeks before national elections.
Heavily armed gunmen had attacked the southern edge of Maiduguri at roughly 3am local time (02:00 GMT) on Sunday, setting off explosives as they tried to enter the city, several residents said.
Beaten back in the south by troops supported by vigilantes, Boko Haram regrouped and tried to take the city from the east, where they again met stiff resistance.
INTERACTIVE: Boko Haram's bloody legacy
As the gun battles raged "the whole city [was] in fear", said resident Adam Krenuwa.
Chris Olukolade, a defence ministry spokesman, said the assault on the city, where the group was founded more than a decade ago, was "contained" and that "the terrorists incurred massive casualties".
"The situation is calm as mopping up operation in the affected area is ongoing," he wrote in a text message, a claim consistent with witness reports.
The attack on the strategic capital of Borno state was the group's second attempt to take Maiduguri in a week.
Later on Sunday, a suicide bomber blew himself up outside the house of a legislator in the northeast Nigerian town of Potiskum, killing 10 people, two security sources told Reuters. No one immediately took responsibility for the attack.
Threat to elections
As government forces were holding off Boko Haram in Maiduguri, the air force of neighbouring Chad was pounding the group's positions in Gamboru, a town on Nigeria's border with Cameroon, 140km to the northeast.
With near-relentless violence plaguing much of the northeast, and Boko Haram still in control of large swaths of the region, fears are mounting over the prospect of organising polls on February 14.
The opposition All Progressives Congress (APC), which claims to be gaining momentum in the campaign against President Goodluck Jonathan, has rejected calls for the vote to be postponed.
But hundreds of thousands of voters in the northeast, an APC stronghold, could be disenfranchised by the unrest if the election goes ahead in two weeks time.