Nigerian police say they have made many arrests following the killing of at least 26 people at a college hostel in the north-eastern town of Mubi.
Most victims were students called out by name by the gunmen, police said. The attackers went from door-to-door, shooting or stabbing.
It is unclear who is responsible.
Some suspect the Boko Haram militant group, while police sources are linking it to a student union election, which was contested on sectarian lines.
BBC Hausa service editor Mansur Liman says the newly elected leader of the student union at the Federal Polytechnic Mubi was among those reported to have been killed.
Rivalry between different groups of students, sometimes influenced by national politics, religion and ethnicity, is not a new phenomenon in Nigeria's higher educational institutions; however, this would be the first time it has reached such a level of violence, he says.
Leadership positions on campuses can be a stepping stone for a future career in national politics, which many in Nigeria see as a licence to get rich quickly, he adds.
The town had already been under an extensive curfew, in force between 15:00 and 06:00, after a series of arrests of people with suspected links to Boko Haram last week. That curfew is continuing.
Continue reading the main story
It seems to make a lot of sense that it could have been an outcome of the elections that were held the previous day”
Former president of the National Association of Nigerian Students
The college has been closed and some students have fled the town.
An investigation is under way. Mubi is blanketed with police, who are going house-to-house in their hunt for the attackers, reports said.
Nigeria's Senate on Wednesday condemned "in strongest terms the killing of innocent students" and urged the federal government to move quickly to apprehend the perpetrators.
'Slaughtered like goats'
Reports suggest men in military uniform entered a hall of residence outside the main campus shortly before midnight and gathered the students outside their rooms. After they were killed, their bodies were left in lines outside the buildings.
"We have made several arrests - in fact, we have arrested many suspects in connection with the killing," police spokesman Mohammed Ibrahim told Agence France-Presse.
A school official told the agency on condition of anonymity that most of those arrested were students, including several who had been trying to flee the town. Mr Ibrahim told Reuters there were signs it had been an "inside job".
"Relatives of the slain students said the assailants called their names out before killing them. The majority were killed with gun shots or slaughtered like goats," he added.
Accounts of the scale of the attack vary. A local resident and a school official have been quoted as saying at least 40 people were killed - the official reportedly saying only 25 bodies were taken to the morgue because relatives took away the bodies of the other 15.
But police say the motive for the attack is still not clear.
Some of the dead in Mubi were Muslim while others were Christian. Two security guards and an elderly resident were among the victims, the police said.
A former president of the National Association of Nigerian Students, Ken Henshaw, told the BBC that the killings were "simply shocking".
But he added: "It seems to make a lot of sense that it could have been an outcome of the elections that were held the previous day.
"You may want to know that the rector of the polytechnic is from south Nigeria and he's a Christian and the fact that he is rector had caused some tensions in the institution already. And, surprisingly, the person who won the election is a Christian.
"So I think that that was a breaking-point and the whole thing just flipped over [into violence]."
Monday night's attack also came days after dozens of people with suspected links to the Boko Haram militant group were arrested in the town.
Boko Haram has not yet commented on the attack. It is fighting to establish Islamic law in Nigeria and has killed more than 1,000 people in numerous attacks across northern and central areas this year.
Adamawa state has a mixed Muslim and Christian population and borders Borno state, where Boko Haram came to prominence in 2009, staging an uprising in the capital Maiduguri.