SEVEN students, two teachers and two insurgents were killed when suspected members of Nigerian Islamist sect Boko Haram attacked a school in the northeastern town of Damaturu, the military said.
Groups like Boko Haram and the al Qaeda-linked Ansaru have become the biggest risk to stability in Nigeria, Africa's top oil producer and second-largest economy.
Sunday's attack will raise fears that, as with past surges, a month-long offensive by government troops has merely pushed militants into hiding or across borders to Niger, Chad and Cameroon, where they can regroup and prepare new attacks.
"Two teachers and two insurgents were killed when Boko Haram terrorists attacked the Government Secondary School ... Also seven innocent students lost their lives," Eli Lazarus, military spokesman in Yobe state, said in a statement.
Boko Haram, which roughly translates as "Western education is sinful", has attacked several schools in the past. It was not clear how two of the attackers were killed.
Vigilante groups armed with machetes and sticks have joined the effort to oust Islamist insurgents in the northeast, prompting concerns by some residents that this will lead to a breakdown in law and order.
The military has cautiously welcomed the support, while warning it must not lead to witch-hunts or the settling of scores.
Lazarus said three soldiers were critically wounded during a separate attack by Boko Haram targeting the military in Damaturu, and three insurgents had been arrested.
Nigerian forces say their offensive has enabled them to wrest back control of the country's remote northeast from Boko Haram. They say they have destroyed key bases and arrested more than 150 suspected insurgents in the states of Borno, Yobe and Adamawa -- all covered by a state of emergency declared by President Goodluck Jonathan last month.
Some Nigerians saw the push as long overdue. But rights groups and aid agencies fear the longer it goes on, the more the region's vulnerable local population, which includes some of the poorest people on earth, will suffer.
The offensive has forced more than 6,000 refugees - mostly women, children and the elderly - to flee to neighbouring Niger, the U.N. refugee agency said last week.