Gunmen set off bombs in an attempted prison break in the northeast Nigerian city of Gombe late on Friday and then blew up the local police station, triggering hours of battles that killed 12 people, the city's commissioner of police said.

Witnesses in Gombe heard multiple explosions and gunfire late on Friday in the city, which has been largely free of the Boko Haram Islamist insurgency plaguing the north of Africa's top oil producer.

"There were several explosions. They wanted to break open the prison, but the policemen on guard there repelled them," Gombe police commissioner Gandi Ebikeme Orubebe told Reuters by phone.

"So they attacked the police station and blew up everything there. Two policeman died, one soldier was injured," he said, adding that 10 other people, civilians and attackers, were also killed in the ensuing shootouts.

Three suspects were arrested, he said.

He earlier said the 10 killed were attackers, but in subsequent phone call said: "Some were civilians and some of the hoodlums also died. It's not clear how many civilians."

On February 16, gunmen stormed a prison in Kogi state in central Nigeria, killing one warden and freeing 119 prisoners, none of whom however were known members of the shadowy sect waging an insurgency to impose sharia law on Nigeria.

Orubebe said there were no Boko Haram members in the Gombe prison either. The Islamists were behind a prison break in northern Bauchi state in 2010 when 700 prisoners were freed.

Because the secretive sect rarely claims attacks, except the most high profile, it has become a convenient cover for criminal gangs, similarly armed with guns and explosives.

Asked if the attackers were from Boko Haram, Orubebe said:

"We can't know. They could be hoodlums, criminal elements, miscreants. We've not had any problem with Boko Haram before in Gombe, but that fact that lightening has not struck does not mean it won't ever strike."

Reporting by Tim Cocks; Editing by Ruth Pitchford