The Iraqi premier sacked three Baghdad security chiefs following a devastating bombing in the capital, his office said on Friday, hours after another attack to the north left 40 dead.
The Islamic State (IS) militant group said it carried out the latest attack -- on a Shia shrine in the town of Balad that began Thursday evening -- as well as Sunday's bombing which killed 292 people, one of the deadliest to ever hit Iraq.
A suicide bomber blew up a minibus packed with explosives in a Baghdad shopping district teeming with people ahead of the Eid al-Fitr holiday, sparking widespread anger against the government.
Iraq's interior minister tendered his resignation after the bombing, but the Friday statement was the first announcing that officials were fired following the attack.
Prime Minister Haider al-Abadi issued "an order to relieve the Baghdad Operations commander of his position," as well as remove the officials responsible for intelligence and security in the capital, his office said.
The head of the Baghdad Operations Command was Lieutenant General Abdulamir al-Shimmari.
An official in Abadi's office said the others removed were the head of interior ministry intelligence for Baghdad and the official responsible for the capital in the national security adviser's office.
In Thursday evening's attack, militants targeted the Sayyid Mohammed shrine in Balad, 70 kilometres (45 miles) north of Baghdad, Joint Operations Command spokesman Yahya Rasool told AFP.
It killed 40 people and wounded 74, health ministry spokesman Ahmed al-Rudaini said.
The shrine was attacked with mortar fire, then by suicide bombers wearing security force uniforms, Rasool said.
Security forces fired on the bombers, who were not able to enter the shrine, and two of them blew themselves up, while a third was shot dead, he said.
The attack sparked a fire that caused heavy damage to the market near the shrine, an AFP journalist reported.
IS group issued a statement claiming the attack, saying that five militants took part, killing guards at the shrine, then clashing with Iraqi forces for hours before detonating explosives they were carrying.
The IS group statement did not mention mortar fire.
"It is clear the cowardly attack on the shrine aims to spark sectarian tensions and drag Iraq back to the dark days of sectarian conflict," Jan Kubis, the UN's top Iraq envoy, said in a statement.
On Thursday, Health Minister Adila Hamoud said the bodies of 115 killed in the Baghdad bombing on Sunday had now been handed over to families, while the identities of 177 others had yet to be determined.
Two days earlier, when the full scale of the death toll had yet to emerge, the minister had told AFP that the process of identifying all of the dead was expected to take between 15 and 45 days.
People have been furious over delays in determining the fate of their loved ones, and with the number of unidentified bodies now bigger, it may take even longer.
The attack has overshadowed what would normally be a joyful holiday for Iraqi Muslims.
Police Major General Talib Khalil Rahi said on Thursday that the suicide bomber detonated a minibus loaded with plastic explosives and ammonium nitrate, the first time authorities provided details about the bomb used in the attack.
The initial blast killed a limited number of people, but flames spread and trapped people inside shopping centres that lacked emergency exits, Rahi told a news conference.
Interior Minister Mohammed Ghabban tendered his resignation following the bombing, and authorities also announced the execution of five convicts and the arrest of 40 militants in an apparent bid to limit the political fallout.
An official from Abadi's office told AFP on Wednesday that the premier had accepted the minister's resignation, though there has been no official statement from him on the matter.
In recent months, IS group has lost significant parts of the territory north and west of Baghdad which it seized in 2014.
The Sunni extremist group has responded to the battlefield setbacks by hitting back against civilians, particularly Shias, and experts have warned there may be more bombings as the militants continue to lose ground.