Many Iraqis hope the election will put them on a path toward national reconciliation as the US prepares to withdraw combat forces by late summer and all troops by the end of next year. Prime Minister Nouri al-Maliki is fighting for his political future with challenges from a coalition of mainly Shiite religious groups on one side and a secular alliance combining Shiites and Sunnis on the other.
Despite mortars raining down nearby, voters in the capital still came to the polls. In the predominantly Sunni neighbourhood of Azamiyah in northern Baghdad, Walid Abid, a 40-year-old father of two, was speaking as mortars boomed several hundreds metres away. Police reported at least 20 mortar attacks in the neighbourhood shortly after daybreak. Mortars also fell in the Green Zone - home to the US Embassy and the prime minister's office.
"I am not scared and I am not going to stay put at home," said Abid, who owns a cafe. "Until when? We need to change things. If I stay home and not come to vote, Azamiyah will get worse."
Polls closed at 5pm as scheduled and election officials said it could be days before preliminary results are released.
Observers warn the election is only a first step in the political process. With the fractured nature of Iraqi politics, it could take months of negotiations after results are released in the coming days for a government to be formed.
Many view the election as a crossroads where Iraq will decide whether to adhere to politics along the Shiite, Sunni and Kurdish lines or move away from the ethnic and sectarian tensions that have emerged since the fall of Saddam Hussein's iron-fisted, Sunni-minority rule.
Al-Maliki, who has built his reputation as the man who restored order to the country, is facing a tough battle from his former Shiite allies, the Supreme Islamic Iraqi Council and a party headed by anti-American cleric Muqtada al-Sadr.
"Al-Maliki gave us security despite all the terror. What more can he do?" said Mariam Omran, a 55-year-old bespectacled mother of four clad in a black chador. "All I want is peace for my country," she said after voting in the Shiite neighborhood of Kazimiyah in northern Baghdad.
President Barack Obama praised Iraqis who took part in the historic vote.
"We mourn the tragic loss of life today, and honour the courage and resilience of the Iraqi people who once again defied threats to advance their democracy," he said in a statement.
Al-Maliki faces a challenge from a secular alliance led by Ayad Allawi, a former prime minister and secular Shiite, who has teamed up with a number of Sunnis in a bid to claim the government.
"These acts will not undermine the will of the Iraqi people," al-Maliki said on Sunday morning, speaking to reporters after casting his ballot.
Exiting the polls, Iraqis waved purple-inked fingers - the now-iconic image of voting in this oil-rich country of roughly 28 million people.
Extraordinary security measures did not foil Sunni insurgents who vowed to disrupt the elections - which they see as validating the Shiite-led government and the US occupation. They launched a spate of mortar, grenade and bomb attacks throughout the morning that, beside Baghdad, targeted the northern city of Mosul, Fallujah, a former bastion of the insurgency west of Baghdad, and small towns just to the south of the capital.
There was no immediate claim of responsibility but US and Iraqi officials described the violence as the work of insurgents trying to undermine voting.
In a posting early on Sunday on an Islamic website, the al-Qaida front group Islamic State in Iraq warned that anyone taking part in the voting would risk "God's wrath and to the mujahideen's weapons," saying the process bolsters Iraq's Shiite majority.
An Interior Ministry official speaking on condition of anonymity because he was not authorised to speak to the media said 35 people had died in Baghdad alone but did not have a breakdown of where the deaths occurred. One other death was reported in the city of Mahmoudiya, about 30km south of Baghdad. A bomb inside a polling center killed a policeman, said Iraqi Army Col. Abdul Hussein.
In Baghdad's northeast Hurriyah neighborhood, where mosque loudspeakers exhorted people to vote as "arrows to the enemies' chest," three people were killed when someone threw a hand grenade at a crowd heading to the polls, according to police and hospital officials.
At least 19 people died in northeastern Baghdad after explosions leveled two buildings about a mile apart, and mortar attacks in western Baghdad killed seven people in two different neighbourhoods, police and hospital officials said. In Mosul, police said unidentified gunmen threw a grenade on a polling center, wounding six voters. In Fallujah, six mortar rounds were fired around the city but caused no casualties, police said.
About 6,200 candidates are competing for 325 seats in the new parliament, Iraq's second, full-term legislature since the 2003 US-led invasion seven years ago this month.