A massive bombing outside a popular ice cream parlor in central Baghdad and a rush hour car bomb in another downtown area killed at least 31 people on Tuesday, Iraqi officials said.
The Islamic State terror network claimed responsibility for the ice cream parlor attack -- but a source in Baghdad told Fox News a militia group unrelated to ISIS was responsible.
ISIS claimed responsibility in separate online statements, saying a suicide bomber carried out the attack. However, officials told Al Jazeera that the explosives were placed in a parked car.
Several militias have been fighting for control of the more lucrative areas of Baghdad, the source said.
Families with children were enjoying a late-night snack after breaking their fast for Ramadan when the explosions went off, according to Iraqi officials.
A closed-circuit camera video of the explosion showed a busy downtown avenue, with cars driving down the street, when the massive blast struck.
EGYPT SACKS LOCAL SECURITY CHIEF AFTER ATTACK ON CHRISTIANS
Then, a huge fireball engulfed a building, forcing the cars to scramble to get away. Videos of the attack posted on social media showed wounded and bloodied people crying for help on the sidewalk outside the ice cream parlor.
The attacks came as ISIS militants were losing more territory to U.S.-backed Iraqi forces in the battle for Mosul, the country's second-largest city. The Sunni extremists are increasingly turning to insurgency-style terror attacks to detract from their losses.
It was unclear how many of the dead were children. Al Jazeera reported that one girl, wearing a ribbon and bow in her hair, wandered around in an apparent daze after the blast.
In the second attack, an explosives-laden car went off during rush hour near the state-run Public Pension Office in Baghdad's busy Shawaka area, killing 14, a police officer said. At least 37 people were wounded in that attack, he added.
Police and security officials say the explosion in the Iraqi capital's bustling Karrada neighborhood early on Tuesday also wounded 27 people. The officials spoke on condition of anonymity in line with regulations.
ISLAMIC STATE MILITANTS SHELL BESIEGED SYRIAN CITY, KILL 13
Officials codemned the attack and spoke out against ISIS aafter the group claimed responsibility.
"[ISIS] wants Iraqis to fear going out and this is to show they are still present and able to strike the heart of the Iraqi capital, even as they are being defeated on the battlefield," Hayder al-Khoei, a London-based Middle East expert, told Al Jazeera.
Brett McGurk, the U.S. envoy to the coalition against ISIS tweeted, "Isis [IS] terrorists tonight in Baghdad target children & families enjoying time together at an ice cream shop. We stand w/Iraq against this evil."
The attacks came just days into the holy month of Ramadan when Muslims fast during daylight hours. After sundown, families break their fast and Baghdad's restaurants and cafes quickly fill up with people staying up long into the night.
During Ramadan last year, another section of Karrada was hit by massive suicide bombing that killed almost 300 people, the deadliest single attack in the Iraqi capital in 13 years of war. The attack was also claimed by ISIS.
Fox News' Hollie McKay and The Associated Press contributed to this report.