At least 20 people, mostly students, have been killed by unknown gunmen in Mubi, north-eastern Nigeria, a police source has told the BBC.
The attack happened at a student hostel away from the Federal Polytechnic Mubi campus, the source said.
One Mubi resident told the BBC that more than 40 students had been killed but there is no official death toll.
The reported killing comes days after a major operation against the Boko Haram militant group in the town.
National Emergency Management Agency spokesman Yushua Shuaib confirmed the attack to the Reuters news agency but had no details on casualties.
He said it was not clear whether the attack was the work of Boko Haram, or the result of a dispute between rival political groups at the university.
A Red Cross official said at least 10 people had died, reports the AFP news agency.
BBC Nigeria correspondent Will Ross says mobile phone masts in the area were recently attacked by the militants, so getting information from Mubi is difficult.
'Everybody is scared'
The resident, who did not want his name to be used, told the BBC's Hausa service that men in military uniform asked the students to line up and then say their names.
Some were then shot dead and others stabbed with knives, and their bodies left in lines outside the buildings.
He said it is not clear why some were killed and others spared - some of those killed were Muslims and others Christian.
"Everybody is scared," he said.
He added that students were now leaving the town, many with tree branches over their cars - a traditional sign of neutrality in Nigeria.
Other Mubi residents say they heard gunfire for about two hours during the night and that those living near the hostel were also targeted.
The authorities have imposed an indefinite curfew in the town and ordered residents to stay indoors.
The university has been temporarily closed.
Last week, the Nigerian military carried out an operation in Mubi and arrested dozens of people over suspected links to Boko Haram.
Mubi is in Adamawa state, which 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.
Boko Haram has not yet commented on the Mubi attacks.
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.