The firefight was the latest in a surge in bloodshed over the past year, amid fears insurgents could seek to destabilise the April 30 polls by upping the pace of attacks with violence already at its worst since 2008.
The bloodshed comes with campaigning under way for the elections, Iraq’s first since March 2010, which the UN’s special envoy has warned will be “highly divisive”.
On Thursday morning, militants attacked an army camp in Yusifiyah, just southwest of Baghdad, an interior ministry statement said.
More than 40 insurgents died in the ensuing battle, with one army officer also killed.
“Iraqi security forces confronted a failed attempt by Daash gang members to break into a military camp,” the statement said, referring to the Arabic abbreviation for the powerful Islamic State of Iraq and the Levant jihadist group.
“The security forces… killed more than 40 terrorist attackers, and the attack resulted in the death of one of our officers when he was confronting these criminal gangs.”
Two heavy machineguns, 15 rifles and five grenade launchers were seized, along with other equipment, the statement said.
The clashes in Yusifiyah come after days of fighting in the Zoba and Zaidan areas west of Baghdad.
The fighting spurred concerns that militants who have for months controlled the city of Fallujah, a short drive from Baghdad, could be looking to open a new front to encroach on the capital itself.
Elsewhere Thursday, a series of attacks nationwide, including four car bombs, killed eight people, security and medical officials said.