MAIDUGURI, Nigeria (AP) -- Islamic militants struck the northern city of Maiduguri Friday morning, attacking the main military barracks with gunfire and explosions, but the Ministry of Defense said it repelled the insurgents and inflicted "heavy casualties."
Children walking to school when the shooting erupted cried in fear and confusion, and panicked residents fled from their homes.
Thousands of young men grabbed whatever weapons came to hand -- cutlasses, machetes, clubs and bows and arrows -- and went around making arrests of people they charged were extremists. Some were killed by the mob, residents said. Many civilians also are believed killed.
The Islamic extremists fought their way into the military installation and managed to free several militants detained in cells at the barracks, but most of those released were shot as they attempted to escape, according to a soldier at the scene who spoke on condition of anonymity because he wasn't allowed to give information to reporters.
They were killed by friendly fire, Defense Ministry spokesman Brig. Gen. Christ Olukolade said. "Some of the victims of the terrorists' fire, in their efforts to break into the detention facility, included those they came to rescue," he said in a statement. "The attack has been successfully repelled with heavy human casualty on the terrorists."
Four soldiers were wounded in the fighting and "hot pursuit" operations by land and air are in progress, he said.
The military believed the insurgents were trying "to boost their depleted stock of fighters" following two weeks of aerial bombardments and ground assaults on forest hideouts and mountain caves along the borders with Cameroon and Chad, said Olukolade.
President Goodluck Jonathan said Friday he expects "maximum cooperation" from neighboring countries and warned their security could be affected by the uprising.
He was speaking with Cameroon's visiting interior minister, Rene Emmanuel Sadi, who assured that his government would never allow its territory to become a safe haven for the extremists. Nigeria last month closed hundreds of miles (kilometers) of border with Cameroon to prevent militants using it as an escape route.
In Maiduguri, vigilante leader Abdullahi Dere said his Sector 5 group counted the bodies of 207 suspected extremists.
"Many others are being killed in the bush because the fighter jet is still shelling them," he told The Associated Press.
Fighter jets bombed targets in the city and destroyed several homes in the Fori neighborhood which the insurgents had come through, residents said.
A child hiding at home with her parents was killed in one bombing raid, street vendor and Fori resident Babaji Adamu told The Associated Press.
"The parents were able to escape out of the rubble, but the girl was not that lucky: They had to drag her out lifeless."
An unknown number of civilians were killed in Fori by the insurgents, who also set homes ablaze, the residents said.
Isa Maikati, head of another civilian vigilante group set up to fight the extremists, said he saw the bodies of many civilians around Fori and behind Giwa Barracks, but he did not stop to count. He did count 14 bodies of alleged extremists outside the barracks, he said.
Maiduguri is the capital of Borno state and birthplace of the Boko Haram terrorist network that is blamed for the deaths of thousands of Muslims and Christians in a 4-year-old uprising aimed at transforming Nigeria into an Islamic state under strict Shariah law. Nigeria's population of 170 million, the biggest in Africa, is nearly equally divided between Christians, mainly in the south, and Muslims in the north.
This was the fourth attack in Maiduguri in recent months. Twin car bombs exploded in a bustling marketplace in Maiduguri on March 2, killing more than 50 people. A Jan. 14 bomb killed 40 residents. A bold assault on Dec. 5 on the air force base and a military barracks on the city outskirts killed an unknown number of security forces and extremists who destroyed five aircraft on the runway.
The Islamic uprising and the fallout from an often brutal military response has forced about half a million people from their homes since 2012 -- some 470,000 people displaced in the country and at least 30,000 across borders in Chad, Niger and Cameroon, according to the UN refugee agency.
"The horrific attacks by Boko Haram are having a devastating impact on northern Nigerians," Human Rights Watch said in a report Friday calling for the government to help refugees. The New York-based advocacy group put the death toll at more than 700 killed this year in attacks on more than 40 villages.
Friday's attack is a major blow to the military's claims of successes in air raids and ground assaults on forest hideouts and mountain caves that they said have killed scores of fighters and had others on the run.
President Goodluck Jonathan responded by firing his entire military command last month and appointing a new defense minister last week. This comes in the run-up to February 2015 elections that will be the most hotly contested since decades of military dictatorship ended in 1999.
Faul reported from Lagos, Nigeria.
Copyright 2014 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.