Nigeria's military repelled multiple attacks by suspected Boko Haram militants on Borno state capital Maiduguri in the north-east, security sources said on Sunday, but the insurgents captured another Borno town.
The assault on Maiduguri, with a population of around two million, began just after midnight. Sources at two hospitals said at least eight people had died and 27, mostly civilians, had been injured. A second attempt to take the city's airport in the afternoon was also repelled.
A raid on Monguno, 140 km (80 miles) north, began later in the morning and the town fell under militant control by the late afternoon.
The militants also simultaneously attacked another town, Konduga, which is 40 km (24 miles) from Maiduguri, but the military was able to repel the raid.
The army's inability to quash the Sunni jihadist group is a major headache for President Goodluck Jonathan, who is seeking re-election in February and who visited the state capital on Saturday as part of his campaign. Opposition candidate Muhammadu Buhari had been due to arrive on Monday.
The elections are expected to be the most hotly contested since the end of military rule in 1999 with many fearing violence in the aftermath.
US Secretary of State John Kerry arrived in the commercial capital Lagos on Sunday to urge the candidates and their supporters to respect the election outcome, underscoring US concerns that post-poll violence could destabilise the country and undermine the fight against Boko Haram. The five-year insurgency, which aims to carve out an Islamic state in Africa's most populous country, has seen thousands killed.
At around 9 am (0800 GMT) on Sunday, a Reuters witness in Maiduguri said shelling could be heard and that military helicopters were circling the city, but by the early afternoon calm had returned.
Scores of militants and soldiers were killed in the clash, a military source and a civilian joint task force leader (JTF) said.
"We're still combing the bush for their corpses, we pursued the Boko Haram men until Auno, 12 km outside the city...some fled towards Mainok," said the civilian JTF leader who declined to be named for security reasons.
Nigeria's defence headquarters tweeted on Sunday morning that co-ordinated land and air operations were being used to repel the attacks and a curfew had been imposed on Maiduguri.
The militants began the attack at the edge of the city in the Njimtilo area and tried to take the airport which services the air force as well as civilians, security sources said. Boko Haram last attempted to take Maiduguri from the same area in December 2013.
Along with much of Borno, the militants control some areas of neighbouring Adamawa and Yobe states, and recently took control of the town and a multi-national army base at Baga by Lake Chad.