Nigeria'n troops moved house to house in the northeastern town of Mubi in a bid to find attackers responsible for killing 25 people in a college student housing area.

The search on Wednesday followed a dusk-to-dawn curfew that was imposed after assailants in the West African nation shot dead or slit the throats of students in their accommodations outside the campus of the Federal Polytechnic Mubi college. The attack occurred between 10pm on Monday and 3am on Tuesday.

"The military is going house to house searching," said Abubakar Ahmed, head of the Red Cross in Adamawa state.

Goodluck Jonathan, Nigeria's president, called the massacre "sad and shocking" while directing security agencies to find the perpetrators, his spokesman said.

"The president described the incident as tragic, sad and shocking," Reuben Abati told reporters on Wednesday,

"He has directed security agencies to investigate the matter and get to the root because this kind of incident where people are called out and shot is really shocking."

Al Jazeera's Yvonne Ngege, reporting from the capital Abuja, said that Nigerian police had cordoned off the area in which the students were killed, including the college. 

Yushau Shuaib, a National Emergency Management Agency spokesperson, said it was not clear whether the attack was the work of Boko Haram, a group blamed for previous deadly assaults, or the result of a dispute between rival political groups at the university.

Officials also pointed out that the attack could be related to a students' election that was recently held at the school. Shuaib said initial reports indicated one of the victims was a candidate in the poll.

"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.

'Disputed election'

Police were investigating whether the killings might have been motivated by a political feud inside the college, the Reuters news agency reported.

Al Jazeera's correspondent also said that emergency services believed this attack was related to a disputed election at the campus.

"What we do know, speaking to the police and emergency services, is that these students were attacked in the dead of night. Many of them were fast asleep when these gunmen stormed their dormitory," Ndege said. 

"The emergency services are saying that sometime ago there was some kind of a disputed election at campus ... and it's believed that this could have been some kind of a premeditated attack by those involved with the polytechnic."

"'The reason they say this is because names, individual names, were actually called out by the gunmen before the students were attacked."

Adamawa state police spokesman Ibrahim Muhammad said 25 men were killed: 19 students of Federal Polytechnic Mubi, three students of another college, an ex-soldier, a security guard and an elderly man.

He said the student halls had been raided by police last week as part of a crackdown against Boko Haram.

Boko Haram rule out

During the raid, police recovered weapons including a rocket propelled grenade, dozens of homemade bombs, knives and automatic assault rifles.

"Boko Haram [attackers] open fire sporadically," said Muhammad.

"In this case, the attackers called their victims by name and left other people in the room alone. This is not the modus operandi of Boko Haram."

"It is the work of insiders," Muhammad said.

The college attack follows the killing on Saturday of three students outside a university campus, about 170km away, in the city of Maiduguri.

Ahmed Mohammed, a spokesman for the University of Maiduguri, said on Monday that the university was aware of the attack but that he could not comment since it occurred off school premises.

Adamawa state, where Mubi is situated, has a mixed Muslim and Christian population and borders Borno state, where Boko Haram came to prominence in 2009, staging an uprising in the state capital, Maiduguri.

Source: Al Jazeera and agencies