Huthaifa al-Batawi, known as al Qaeda's "Emir of Baghdad" and accused of a deadly attack on a Catholic church, was killed along with 10 other senior al Qaeda militants, said Baghdad's security spokesman Major-General Qassim al-Moussawi.
The skirmish at an Interior Ministry counter-terrorism unit jail complex in Baghdad's central Karrada district began when a prisoner grabbed a gun from a guard, killed several guards and ministry officers, and gave a weapon to other inmates, Moussawi said.
Inmates controlled a section of the facility for several hours before a SWAT team brought the siege to an end, security officials said.
Iraqi Prime Minister Nuri al-Maliki ordered an investigation into the incident and told security forces to be extra vigilant.
"We must not allow such setbacks to happen in the security field," Maliki said in a statement issued by his office.
Iraqi security forces are preparing to take sole responsibility for security ahead of a full withdrawal of U.S. troops from Iraq by December 31 in line with a joint security pact.
The jail housed about 250 inmates, many of them members of al Qaeda, one source said.
"Security forces and guards responded to the jail of the counter-terrorism department and killed 11 terrorist-prisoners ... including Huthaifa al-Batawi, the Emir of Baghdad, who was in charge of planning the church attack," Moussawi said.
Moussawi said seven security officers -- including Brigadier Muaid Mahdi, head of investigations at the counter-terrorism unit -- were killed in the skirmish and one other was wounded.
A senior security official, who asked not to be named, said eight terrorism suspects, most facing death sentences, were killed along with nine security officers, three of them senior officials.
Batawi was arrested along with 11 others in late November in connection with the October 31 assault on Our Lady of Salvation church during Sunday mass. Dozens of hostages and police died when Iraqi forces tried to free more than 100 Catholic hostages.
The attack was the bloodiest against Iraq's Christian minority since the 2003 U.S.-led invasion.
Security officials said it was Batawi who started the jail battle by seizing a guard's gun in an attempt to flee.
Moussawi said the situation at the jail was under control and no prisoners had escaped.
Iraqi security forces have been on high alert for revenge attacks by al Qaeda since U.S. commandos killed the group's leader Osama bin Laden in Pakistan Monday.
Iraq became a major battlefield for the Islamist militant group after the invasion that toppled Saddam Hussein.
One Iraqi security official estimates the group is behind 70 percent of the scores of bombings and other attacks carried out in Iraq every month.