A double bombing struck at an upscale neighbourhood Iraq's capital Tuesday, killing at least 21 even though police stopped three attackers storming a counterterror unit, as the government strained to control al-Qaeda-based chaos gripping the country.

The bloody explosions came on the same day that Iraq's government discussed security issues with Iran, a measure of Tehran's growing influence.

Two cars parked in the mostly-Shia shopping district of Karradah exploded during the afternoon rush hour. Most of the dead were store owners and passers-by, although the blasts hit near two police headquarters and a security checkpoint, killing six policemen.

The bombs sent plumes of black smoke over the neighbourhood, located across the Tigris River from the Green Zone, and the sounds of gunshots could be heard from blocks away.

The violence brought the July death toll to 245 people killed in shootings and bombings, approaching the carnage in January, when 255 people were killed following the U.S. pullout.

Al-Qaeda has claimed responsibility for nearly all the attacks as it seeks to take advantage of political instability in Iraq and move back into areas it was forced to abandon before the U.S. military left the country last December.

Security forces and government offices are top targets for insurgents seeking to prove how unsafe Iraq remains.

Tuesday's second bomb exploded outside an Iraqi passport office, a few blocks away from the Interior Ministry's major crimes unit headquarters. Fifteen people were killed and 35 wounded, officials said.

Crimes unit, passport directorate targeted?

Saadoun Hussein was selling cigarettes in a small shop nearby when the roof partially caved in from the second blast. He escaped unharmed.

"I think that terrorists were intending to attack the passport directorate, but failed to reach their target because of the traffic jam," said Hussein, 23.

Police said two suicide bombers and a gunman broke into the crimes unit, which also handles counterterror cases, but they were killed before they could unleash widespread damage.

The Interior Ministry said in a statement that the three aimed to free terror suspects who were being held there. It said three security force members were killed in a shootout. Authorities had control of the situation by Tuesday evening, said Col. Dhia al-Wakil, spokesman for the operations command in Baghdad.

Five minutes earlier, the first bomb went off outside a restaurant at a busy intersection, down the street from a police station and a security checkpoint. Six people were killed and 21 wounded.

Police and health officials confirmed the casualties but spoke on condition of anonymity because they were not authorized to release the information to reporters.

Earlier this month, al-Qaeda's leader in Iraq threatened to push back into areas the group was driven out of after sectarian fighting peaked in 2007. A day after al-Qaeda issued the threat, shootings and bombings killed 115 people in Iraq's deadliest day in more than two years.

Tuesday's explosions struck as Iraqi officials announced two efforts to make their country safer — and both were linked to Iran.