Violence elsewhere killed 10 people, including a police chief, four other police and a soldier, security officials and doctors said.
Mohammed al-Karoui, the commander of the army's 7th Division, was leading an operation to attack "hideouts of militants belonging to the Al-Qaeda organisation" in Sunni-majority Anbar province, which borders Syria.
He was killed along with four other senior army officers and 10 soldiers when they attacked a camp near Rutba, 380 kilometres west of Baghdad, the military officers said.
The defence ministry said the operation was launched after reports that Al-Qaeda militants had set up camps in the area to train militants in bomb-making.
More From This Section
Intelligence indicated that "the Al-Qaeda terrorist organisation opened camps to train its terrorist elements to make bombs and explosive belts" as well as car bombs, and that more than 60 militants were present in the Wadi Huran region of Anbar province, the ministry said.
Karoui's unit was tracking fleeing suspects when a bomb exploded, killing the major general, the other officers and the soldiers, the ministry added.
Prime Minister Nuri al-Maliki, who also heads the armed forces, offered his condolences.
"These heroes... Were carrying out the most noble battles against the enemies of God and humanity," said Maliki.
"They are fighting battles daily" to protect Iraq and its people, he said.
Maliki also urged the armed forces "to strike with an iron fist... These malevolent gangs and track them down wherever they may be".
In November, Maliki travelled to Washington where he discussed with President Barack Obama how to "push back" Al-Qaeda, which has been blamed for the surge in violence, the US leader said at the time.