Dozens of people have been killed and wounded in an attack by Islamic extremists on a city in north-east Nigeria, the military has said.

Troops are blocking roads leading to Maiduguri, a city of more than one million, preventing civilians from escaping.

Amnesty International says hundreds of thousands of civilians "are now at grave risk".

An officer involved in the fighting said the extremists attacked on three fronts around Maiduguri early today. He said dozens of fighters were killed.

Military spokesman Chris Olukolade tweeted that "coordinated air and land operations are being conducted now".

Maiduguri has been attacked many times in Nigeria's five-year Islamic insurgency that killed 10,000 people last year.

The attacks come on the day US Secretary of State John Kerry is expected in Lagos, Nigeria's commercial capital nearly 1,000 miles south-west of Maiduguri.

Aides said Mr Kerry is concerned about possible violence around Nigeria's February 14 elections and will meet with the main contenders, President Goodluck Jonathan and former military dictator Muhammadu Buhari.

Mr Jonathan made a surprise visit to Maiduguri 10 days ago and pledged to crush the insurgents. But his repeated promises are ringing hollow as Boko Haram since August has seized and kept control of large swathes of the northeast, including key border crossings into Cameroon, Chad and Niger.

Boko Haram has denounced democracy and is fighting to impose its strict version of Shariah law across Nigeria, whose population of about 170 million is divided almost equally between Muslims in the north and Christians in the south.

The extremists attacked on three fronts around Maiduguri, the capital of Borno, soon after midnight and troops battled to hold them at bay, according to an officer involved in the fighting.

A hospital worker said they are treating dozens of wounded soldiers.

Boko Haram on Jan. 3 seized a key military base and town on the border with Cameroon, killing hundreds of civilians and leaving the main road open to Maiduguri. The military said they were counter-attacking a week ago. But escaping civilians said there was no fighting and the insurgents retain control of the town of Baga.

The militants were said to have simultaneously attacked Maiduguri and Monguno town, 180 kilometres (112 miles) away.

While soldiers were succeeding in holding off the attack on Maiduguri, it appeared they might lose Monguno, according to Abbas Gava, a spokesman for the civilian self-defence groups fighting Boko Haram.

Maiduguri is the birthplace of Boko Haram and has been attacked many times in the five-year Islamic insurgency that killed 10,000 people last year.