The escaped prisoners included al-Qaida suspects, said a provincial spokesman, though he could not say whether the terror group was behind the jailbreak in Tikrit, 130 kilometers (80 miles) north of Baghdad.
It was the latest embarrassing security lapse in Iraq, raising questions about the Shiite-led government's ability to ensure the country's security in the wake of the U.S. troop withdrawal last December.
The prison riot erupted on Thursday night, said Mohammed al-Assi, the spokesman for Salahuddin province where Tikrit is the provincial capital. Several inmates broke into the prison storeroom, grabbing weapons that were kept there and overpowering the guards, he said.
The prisoners then engaged in a long gun battle with security troops inside the facility before breaking out hours later. By Friday morning, government troops had regained control of the prison, al-Assi said, and a curfew was imposed in Tikrit.
"Everything is under control now. Our security forces are chasing the escaped prisoners and have already recaptured some," al-Assi told The Associated Press in a telephone interview.
A provincial health official, Raed Ibrahim, confirmed that 12 people died in the violence — 10 prison guards and two inmates. He said 32 people were wounded in the clashes at the prison.
Qutaiba al-Jubouri, a lawmaker from the province, said a total of 81 inmates, including some who had been sentenced to death, managed to escape but that 36 of them were quickly recaptured.
"This is a regrettable security breach," said al-Jubouri, adding that an investigation will follow, "starting with the commanders of the security forces" at the prison.
He added that special forces were sent to Tikrit from Baghdad in order to put down the rioting. Security forces later dismantled three car bombs that were found parked near the prison.
Another lawmaker, Hakim al-Zamili, said the inmates burned all the prison records during the rioting, which will complicate efforts to track down those who escaped. He suggested the jailbreak was an inside job.
"This incident shows that Iraqi security troops are still unable to control the situation and that they are still being infiltrated by terrorists," added al-Zamili.
The Tikrit prison has been the scene of some stunning jailbreaks in the past. In 2009, 16 prisoners, including five al-Qaida-linked inmates awaiting execution, made their escape after plying open the bars on a prison bathroom window with a pipe wrench. At the time, the entire staff of the prison and the provincial prison official were detained for questioning. Six of the escaped inmates were later captured.
In 2010, a dozen detainees held on terrorism charges broke out of a prison in the southern city of Basra, disguised in police uniforms. And last year, al-Qaida smuggled weapons and grenades into a prison in Mosul, supposedly one of the country's most secure detention centers, and attempted an ultimately unsuccessful jailbreak that left 17 dead.
In Basra on Friday, gunmen shot dead the former governor, Mohammed al-Wailie, as he was driving his car in the city center, the police said. There were no immediate details or indications who was behind the attack.
Associated Press Writer Qassim Abdul-Zahra contributed to this report in Baghdad.