Updated

A homicide bomber attacked a Sunni funeral just west of Baghdad Wednesday, killing 22 people and wounding at least 40, according to Iraqi police.

The funeral was for grammar school principal Taha Obaid, who was shot and killed at his school the previous day. The bomber blew himself up inside a tent set up at the service in Abu Minasir, a village west of Iraq's capital city.

The funeral was attended by several members of so-called Awakening Councils, made up of Sunni Muslims who have switched sides to fight Al Qaeda.

Col. Faisal al-Zubaie, the director of police in nearby Fallujah, said the original death toll was 18, but some people died later.

Mosques were calling for donations of blood to treat those wounded in the explosion, according to al-Zubaie.

Earlier Wednesday, a female homicide bomber set off a deadly explosion in Baghdad.

U.S. and Iraqi military officials said the girl or woman was strapped with explosives that were detonated by remote control when she approached an Iraqi Army commander in Youssifiyah.

The Army captain was killed in the attack and at least four soldiers were wounded, according to Iraqi Army Lt. Ahmed Ali.

Reports that the bomber was a young girl could not be confirmed.

Elsehwere in Baghdad, a car bomb exploded next to a convoy carrying a Sunni lawmaker.

Police said one civilian was killed and 20 others wounded, including four guards. The lawmaker was not hurt.

In another incident, a U.S. soldier reportedly died in a roadside bombing on Tuesday. Officials were withholding the soldier's name and unit until family could be notified.

Also Wednesday, Prime Minister Nouri al-Maliki visited the northern city of Mosul to supervise a military offensive against Al Qaeda in Iraq, a defense ministry spokesman said.

Al-Maliki's flight to northern Iraq mirrors a similar trip he took almost two months ago to the southern city of Basra, where government troops fought radical Shiite militias. That fighting spread to the Shiite slum of Sadr City in Baghdad, where a cease-fire to end the fighting was reached on Monday.

"The Iraqi prime minister has arrived in Mosul to supervise the military operations, and its second phase is due to start today," Mohammed al-Askari, the spokesman of the Iraqi Defense Ministry, told The Associated Press. "The main aim of this operation is to purge and clean Ninevah province of all militants and their weapons and declare it a safe area."

Mosul is considered the last important urban staging ground for Al Qaeda in Iraq after the terror group lost its strongholds in Baghdad and other areas during the U.S. troop buildup last year. Al-Maliki has been promising a crackdown since last January. But no major offensives have been mounted even as Al Qaeda in Iraq tried to exert its influence through attacks and intimidation.

U.S. military spokesman Maj. Gen. Kevin Bergner said U.S. forces were providing close support to Iraqi troops, who had arrested more than 500 people in Mosul and captured five weapons caches. He said the operation was shifting gears.

"This (new) phase has featured intensified operations by Iraqi security forces," Bergner said.

In western Iraq, a senior U.S. commander said Wednesday that Al Qaeda persists and that a recent increase in attacks shows that the group remains a threat there. A group of Al Qaeda fighters recently infiltrated the area, went to the homes of 11 Iraqi police officers and beheaded them and one of their sons, he said.

Marine Maj. Gen. John Kelly, the commander of U.S. forces in Anbar province, said it appeared the insurgents crossed from the Syrian border, talked their way through a checkpoint and then went around a town grabbing police individually.

"Al Qaeda is not defeated. It's an ideology," he said. "Al Qaeda is still operational but on a smaller scale."

In western Baghdad, a car bomb detonated next to a convoy carrying a lawmaker from the mostly Sunni Islamic Party. But lawmaker, Ayad al-Samarrie, was unhurt, police said. One civilian was killed and 20 others wounded, including four guards, they said.

Sadr City was largely quiet Wednesday as Shiite fighters appeared to respect a cease-fire agreement, though some skirmishes were still being reported. The fighting left five dead and 22 wounded, according to hospital officials.

"The cease-fire is still active and we are still at square one," said Maj. Gen. Qassim al-Mousawi, an Iraqi army spokesman. "Nothing has been achieved so far as security forces are still waiting for the Sadrist leaders to prepare the appropriate atmosphere to enable our security forces to enter Sadr City to do their duties."

The Associated Press contributed to this report.