A suicide bomber exploded a pickup truck outside a residential complex belonging to a state-run oil company north of Baghdad on Tuesday, killing 22 people and wounding at least 50, local officials said.

In a separate attack northeast of the capital, four people were killed in a suicide bombing targeting a funeral procession for two members of an anti-al-Qaida organization, officials said.

Local authorities said that victims were still being pulled from the rubble of two destroyed buildings in Beiji, 155 miles north of Baghdad. At least three children were killed in the blast, which came amid a downturn in violence in the country.

The bomber detonated his explosives when Iraqi police and members of a volunteer security force prevented him from entering the gate of the compound belonging to the state-run North Oil Company, a police officer said.

Authorities imposed a curfew on the city — home to the country’s largest refinery — until further notice. Maj. Gen. Abdul-Karim Khalaf, a spokesman for the Interior Ministry, said that Beiji’s police chief had been fired.

Bloodied and bandaged victims crowded into rooms and hallways at the Beiji General hospital. Three bodies — one of a child — were laid out on the floor, covered with white sheets.

Iraq’s oil industry and those who work in it have come under repeated attack since the U.S.-led 2003 invasion, usually through bombings of key pipelines. Revenue from the oil industry is seen as key to funding Iraq’s reconstruction and sparking economic recovery.

The U.S. military gave different casualty figures, saying in a statement that 20 people were killed and 80 wounded. The reason for the discrepancy was not immediately clear.

The police officer said most of the 22 dead were civilians, and included three children. Also killed were guards of the oil company and members of the volunteer force, one of the so-called Awakening Councils — groups of Sunni Arab fighters who have turned against al-Qaida and are now funded by the U.S.

An official at the main hospital in Beiji gave the same death toll and said 65 were wounded. Both officials spoke on condition of anonymity because they were not authorized to release information to the media.

In Baqouba, 35 miles northeast of Baghdad, a suicide bomber detonated himself amid mourners at a funeral. At least four people were killed and 21 injured, a police officer said on condition of anonymity because he was not authorized to release the information. The funeral was being held for two members of an Awakening Council.

The Awakening Councils have been credited with helping reduce violence in Iraq in recent months. Although bombings and other attacks continue throughout the country, their number has fallen. The U.S. military has said there has been a 60 percent decrease in violence since June.

Meanwhile, the U.S. military said troops killed 13 suspected insurgents and detained another 27 on Monday and Tuesday in operations targeting al-Qaida in Iraq in the central and northern parts of the country.