BAGHDAD — Even with Iraqi security forces on a heightened state of alert in advance of Sunday’s national elections, dozens of Iraqis were killed Wednesday in a devastating series of suicide bombings in the restive city of Baquba.

The attacks began with two car bombings near campaign offices and government buildings.

Then, as swarms of people rushed to a local hospital, ferrying the dead and wounded and looking for relatives, a man hiding a suicide belt under a dirty white robe entered the emergency room, a local policeman said.

An injured man at the hospital said he noticed the attacker just before the explosion.

“Then I saw a huge flame crashing down on me,” said the man, who gave his name only as Muhammad. “There was fire everywhere. I passed out and was awakened by the wails of a woman weeping over an injured 7-year-old boy. There were bodies and blood everywhere. It was horrific.”

Grieving relatives screamed amid the rubble, calling out the names of loved ones even as security officers scrambled to lock down the entire city. The attacks left at least 31 people dead and 55 wounded, according to local security officials.