BAGHDAD — Iraqi forces battled gunmen trying to infiltrate the country from neighboring Syria on Monday, while attacks in Baghdad and north of the capital killed more than 20 people, officials said.

Twenty sport utility vehicles and more than two dozen motorcycles carrying gunmen tried to enter Iraq in Anbar Province, but Iraqi border forces turned them back after a two-hour clash, the Ministry of Interior said in a statement. It gave no details about casualties or the identities of the armed men.

Iraq has been seized by violence that has taken on sectarian overtones, and many fear that the civil war in neighboring Syria will only intensify those divisions. Some militant Sunnis linked to Al Qaeda have flocked to the rebel cause in Syria, fighting President Bashar al-Assad’s forces and the Shiites backing his government.

Major bombings in Iraq have become an almost daily occurrence, and on Monday three improvised explosive devices detonated in Baghdad, killing 9 people, three of them members of the Sunni Awakening movement, according to medical and security officials.