A suicide bomber detonated an explosives-rigged vehicle at a popular Baghdad ice cream shop early on Tuesday, killing at least 15 people.

The attack in Karrada district in central Baghdad also wounded at least 30 people, officials said.

Videos posted to social media showed chaotic scenes on the streets surrounding the blast.

Ice cream and blood stain the floor. But ISIS underestimates our resolve. Iraqis will be back on these very streets tomorrow night pic.twitter.com/i83YoDZXMe — Ali Hadi Al-Musawi (@ahmusawi) May 29, 2017

A number of wounded lay on the ground, others propped themselves up on the colourful park benches outside the ice cream shop.

One young girl, wearing a ribbon and bow in her hair, wandered the scene dazed.

The attack struck just days into the holy month of Ramadan when Muslims fast during daylight hours. As families break their fast after sundown, restaurants and cafes in Baghdad quickly fill up.

The officials say the bombing in central Baghdad involved explosives in a parked car that a bomber detonated. The officials spoke on condition of anonymity in line with regulations.

ISIL claim

The Islamic State of Iraq and the Levant's (ISIL, also known as ISIS) Amaq website said the suicide bomber targeted a "gathering of Shia".

ISIL considers members of Iraq's Shia Muslim majority to be heretics and frequently carries out attacks against them.

"Families were out and the place was crowded," Hayder al-Khoei, a London-based Middle East expert, told Al Jazeera.

"[ISIL] wants Iraqis to fear going out and this is to show they are still present and able to attack the heart of the Iraqi capital, even as they are being defeated on the battlefield."

Brett McGurk, US special envoy to the anti-ISIL coalition, tweeted: "ISIS terrorists tonight in Baghdad target children and families enjoying time together at an ice cream shop. We stand with Iraq against this evil."

Monday's attack comes as Iraqi troops are slowly pushing ISIL fighters out of their last strongholds in the northern city of Mosul.

Iraqi commanders say the offensive, which recently entered its eighth month, will mark the end of the ISIL caliphate in Iraq, but concede the group will likely increase attacks in the wake of military defeats.

Khoei explained that the armed group "timed Tuesday's attack to cause maximum impact".

"The suicide bomber detonated himself just after midnight. It was a hot day and he targeted a popular ice cream parlour in Baghdad."

Michael Pregent, former US army officer and Iraqi government adviser with the Hudson Institute think-tank, told Al Jazeera: "[Tuesday's attack is] meant to stoke a sectarian flame to get some sort of response from Shia militias from the government. It's also meant to discredit the Baghdad government.

"That's something that Shia militias, recently criticised by Prime Minister Haider al-Abadi, can also use to criticise the current government ahead of the 2018 elections."

Memories of 2016 attack

Ramadan is often marked by an uptick in violence in Iraq.

Last July, towards the end of the holy month, ISIL used a big truck bomb during Ramadan at a busy Karrada market packed with people shopping after sunset and preparing for the Eid celebration.

Close to 300 people were killed in that attack.

READ MORE: Iraq: Baghdad bombing kills more than 200

The blast was the single deadliest event in Baghdad since Saddam Hussein was toppled in 2003.

ISIL claimed responsibility for that bombing, which ultimately led to the resignation of Iraq's interior minister.