The attackers drove into the campus of the Yobe State College of Agriculture, in a rural area just south of Damaturu, the state capital, survivors said. A student, Musa Aliyu, 21, said on Sunday that the attackers had entered the college's dormitories as students slept, and then opened fire randomly in the darkness.

The attack was the second large-scale massacre of civilians attributed to Boko Haram in less than two weeks. The Nigerian military has been pressing a scorched-earth counterinsurgency campaign against Boko Haram for four months, and appeared to have halted its attacks in the urban centers of northeastern Nigeria, while hundreds of civilians fled into neighboring Niger to escape the violence. In rural areas, though, killings by the group — including at least 143 reported deaths in the northeastern town of Benisheik on Sept. 17 — appear to be continuing unabated.

In its war against the Nigerian state, Boko Haram has singled out government institutions, especially schools, for attack. One of its tenets is that Western-style education, not based on the Koran, in conventional schools is sinful and un-Islamic; the group has burned numerous schools in Maiduguri, the largest city in the region, and in early July it attacked a government secondary school in the town of Mamudo, killing 42 people, mostly students.

There was little security at the agricultural college, survivors said, and the attack took students and teachers by surprise. "The sound of sporadic shootings woke us up," Mr. Aliyu said. "I escaped, by the grace of God, but about 15 of my friends are dead."

He and dozens of other students at the college, which offers courses in animal husbandry and horticulture, among other subjects, fled into the bush around the village of Gujba to escape the gunfire, he said. As in previous attacks on schools, many of the college's buildings were burned.

Afterward, the mortuary in Damaturu, a dusty town on the highway between Kano and Maiduguri, was piled high with the bodies of the students, ranging in age from 18 to 25, as grieving relatives pressed in, said Ahmed Bedu, a local radio journalist.

"The bodies are too many," Mr. Bedu said on Sunday in a telephone interview from Damaturu. "You need to see the number of corpses that are over there." Some of the victims appeared to have been hit by a number of shots, he said.

"There is fear and anxiety," Mr. Bedu said. "There is a panic in the faces of the people."

The governor of Yobe State, Ibrahim Gaidam, issued a statement condemning the attack as "devastating, heinous and barbaric," and called for increased protection from the military. Survivors and relatives echoed the call.

A civil servant who gave his name only as Ibrahim, for fear of retribution from the government, said in a telephone interview from Damaturu that he had lost a cousin in the attack. "I was at the mortuary from 8 a.m. to 3 p.m.," he said. "There are many grieving parents. Honestly, everybody was crying for his dear loved one."

Ibrahim condemned the attackers. "Nobody can explain what they want," he said. "All of the students that died today are Muslims. No single Christian was killed. This is not a religious war. These people that perpetrated this call themselves Muslims. But this is against the teachings of Islam."

Hamza Idris contributed from Maiduguri, Nigeria.