Iraqis vote on Sunday in a parliamentary election that will help to determine whether their shaky democracy can end sectarian conflict and defeat insurgents who are trying to plunge Iraq back into broader bloodshed.

Iraq's political course will be decisive for President Barack Obama's plans to halve U.S. troop levels over the next five months and withdraw entirely by end-2011. It will also be watched closely by energy companies that have committed themselves to investing billions in Iraq's vast oilfields.

Voting begins at 7 a.m. (0400 GMT) across the ethnically and religiously divided country, overshadowed by threats of attack by al Qaeda's Iraqi offshoot. Voters can pick between the mainly Shi'ite Islamist parties that have dominated Iraq since Saddam Hussein's fall and rivals offering secular alternatives. This election marks another step in the march of our democracy -- and also a test, said President Jalal Talabani, a veteran Kurdish politician seeking another term.

It is impossible to predict who will lead Iraq's next government after an election that stands out in the Middle East for its competitiveness. There are about 6,200 candidates from 86 political groups vying for 325 parliamentary seats.

Shi'ite Prime Minister Nuri al-Maliki, whose State of Law coalition is claiming credit for improved security since the peak of sectarian warfare in 2006-07, faces a challenge from one-time partners looking to recapture Shi'ite support.

He also takes on a secular list tapping into exasperation with years of conflict, poor public services and corruption, and hoping to gain support from a once-dominant Sunni minority.

Former Prime Minister Iyad Allawi, a secular Shi'ite who heads the cross-sectarian, secularist Iraqiya list, is already complaining about irregularities in early voting, setting the scene for possible challenges to the election's integrity.

This week, 600,000 people, including soldiers and detainees, voted early, as did Iraqi expatriates and refugees abroad.

Some of Maliki's rivals allege intimidation and arrests, adding to tensions created by a ban on 400 candidates accused of links to Saddam's outlawed Baath party -- a furor which exposed the lingering divide between Sunnis and Shi'ites.

We need to see the will of the Iraqi people fully exercised in this coming election. Otherwise, Iraq will be thrown back to severe violence, Allawi said as he concluded his campaign.

The Islamic State of Iraq, an al Qaeda affiliate that views the Shi'ite government as heretical and unfit to rule, has warned Iraqis against voting and vowed to attack those who defy them.

Violence has killed at least 49 people in the last few days.

SECURITY FORCES OUT

Troops and police were out in force across Iraq's 18 provinces, banning vehicle movement to try to foil car bombers. The 96,000 U.S. troops remaining in Iraq will stay in the background, underscoring the waning American role in Iraq.

The short window between the election and Washington's August 31 deadline for ending combat operations has raised doubts about whether Obama might reconsider his plans, but U.S. officials say that would take an extraordinarily dire situation.

No bloc is expected to win a majority, and it may take weeks or months to form a government. The result could be a dangerous vacuum that armed groups might exploit.

That would send a worrying signal to global oil majors and other investors contemplating possibilities in Iraq, which is desperate to broaden its economy beyond the vital oil sector.

Despite sectarian tensions in places such as Salahuddin, a Sunni Arab stronghold where some people still refer to Saddam as our leader, the election for many Iraqis comes down to despair at joblessness and the miserable state of basic services.

I hope the next government brings change, said Yassin Younis, a government employee in Samarra. I dream of the day when I wake to hot water and electricity. We've had enough of the terrorism and darkness.

(Additional reporting by Rania El Gamal in Baghdad and Sabah al-Bazee in Tikrit; Editing by Alistair Lyon)