(Adds details, background, military)
DAMATURU, Nigeria, Feb 25 (Reuters) - Gunmen from Islamist group Boko Haram stormed a boarding school in northeast Nigeria overnight and killed 29 pupils, many of whom died in flames as the school was burned to the ground, police and the military said on Tuesday.
"Some of the students bodies were burned to ashes," Police Commissioner Sanusi Rufai said of the attack on the Federal Government college of Buni Yadi, a secondary school in Yobe state, near the state's capital city of Damaturu.
All those killed were boys. No girls were touched, Rufai said.
The Islamists, whose struggle for an Islamic state in northern Nigeria has killed thousands and made them the biggest threat to security in Africa's top oil producer, increasingly are preying on the civilian population.
Boko Haram, whose name means "Western education is sinful" in the northern Hausa language, have frequently attacked schools in the past. A similar attack in June in the village of Mamudo left 22 students dead.
More than 200 people were killed in two attacks last week, one in which militants razed a whole village and shot panicked residents as they tried to flee.
The failure of the military to protect civilians is fuelling anger in the northeast, the region worst affected by the four- and-a-half-year-old insurgency. An offensive ordered by President Goodluck Jonathan in May has failed to crush the rebels and triggered reprisals against civilians.
A military spokesman for Yobe state, Captain Lazarus Eli, confirmed the attack and said "Our men are down there in pursuit of the killers."
Addressing a news conference on Monday, Jonathan defended the military's record, saying it had had some successes against Boko Haram. He also said Nigeria was working with the Cameroon authorities to try to prevent the militants from mounting attacks in Nigeria and then fleeing over the border.
The military shut the northern part of the border with Cameroon on the weekend. The insurgents mostly occupy the remote, hilly Gwoza area bordering Cameroon, from where they attack civilians they accuse of being pro-government. They have also started abducting scores of girls, a new tactic reminiscent of Uganda's cult-like Lord's Resistance Army in decades past. (Reporting by Joe Hemba; Writing by Tim Cocks; Editing by Larry King)
Our Standards: The Thomson Reuters Trust Principles.