The militant group
But Nigeria's military drove back the insurgents with an air and ground attack, killing about 200 fighters, according to military officials. It was a rare victory in the country's fight against the militant insurgency.
Boko Haram attacked Maiduguri, the capital of Nigeria's Borno state, on several fronts Sunday morning, triggering heavy fighting as the army scrambled to defend the city. Fighting raged through the night, according to local media. The attackers also took over the town of Monguno to the north, gaining control of a military base and ammunition store, and attacked several villages farther south, in Adamawa state.
Nigerian defense headquarters Sunday announced a 24-hour curfew in Maiduguri.
"FLASH: Troops are repelling a simultaneous attack on #Monguno and #Maiduguri by terrorists. Coordinated Air and Land OPs being conducted #Now," the Defense Headquarters tweeted.
In recent months, Boko Haram has seized a vast slice of northeastern Nigeria, raising its black flag over dozens of villages it has conquered around Maiduguri.
Its rapid advance, outgunning Nigeria's military in many cases, raised speculation that it was likely to launch a bid to conquer the state capital.
Boko Haram was founded in Maiduguri about 12 years ago, and the city remains an important symbol to the violent Islamist militia, which wants to establish an Islamic caliphate.
Nigerian military officials said they recovered two armed personnel carriers from Boko Haram, as well as many anti-aircraft guns and AK-47s.
The attack unfolded shortly before Secretary of State John F. Kerry flew into Nigeria on Sunday, with elections just weeks away. He met President
Violence marred the 2011 election, when riots broke out in the north as Buhari and his supporters contested the result. Angry northern mobs enraged by Jonathan's win dragged Christians from their houses in northern towns and killed them. Around 800 people were killed.
Nigeria, a country of 170 million, is roughly divided between Muslims, concentrated in the north, and Christians in the south. Jonathan is a Christian.
There are fears that a disputed result this time could fuel more violence in northern Nigeria and drive disillusioned northern voters into Boko Haram's arms.
The dire security situation in the north appears to make an election impossible in many places, given that Boko Haram is in control of many towns and cities in the region.
Kerry was also expected to discuss the Boko Haram insurgency and American support for Nigeria, after Nigeria last year canceled a deal that would have seen the U.S. train its military. Nigeria is angered by America's refusal to sell it military equipment, including attack helicopters, to fight Boko Haram.