At least 39 people were killed in Iraq on Saturday when a truck bomb exploded near a Sunni Muslim mosque west of Baghdad as worshippers were leaving.

The explosion, detonated by a suicide bomber, injured 62 people at the mosque in Habbaniyah, about 85 kilometres west of Baghdad in Anbar province, where many Sunni militant groups are said to be based.

The attack occurred one day after the mosque's imam had spoken out against extremists, including those with links to al-Qaeda militants.

Iraqi police said they think the bomber had targeted the mosque but destroyed a nearby market. They said the dead included women and children.

Residents told Reuters news agency that the imam of the mosque had spoken out against Sunni al-Qaeda members during prayers on Friday.

According to Reuters, some Sunni tribal leaders in Anbar have lent their support to a campaign against al-Qaeda and a power struggle is brewing among Sunnis in the province. It is said to be the most dangerous for U.S. troops in Iraq.

U.S. President George W. Bush plans to deploy an additional 21,500 troops to Iraq to try to bring stability to the country. Most of the troops are going to Baghdad, but the Reuters report said 4,000 will go to Anbar.

U.S. troops imposed a curfew on Habbaniyah after the explosion.

With files from the Associated Press