POTISKUM, Nigeria — Suspected Islamist extremists attacked an agricultural college in the middle of the night, torching classrooms and gunning down about 50 students as they slept in dormitories, the school’s provost said — the latest violence in northeastern Nigeria’s ongoing Islamist uprising.
The attack, blamed on the Boko Haram extremist group, came despite a 4½-month-old state of emergency covering three states and one-sixth of the country. Recent violence has led many to doubt assurances from the government and the military that they are winning Nigeria’s war on the extremists.
Provost Molima Idi Mato of Yobe State College of Agriculture said no security forces were protecting the college. Two weeks ago, the state commissioner for education had begged schools and colleges to reopen and promised they would be guarded by soldiers and police.
Idi Mato said as many as 50 students may have been killed in the assault that began at about 1 a.m. Sunday in rural Gujba. ‘‘They attacked our students while they were sleeping in their hostels. They opened fire at them,’’ he said, adding that most victims were aged between 18 and 22.
Soldiers recovered 42 bodies and transported 18 wounded students to Damaturu Specialist Hospital, 25 miles north, said a military intelligence official who insisted on anonymity because he was not authorized to speak to the press.
Two of the wounded later died, said Adamu Usman, a survivor from Gujba who was helping at the hospital.
President Goodluck Jonathan condemned the attack in a televised ‘‘chat with the media’’ Sunday night, and questioned the motives of Boko Haram, which wants to impose Islamic law across Nigeria. He said he wondered whether the victims were Muslim or Christian.
Usman said almost all those killed were Muslims, as is the majority of the college’s student body.
Jonathan likened the assault to that on Nairobi’s premier shopping mall last week, where Islamist extremists from Somalia’s Al Shabab movement killed 67 civilians — but only after allowing many Muslims to leave. Boko Haram has said some of its fighters trained with Al Shabab in Somalia.
Boko Haram leader Abubakar Shekau has said in video addresses that his group wants to end democracy in Nigeria and allow education only in Islamic schools. Boko Haram means ‘‘Western education is forbidden.’’
Its uprising poses the biggest security challenge in years to this country. Nigeria is Africa’s biggest oil producer and its most populous nation with more than 160 million people — almost equal numbers of which are Muslims and Christians.
Boko Haram militants have killed more than 1,700 people since 2010.
‘‘Sometimes you need courage’’ to confront such challenges, Jonathan said, accusing the extremists of choosing soft targets to embarrass his government.
Governor Ibrahim Gaidam of Yobe state, where the killings occurred, indicated that the military crackdown is ineffective.
‘‘Although there is [an] increase in troop movement and military hardware deployment in the northeast, people are yet to see the kind of action on the ground that effectively nips criminal and terrorist activities in the bud,’’ he said in a statement.
The extremists rode into the college in two double-cabin pickup all-terrain vehicles and on motorcycles, some dressed in Nigerian military uniforms, said a surviving student, Ibrahim Mohammed.
He said they appeared to know the layout of the college, attacking the four male hostels but avoiding the one hostel reserved for women.
‘‘We ran into the bush; nobody is left in the school now,’’ Mohammed said.
Wailing relatives gathered outside the hospital morgue, where workers laid out bloody bodies in an orderly row on the lawn.
One body had its fists clenched to the chest in a protective gesture. Another had hands clasped under the chin, as if in prayer. A third had arms raised in surrender.
Provost Idi Mato confirmed that the school’s other 1,000 enrolled students have fled the college.
Most schools in the area closed after militants on July 6 killed 29 pupils and a teacher, burning some alive in their hostels, at Mamudo outside Damaturu.