Gunmen shot dead at least 26 students in an attack overnight on their college residence in northeast Nigeria, a college spokesman said on Tuesday.
The attack took place at the Federal Polytechnic Mubi in remote Adamawa state late on Monday night, the head of the information department at the college said by telephone.
"The killers went from room to room, slaughtering them one by one," said witness Mohammed Awal, who was not harmed in the attack. Some were shot, others killed with machetes, he said.
Adamawa state, like much of the north, has been targeted by Islamist insurgents, but police were also investigating whether the killings might have been motivated by a political feud inside the college.
"We learned that when they came for the attack, they called out the names of some of the victims and killed them as they came out. Some they left alone, which gives us a clue that this was the work of insiders," said Adamawa police spokesman Mohammed Ibrahim. He put the toll confirmed by police at 25.
He said the student halls had been raided by police last week as part of a sweep against Boko Haram militants. During the raid, police recovered weapons including a rocket propelled grenade, dozens of homemade bombs, knives and automatic assault rifles. He added that it could not be ruled out that Boko Haram militants who had infiltrated the students were behind it.
A security source and several witnesses put the overall death toll from the attack at 40.
The Boko Haram Islamist sect, which usually targets politicians or security forces, has also attacked students in the past and has cells in Adamawa. Security sources believe it has infiltrated several institutions, including colleges.
But police were also investigating the possibility that the killings were related to a dispute between rival political groups at the college over a student union election on Sunday, in a part of Nigeria that is awash with weapons.
Colleges across the country are sometimes plagued by armed gangs and vigilante groups.
"The crisis in Mubi is suspected to have been fuelled by campus politics after the election ... the ones who were disgruntled might have ... (carried out) the attack," said National Emergency Management Agency spokesman Yushua Shuaib.
Boko Haram is widely considered to be the biggest security threat in Nigeria, Africa's biggest oil exporter. It has been blamed for more than 1,000 deaths since its insurgency - which aims to carve out an Islamic state out of northern Nigeria - intensified in 2010.
Boko Haram's purported leader released a video on Monday in which he vowed to continue fighting and said no peace talks with the government could happen while military raids against sect members continued.