BAGHDAD — Iraq voted Wednesday in its first nationwide election since US troops withdrew in 2011, with Prime Minister Nouri al-Maliki confident of victory and even offering an olive branch to his critics by inviting them to join him in a governing coalition.
But his optimism will do little to conceal the turmoil and violence that still stalk Iraq in the eight years he has held office, with the threat of the country sliding deeper into sectarian war and risking a breakup.
‘‘Our victory is certain, but we are talking about how big is that certain success,’’ Maliki said after voting in Baghdad.
‘‘Here we are today, successfully holding the ... election while no foreign troops exist on Iraqi soil. I call upon all the other groups to leave the past behind and start a new phase of good brotherly relations,’’ said Maliki, who faces growing criticism over government corruption and sectarian violence.
More than 9,000 candidates from across the country are seeking seats in Parliament. Authorities did not offer a timetable for releasing official results, but preliminary figures are expected within days.
The election prompted a massive security operation, with hundreds of thousands of troops and police deployed across the country to protect polling centers and voters.
The streets of Baghdad, a city of 7 million, looked deserted. Police and soldiers manned checkpoints roughly 500 yards apart and pickup trucks mounted with machine guns roamed the streets that were otherwise devoid of the usual traffic.
Scattered attacks took place north and west of Baghdad, killing at least five people and wounding 16. Roadside bombs killed two women and two election workers in the northern town of Dibis.
Maliki’s upbeat comments sharply contrasted with voters’ sentiments, which ranged from despair to a gritty resolve to participate despite the threat of violence.
‘‘I see this election as the last chance, my last bet on Iraq. If things continue to be the same, I will leave, and this time for good,’’ said Saad Sadiq Mustafa, a 55-year-old retired army officer who fled with his family to Syria to escape the worst Sunni-Shi’ite violence of 2006 and 2007 and came home in 2008.
A Sunni Arab and a father of four from Baghdad, Mustafa voted for Ayad Allawi, a secular Shi’ite who became Iraq’s first post-Saddam Hussein prime minister in 2004.
Maliki’s State of Law bloc is widely expected to win the most seats in the 328-member Parliament but fall short of a majority, analysts said. That would allow Maliki to keep his post only if he can form a coalition, which took nine months after the 2010 election.
Maliki said he would have no objection to an alliance with any other bloc, provided it denounced sectarianism and worked for Iraq’s unity. But the Kurds have already suggested they will not be part of a coalition he leads, while some of his former Shi’ite allies may try to push him out of contention.