Suspected members of the Nigerian Islamist sect Boko Haram raided the northeastern town of Bama tonight, leaving 55 people dead, the military said.
Boko Haram gunmen killed 22 police officers, 14 prison officials, two soldiers and four civilians, while 13 of the group's own members died, military spokesman Sagir Musa said.
Gunmen freed 105 prison members during the raid, which began at around 5am and lasted almost five hours, Mr Musa said.
Bama's police station, military barracks and government buildings were burned to the ground.
Bama is a small, remote town in northeastern Borno state, where Boko Haram first launched an uprising in 2009.
The Boko Haram sect and offshoots such as the al Qaeda-linked Ansaru, as well as associated criminal networks, pose the main threat to stability in Africa's top energy producer.
Western governments are increasingly concerned about Nigerian militants linking up with other jihadist groups in the west African region.
Boko Haram wants to establish an Islamic state in a country split roughly equally between Christians and Muslims.
One of its chief demands is that its imprisoned members and family members are released.
It has carried out several prison breaks.