A female homicide bomber blew herself up on Sunday among a crowd of pilgrims worshipping at a revered Shiite shrine in northern Baghdad, killing at least 38 people and wounding about 72, the Iraqi army and police said.

The attack during one of the holiest periods for Shiite Muslims came just as Iraqi forces took the lead on security under an agreement with the United States that went into effect on New Year's Day. Under that agreement, U.S. forces take a back seat on security issues in much of the country following the Dec. 31 expiration of a U.N. mandate for foreign troops.

The woman, wearing a traditional black cloak, approached the gate to the shrine of Imam Mousa al-Kazim, one of the holiest men in Shiite Islam, witnesses said. She apparently blew herself while among a group of Iranian pilgrims in front of the shrine's main gate, they said.

"Around 16 Iranian pilgrims arrived here at this gate, they came from the market area and a few moments later a blast occurred," Mahir Abu Mahdi, a witness, told Associated Press Television News.

The office of Iraqi army spokesman Brig. Gen. Qassim al-Moussawi confirmed a woman wearing an explosives vest was responsible for the attack, which occurred just before noon in the northern Shiite neighborhood of Kazimiyah.

The attack came as Shiites prepared to mark Ashura on Jan. 7. Falling on the 10th of Muharram under the Islamic lunar calendar, it is one of the most important holy days for Shiite Muslims and marks the death of the Prophet Muhammad's grandson Imam Hussein.

The first 10 days of the month of Muharram are often marked by pilgrimages to holy sites around Iraq, culminating in the Shiite holy city of Karbala.

The Iraqi police and army have deployed thousands of forces to safeguard worshippers, mostly those heading to Karbala south of Baghdad. The city is home to the golden-domed mosques of Imam Hussein and his half-brother Imam Abbas. Hundreds of thousands are expected to pour into the city Tuesday and Wednesday night for the pinnacle of the pilgrimage.

Maj. Gen. Othman Ali Farhood al-Ghanimy, the Iraqi army commander in Karbala, said last week that thousands of foreign pilgrims had arrived for the holy day — including many from neighboring and predominantly Shiite Iran.

Although the homicide attack bore all the hallmarks of the Sunni terror group Al Qaeda in Iraq, which has killed hundreds of people in bombings against Ashura pilgrims in recent years, other Islamic extremist groups have used the day to stage bloody attacks.

Among the bloodiest attacks during Ashura were a series of mortar attacks and bombings in Baghdad and Karbala that killed nearly 200 pilgrims and wounded more than 500 others in 2004.

Last week, police in the southern city of Basra arrested a leading figure in a messianic Shiite cult, known as the "Soldiers of Heaven," that has battled with Iraqi and U.S. forces during the holiday.

At least 72 people died — mostly cult members — in ferocious battles with police in 2008. The group has sought to invoke chaos as a means of inspiring the return of the "Hidden Imam" — also known as the Mahdi — a descendant of the Prophet Muhammad who disappeared as a child in the ninth century. Shiites believe he will return one day to bring justice to the world.

In 2007, more than 200 members of the "Soldiers of Heaven" cult were killed and 600 people arrested after battles near the Shiite holy city of Najaf as they sought to declare an Islamic state during Ashura. At least 11 Iraqi troops were killed along with two Americans, whose helicopter was shot down during the battle.