Militants seized control of a prison in the Iraqi city of Tikrit on Thursday night after fierce clashes with guards that left at least two dead and allowed some prisoners to escape.
The assault comes after Al-Qaeda's Iraqi front group announced a campaign to regain territory and said it aimed to help its jailed members escape.
"The attackers are controlling all the (entrances and exits) and the observation towers, and ... security forces are surrounding the prison," Salaheddin provincial deputy governor Ahmed Abdul Jabbar Abdul Karim told AFP by telephone.
An interior ministry official also said the gunmen took control of all the exits and entrances to the prison in Tikrit, 160 kilometres (100 miles) north of Baghdad, and that two police were killed in the fighting.
A police officer put the toll from attack at four police and two gunmen killed.
Police Lieutenant General Rashid Fleih, the head of the Samarra Operations Command, said on Sharqiya television that prisoners had escaped from the Tikrit prison, and that 13 were captured, while a small number were still at large.
Accounts differed as to whether the unrest began with an outside assault, a riot inside the prison, or possibly both.
"A suicide bomber targeted the gate of the prison with a car bomb and gunmen then assaulted the prison, after which they killed the guards," a police lieutenant colonel said.
A police colonel said there were "clashes between police and gunmen inside the prison, and a curfew has been announced in Tikrit."
Signup to our newsletter and follow us on Facebook and Twitter!
Another colonel said riots broke out inside the prison, after which police sought to bring them under control.
"The prisoners killed one policeman and wounded (prison director) Brigadier General Laith al-Sagmani," the colonel said, adding that "the gunmen took control of the prison, and clashes are continuing."
A traffic police lieutenant colonel who was near the scene of the attack said militants blew up a portion of the prison fence, and that between 30 and 40 prisoners were able to escape.
And other witnesses said prisoners seized the guards' weapons, and that more than 100 of them escaped and fought security forces in the surrounding area.
The tactics employed in the assault were reminiscent of those used in attacks in July and August.
Gunmen attempted to use bombs to breach a prison gate in Taji, north of Baghdad, on August 1, after using similar tactics on the anti-terrorism directorate in the capital the day before in an attack the interior ministry said was an attempt to free inmates.
Al-Qaeda's front group the Islamic State of Iraq said in July that it was launching a "new military campaign aimed at recovering territory."
An earlier message posted on jihadist forums said the ISI would begin targeting judges and prosecutors, and try to help its prisoners break out of jails.
While insurgents opposed to the Baghdad government are regarded as weaker than in past years, they have shown they can strike at even the most highly secure sites in Iraq.
In addition to the prison in Taji and the anti-terrorism directorate, targets in recent months have included a police station, a military base and an entrance to Baghdad's heavily fortified Green Zone, where the government is headquartered.