Sunday's commemorations marked the climax of Ashoura, the yearly mourning period in which Shia Muslims remember the seventh century death of the Prophet Muhammad's grandson, Imam Hussein, in a battle against overwhelming odds in the central city of Karbala.
To commemorate his death, black-clad pilgrims marched to Karbala in long processions, waving green flags and chanting religious slogans. They marched past crowds of onlookers towards Imam Hussein's shrine, beating themselves around the chest, back and head with fists, chains and swords.
As pilgrims poured into the city, police formed eight cordons around the city as a protective measure.
About 1,000 snipers were positioned on roof-tops and sniffer dogs pressed into service to help find any explosives.
About 600 female staff were placed on three roads entering the city to counter women suicide bombers, who have struck in the past.
CCTV cameras were also used to follow any incidents in the city.
"It was difficult to get in, but it's better than having bombings and lots of victims," Mohammed Abu Sajad, one of the pilgrims, said.
Baghdad has also seen a rise in security personnel during the commemorations.
Some pilgrims will visit a Shia shrine in the Kadhimiya district of the capital.
Security for the commemoration was seen as a key test for the government of Nuri al-Maliki, the Iraqi prime minister, with a general election planned for March 7.
"I came to show my belief in Imam Hussein. This event has nothing to do with personal motivations or politics," Mohammed Abdul Hussein, a 40-year-old who travelled from neighbouring Babil province, said.