BAGHDAD -- Government forces and allied Sunni tribal fighters battled to dislodge militants from a small town north of Baghdad on Monday, while two car bombs in the capital killed at least seven people, officials said.

The clashes in Duluiyah are part of the Islamic State extremist group's larger offensive across Iraq as it tries to expand the territory under its control.

Fighters from the jihadi group barrelled into town, some 80 kilometres north of Baghdad, on Sunday, and quickly seized the mayor's office, police station, local council and courthouse. They also blew up a bridge connecting the town with the nearby city of Balad.

The Iraqi military launched a counterattack, but the fighting bogged down and was still raging Monday, officials and a resident said.

Jassim Mohammed, who lives in Duluiyah, said dozens of militants in SUVs quickly pushed into the neighbourhoods of Khazraj and Boujwar before facing stiff resistance from the Joubour tribe. The fighting Monday was with machine-guns and RPGs, and there were casualties on both sides, Mohammed said.

He added that most of the tribesmen battling the militants are members of the local police force, which is largely composed of former army soldiers from the Saddam Hussein-era.

"They will not give up easily, the battles are fierce and ongoing," Mohammed said.

Since capturing the northern city of Mosul last month, the Islamic State group and other Sunni militants have seized control of much of northern and western Iraq. Their offensive has slowed since the initial burst, but the insurgents have vowed to push on to Baghdad.

The capital has seen several small scale bombings, but no major attacks, since the militant offensive began. The blitz has caused jitters in Baghdad, where Shiite militias have joined security forces in recent weeks to try to boost security in the city, although relatively minor attacks still happen almost daily.

On Monday, two car bombs exploded in commercial areas of Baghdad, killing at least seven people.

The deadliest attack took place in Baghdad's Allawi neighbourhood, a predominantly Shiite district near the Green Zone that is home to many government offices and foreign embassies. A police official said four civilians were killed and 12 wounded in that blast.

He said the casualties could have been much worse, but the area was not crowded early Monday because of a state holiday to commemorate the 1958 Revolution that overthrew the monarchy.

A second vehicle packed with explosives blew up near a string of car dealerships in Baghdad's southeastern Bayaa area, killing at least three people and wounding eight, the official said. The explosion also damaged several cars.

All officials spoke on condition of anonymity because they were not authorized to brief the media.

Associated Press writers Bassem Mroue in Beirut, and Murtada Faraj in Baghdad contributed to this report.