Three attacks rock areas north of Baghdad, including an ISIL-claimed bombing targeting Shia mourners at a funeral tent.

A series of attacks has killed at least 47 people in Iraq, including a suicide bombing claimed by ISIL that was the deadliest to hit the capital Baghdad in months.

In Saturday’s most violent attack, a suicide bomber targeted a funeral gathering in northern Baghdad, killing at least 35 people and wounding 63, Iraqi police and hospital officials said.

A witness told The Associated Press news agency that the bomber entered the funeral tent and blew himself up as lunch was being served.

Blood stained the ground at the scene of the attack, which was littered with the remains of plastic chairs.

READ MORE: ‘Booby-trapped’ ISIL drone in deadly Iraq attack

ISIL, also known as the Islamic State of Iraq and the Levant or ISIS, issued an online statement later claiming the attack and saying it had been carried out by a man who detonated an explosive vest.

ISIL frequently carries out suicide bombings targeting Iraq’s Shia majority, whom it considers heretics.

The attack was the deadliest to hit the Iraqi capital since early July, when a suicide bombing in central Baghdad sparked fires in a crowded shopping area, killing more than 300 people.

Also on Saturday, armed men attacked two other areas north of Baghdad, killing a further 12 people, according to police.

In Malha, an area east of the city of Tikrit, suicide bombers attacked a federal police position, killing eight and wounding 11, officers said.

And in the Ishaqi area south of Samarra, two armed men shot dead the wife and the three children of the commander of local tribal forces, before fleeing and blowing themselves up when they were cornered by Iraqi troops.

ISIL has previously increased attacks inside government-held territory far from the front lines after suffering territorial losses on the battlefield.

An attack on October 9 killed at least five people, while two more earlier in the month left at least 10 dead.

On Friday, ISIL crushed a rebellion plot in Mosul led by one of its commanders who aimed to switch sides and help deliver the city to Iraqi forces.

ISIL executed 58 people suspected of taking part in the plot after it was uncovered last week.

Residents, who spoke to Reuters from some of the few locations in Mosul that have phone services, said the plotters were killed by drowning and their bodies were buried in a mass grave in a wasteland on the outskirts of the city.

The latest attacks come as Iraqi forces prepare for an offensive in northern Iraq to retake Mosul from ISIL.

Iraqi officials say a massive ground assault could begin this month, backed by US air power, Kurdish security forces and Shia and Sunni irregular units.

The United Nations says the operation could create the biggest humanitarian crisis in the world, in a worst case scenario uprooting up to one million people.