BAGHDAD — Suicide bombers detonated two car bombs on Tuesday outside the governor’s compound in a city in southern Iraq, killing at least 27 people, many of them police officers, and wounding dozens of others, local officials said.

The governor, Salem Alwan Hussein, was “fine” after the attack in the city of Diwaniya, a local security official said. The bombings were part of a spike in violence across Iraq on Tuesday.

Roadside bombs were detonated near American convoys in the cities of Hilla, Tikrit and Samarra, and militants fired rockets into a United States military base in Baghdad, where five soldiers were killed in a rocket attack two weeks ago and a sixth later died of wounds.

A United States military official said only that a United States convoy in Basra was attacked on Tuesday, adding that there were no injuries. The official said that mortars were fired at the military base in Baghdad but that none of them landed in the base and there were no injuries.