Co-ordinated attacks by Islamic extremists armed with heavy machine guns have killed at least 42 people in north-east Nigeria, according to authorities, the latest in a string of increasingly bloody incidents threatening peace in Africa's most populous nation.

Multiple locations were struck in Bama in Nigeria's Borno state, where shootings and bombings have been rife since an insurgency began there in 2010.

Fighters raided a federal prison during the assault, killing 14 guards and freeing 105 inmates, officials said.

Details of the attack remain unclear, although military spokesman Lt Col Sagir Musa said about 200 fighters in buses and pickup trucks mounted with machine guns attacked the barracks of the 202 Battalion of Nigeria's army. Musa said 10 insurgents and two soldiers died in the attack.

"They came in army uniform pretending to be soldiers but [we] were able to detect them," he said.

The attackers also razed a police station, a police barracks, magistrate's court and local government offices, the spokesman said.

At least 22 police officers, three children and a woman were killed in those attacks, said Bama police commander Sagir Abubakar. He said officers killed three insurgents during the fighting.

Calls rang unanswered or would not connect on Tuesday night to those living in Bama, a town 40 miles (65km) south-east of Maiduguri, the capital of Borno state. In attacks in the region by Islamic extremists, phone towers have been bombed and burned to the ground, making communication even more difficult for security officials and civilians as well. At least 17 people died in an attack in Bama in late April.

Much of the violence has been blamed on the extremist network known as Boko Haram, which translates as "western education is sacrilege" in the Hausa language of Nigeria's north. The group has said it wants its imprisoned members freed and Nigeria to adopt strict sharia law across the multi-ethnic nation of more than 160 million people.

While President Goodluck Jonathan has launched a committee to look at offering an amnesty deal to extremist fighters, Boko Haram's leader, Abubakar Shekau, has dismissed the idea in messages.

The Islamic insurgency in Nigeria grew out of a riot in 2009 led by Boko Haram members in Maiduguri that ended in a military and police crackdown in which about 700 people were killed. The group's leader died in police custody in an apparent execution. Since 2010, Islamic extremists have engaged in hit-and-run shootings and suicide bombings, attacks that have killed more than 1,500 people.

Despite the deployment of more soldiers and police to northern Nigeria, central government has been unable to stop the killings. Meanwhile, alleged atrocities committed by security forces against the local civilian population has caused anger in the region.

In late April, at least 187 people were killed in fighting between Islamic extremists and the military in Baga, another city in Borno state that sits along the banks of Lake Chad. Witnesses say soldiers angry about the death of a military officer set fire to homes and killed civilians.

Human Rights Watch recently said an analysis of satellite imagery before and after the attack led it to believe the violence destroyed about 2,275 buildings and severely damaged another 125.