Bursts of gunfire and explosions rocked the Iraqi capital as hundreds of thousands of Shiites headed to the mausoleum of Imam Musa Kadhim, whose death 12 centuries ago is marked by major Shiite pilgrimage every year.
Security forces kept the event under control and by the standards of Baghdad's recent descent into sectarian bloodshed, which sees around 50 people killed each day, the death toll was low.
Nevertheless, health and interior ministry officials said that 20 pilgrims were killed when suspected Sunni extremists fired into crowds, while a defence ministry officer put the toll at 18 dead and 200 wounded.
Police and insurgents were also among the casualties.
"We have reports of 10 Iraqi forces wounded. Three people were detained for conducting attacks, one of whom died of wounds received after engaging Iraqi forces," a spokesman for the US-led coalition in Iraq said.
Armed Shiites from the Mehdi Army militia, followers of radical cleric
Moqtada al-Sadr, could be seen escorting sections of the crowd, fuelling fears that violence surrounding the march could stir Iraq's sectarian conflict.
"The overall security arrangement was good, but the Mehdi Army made us feel safe and gave good protection," said pilgrim Ali Taban from Baghdad.
The attacks were a reminder of last year's gruesome tragedy when at least 965 Shiites were killed in a stampede on a bridge triggered by a mortar attack and rumours of a suicide bomber in the midst of pilgrims.
"The terrorists tried to repeat the disaster of the Al-Aima bridge but were prevented by the alterness of our security forces, in cooperation with our citizens," said Prime Minister Nuri al-Maliki in a statment to media.
He praised the army and police for keeping the death toll down and said this was a sign of their "growing capability".
Extremists blamed
Mr Maliki blamed the ambushes on "takfiris" or Sunni extremists, but some Sunni leaders claimed Shiites had provoked the attacks and government security forces had stood by as militiamen attacked Sunni homes and mosques.
"We demand that the government stand up to these saboteurs and those who are trying to destabilise the country," said a statement from the Islamic Party, the main Sunni group in Iraq's coalition government.
Despite the threat of attacks, men, women and children, many of them dressed in traditional Shiite black outfits and carrying green, orange and yellow flags and Korans, gathered at the tomb of Imam Musa Kadhim.
Iraqi and US security forces were on a high alert to protect pilgrims, many of whom have walked barefoot from across Iraq over the past week to Baghdad, which is gripped by a bloody Shiite-Sunni sectarian conflict.
Troops and volunteers offered food and water to the pilgrims as they arrived and made their way to the shrine.
Pilgrims inside the mausoleum kissed the tomb, while outside volunteers sprinkled rose water on them, and others prepared rice and meat to be served as lunch to the devotees.
"It was a shattering experience for us when so many people died on the bridge last year," said Haider Sadek, a Shiite from Baghdad.
"But the unity shown then by the Adhamiyah people with those with Kadhimiyah helped heal wounds," he said, referring to two districts – one Sunni and one Shiite -- linked by the Al-Aima bridge, the scene of last year's stampede.
Kareem Risan walked from the southern city of Amara to take part in this year's pilgrimage. "It took us seven days. We risked our lives and braved all possible danger to reach here," he said.
Just north of the capital, in and around the strife torn town of Baquba, eight people including two policemen were shot dead by unknown gunmen.
