Suicide bombings claimed by the Islamic State group killed at least 27 people in Baghdad, officials said on Tuesday, as Iraqi forces fight to retake the last jihadist-held areas in Mosul.

In the deadlier of the two attacks, a suicide bomber detonated an explosives-rigged vehicle at a popular ice cream shop at around midnight (2100 GMT Monday), killing at least 16 people and wounding 75.

The bomber struck just days after the start of the holy Muslim fasting month of Ramadan, during which Iraqis often stay out late shopping or socializing after breaking their daily fast.

ISIS issued statements claiming blast at the Al-Faqma ice cream shop and a later attack, saying both were suicide car bombings targeting members of Iraq's Shiite Muslim majority, whom the group considers heretics.

Related: Suicide attacks are rare in the West — but part of a growing global trend

Haidar Hussein, a 22-year-old who was wounded in the blast, was sitting with friends at a small coffee shop near Al-Faqma.

A police captain tried to prevent a small white pickup truck from approaching the area, but the driver kept going forward and then the truck exploded, Hussein said.

The blast spread rubble everywhere, sparked a fire and threw Hussein to the ground, injuring his arm and leg.

Devastating blast

After checking himself for wounds, he began to look for his friends.

"Many people were on the ground, including women and children, and the screams of the women and children got louder," he said.

Among the dead was Hussein's 22-year-old friend Karar, who left behind two wives and three children.

Images posted on social media showed the devastating impact of the attack, which ripped through the crowded area around the ice cream shop in the Karrada district of central Baghdad.

One picture showed ice cream cups scattered on the blood-stained ground.

In the second attack, a suicide bomber blew up a bomb-rigged vehicle near the country's main pension office, which is close to one of the principal bridges over the River Tigris, said the Baghdad Operations Command.

The attack killed at least 11 people and wounded at least 40, officials said.

United Nations Secretary-General Antonio Guterres condemned the attacks "in the strongest terms," the UN said in a statement that termed the bombings an "outrage."

The bombings in Baghdad come as Iraqi forces fight to retake the last ISIS-held areas of Mosul, a city that was the jihadist group's most emblematic stronghold.

Iraqi forces are more than seven months into a massive operation to recapture the city from ISIS, and have already taken back its whole eastern side and much of the west.

Three neighborhoods north of Mosul's Old City — Al-Shifaa, Al-Saha and Al-Zinjili — are now the target of a broad assault by Iraqi soldiers, police and special forces that was launched last week.

On Tuesday, an Iraqi army officer said security forces were proceeding slowly in Al-Shifaa in a bid to protect infrastructure.

'Snipers and suicide bombers'

"The problem is that it is a neighborhood with four or five hospitals," Brigadier General Shakir Kadhim Mohsen told AFP in Mosul, adding that forces have permission to "take more time to spare the infrastructure and keep the civilians safe".

Mohsen said ISIS was mainly relying on "snipers and suicide bombers" to target Iraqi forces, as it is running low on mortar rounds and explosives after losing sites it previously used to produce them.

"There are 50 to 100 fighters moving from one building to another" in Al-Shifaa, he said.

The United Nations has warned that up to 200,000 civilians who are believed to remain in ISIS-held areas of the city are in grave danger and that large numbers could flee.

"We are deeply concerned that right now, in the last final stages of the campaign to retake Mosul, that the civilians ... in [ISIS] areas are probably at graver risk now than at any other stage of the campaign," Lise Grande, the UN humanitarian coordinator for Iraq, told AFP.

She said the UN estimates there are between 180,000 and 200,000 civilians in jihadist-held areas of Mosul, the majority of them in the Old City — a warren of closely spaced buildings and narrow streets that has posed a significant challenge to Iraqi forces.

Families who managed to flee ISIS-held areas have told the UN that food, water and medicines are in short supply and that snipers fire on civilians who try to leave, Grande said.

The World Food Program said Tuesday that it "has identified worrying signs of an increase in the rate of malnutrition among newly displaced children from western Mosul."

By AFP's Salam Faraj and W.G. Dunlop in Baghdad, with Simon Valmary in Mosul.