Enlarge By Hadi Mizban, AP An Iraqi woman casts her vote for the parliamentary elections on Sunday in Baghdad, Iraq.

BAGHDAD  Millions of Iraqis voted in national elections on Sunday despite bomb and grenade attacks in a test of democracy and Iraq 's ability to take over security from American troops.

Election observers said the most open and competitive election since the overthrow of Saddam Hussein went smoothly. People emerged smiling from polling stations with purple-stained fingers, the signature Iraqi method to prevent vote fraud, and said they hoped for a better future.

"We have suffered from the security situation, the lack of jobs and poor basic services," said Usra Abdullah, 48, in Baghdad. "If it means that I die while casting my vote then I die."

President Obama praised the Iraqis' stand against violence. "The Iraqi people have chosen to shape their future through the political process," he said.

Poll openings at 7 a.m. were met with numerous blasts. In an explosion near Sadr City, rescue workers said they could hear women and children under the debris screaming for help. The Interior Ministry said at least 35 people had died in the violence.

Maj. Gen. Ahmed Assadi, an Iraqi army commander, said voters were undeterred. "Ninety-nine percent believe in the political process. We cannot and will not let the other 1% decide for us," he said.

Iraqis living in the United States also voted in six U.S. cities over the weekend.

"Today is like Eid for me," Haadi Al-Bagdadi, 48, of Dearborn, Mich., said after voting, referring to the Muslim holy day. His brother and three brothers-in-law were killed by the Hussein regime.

The election comes nearly seven years after the U.S. invasion in 2003. A free and fair election plays into Obama's plan to withdraw 50,000 U.S. troops from Iraq in August — more than half of the 96,000 troops there. U.S. ambassador Christopher Hill said the implication of the vote was "enormous."

"If this goes well ... and if the government formation goes well, this could usher in a whole new beginning for this country and also U.S. relations with Iraq," he said while in a U.S. base in Tikrit.

Voters on Sunday were choosing from 6,200 candidates for 325 seats in parliament who will select the next prime minister. Four coalitions of candidates were running. None was likely to gain a majority, which means the two top vote-getters may have to form a joint government.

Results were not expected for several days, the Independent High Electoral Commission said.

Prime Minister Nouri al-Maliki was elected in 2005 largely from the support of Shiites, who are the majority in Iraq. Sunnis, who were the backbone of the Hussein regime, largely boycotted that election but appeared to be voting Sunday, according to the European Commission.