An explosion at a booby-trapped house, ensuing clashes with fighters and a roadside bombing killed 18 soldiers in Iraq, authorities said.

The blast happened Saturday afternoon when a group of soldiers searched a farmhouse in Garma, an area near the city of Fallujah, 65km west of the capital. Minutes later, police said gunmen opened fire on arriving soldiers.

The blast wounded 24 soldiers and leveled the home, officials said.

In other attacks, police said a roadside bomb targeting a military convoy killed three soldiers and wounded seven just north of Baghdad, the AP news agency reported.

Medical officials at two Baghdad hospitals confirmed the casualties. All officials spoke on condition of anonymity as they weren't authorised to speak to journalists.

Al-Qaeda-inspired fighters took control of Fallujah and parts of Ramadi in late December, taking advantage of a months-long surge in Sunni discontent against the government of Prime Minister Nouri al-Maliki.

The takeover was sparked when security forces arrested a Sunni politician sought on "terrorism charges", then dismantled a year-old Sunni anti-government protest camp. They later pulled out of the area to calm angry residents, allowing the fighters to take control.

Violence has been escalating in Iraq. Last year, Iraq saw its highest death toll since the worst of the country's sectarian bloodletting began to subside in 2007, according to United Nations figures.