1 of 10
Karim Kadim, Associated Press
An Iraqi patient, center, leaves after casting her vote at a polling center inside al-Kindi hospital in Baghdad, Iraq, Monday, April 28, 2014. Amid tight security, some one million Iraqi army and police personnel have started voting for the nation's new parliament.

BAGHDAD — Militants targeted polling stations across much of Iraq on Monday as soldiers and security forces cast ballots two days ahead of parliamentary elections, killing at least 21 people, officials said.

The wave of attacks was an apparent attempt to derail the balloting process and discourage the rest of the country's 22 million registered voters from going to the polls on Wednesday in the first nationwide elections since the 2011 withdrawal of U.S. forces.

The early balloting for police and soldiers is meant to free up the 1 million-strong military and security forces so they can protect polling stations and voters on election day.

More than 9,000 candidates are vying for 328 seats in parliament, which is widely expected to be won by an alliance led by Shiite Prime Minister Nouri al-Maliki, who is likely to seek a third four-year term in office.

"These are crucial elections that we hope will make things better in Iraq," said one voter, policeman Hatef Yidam. "We want peace and a life with dignity."

Hospital patients, medical staff and detainees were also voting on Monday. Abroad, Iraqi expatriates in more than 20 countries will also be able to cast ballots for a second day.

Iraq's ailing President Jalal Talabani, who is being treated in Berlin since December 2012 following a stroke, was shown casting his ballot in Germany, in footage broadcast on a local Kurdish TV station, Kurdsat, in northern Iraq.

The nearly 80-year-old Talabani was seen sitting in a wheelchair smiling and waving his index finger, stained purple, flanked by relatives who were clapping. Few details have been released about the severity of Talabani's illness.

Authorities on Monday announced the closure of Iraq's air space, saying it will not reopen until after the polls close on Wednesday evening. Already, the government has decreed a weeklong national holiday to coincide with the elections, extending a previously announced three-day break. Such moves were common in past elections, chiefly to empty the streets and allow security forces faster access to attack sites.

A ban on vehicles will take effect on Tuesday night in Baghdad and stay in force throughout election day on Wednesday, a precautionary measure used in past voting to guard against car bombings.

Security has been tight in Baghdad and much of the rest of the country amid concerns that Sunni militants blamed for a recent resurgence of sectarian violence could target polling stations.

At one central Baghdad polling station, policemen went through four ID checks and search stations before they could enter the building on Monday. Inside, police dogs were used to search for explosives. Some policemen came to cast votes dressed in civilian clothes to attract less attention.

But despite the stepped up security, militants managed to strike polling centers in Baghdad and a string of other cities.

One of the deadliest attacks took place in Tuz Khormato, a town about 200 kilometers (130 miles) north of Baghdad, where a suicide bomber blew himself up at a checkpoint leading to a polling center, killing six security personnel and wounding four, according to police Maj. Gen. Torhan Abdul-Rahman Youssef.

Youssef added that another suicide bomber hit a checkpoint leading to a polling center in the nearby city of Kirkuk, killing six policemen and wounding seven. A civilian was killed and another wounded when a bomb went off on a nearby street, also in Kirkuk, he said.

Interior Ministry spokesman Saad Maan Ibrahim said another bomber struck a polling center in Baghdad's upscale Mansour district on the west bank of the Tigris, killing three soldiers and wounding four.

Another suicide bomber set off his explosive belt among a group of soldiers gathering at a checkpoint near a voting center in Baghdad's northern Azamiyah neighborhood, killing four of them and wounding 13, police and medical officials said.

In the town of Habbaniyah, 80 kilometers (50 miles) west of Baghdad, a bomb went off next to a group of policemen leaving a balloting center, killing one and wounding five, police said.

And in the northern city of Mosul, two suicide bombers on foot tried to attack a polling center, according to a police officer who as at the scene. The guards shot and killed one attacker as the second blew himself up outside the center in the southern Zeindan area, wounding five security personnel.

In another area, a roadside bomb targeted a security convoy. Three local reporters traveling with the convoy were wounded.

All officers and officials spoke on condition of anonymity as they were not authorized to talk to the media.

Iraq is experiencing a surge in sectarian violence, with Sunni militants increasingly targeting security forces, army troops and members of the nation's Shiite majority. The resurgence of the bloodletting, which nearly tore Iraq apart in 2006 and 2007, underscores the precarious politics of a democratic, but splintered nation.

It also mirrors the three-year-old conflict in neighboring Syria, where the civil war pits forces loyal to President Bashar Assad whose powerbase stems from followers of a Shiite offshoot sect, against mostly Sunni Arab rebels whose ranks are dominated by Islamists and militants from al-Qaida-inspired or linked groups. Iraqi Shiite militiamen fight on the side of Assad's forces.

The biggest election-related violence in Iraq came on Friday, when a series of bombings targeted an election rally for a militant Shiite group, killing at least 33 people. The rally for the Iranian-backed Asaib Ahl al-Haq was held at a sports stadium in eastern Baghdad to present the group's parliamentary candidates.

An al-Qaida breakaway group, the Islamic State in Iraq and the Levant, claimed responsibility for the attack, which triggered a wave of revenge killings late on Friday and Saturday. On Sunday, 10 people were killed in Baghdad's Shiite Sadr City district when a bomb went off at an outdoor market. No one claimed responsibility for the attack, which bore the hallmarks of militant Sunni groups.

Voters in Wednesday's polls are widely expected to cast ballots along sectarian and ethnic lines.

But balloting will not take place in parts of the vast and mostly Sunni Anbar province west of Baghdad, where al-Qaida spin-off militants control parts of two cities, including the provincial capital, Ramadi.

Follow Sinan Salaheddin on Twitter at https://twitter.com/sinansm. Associated Press writer Murtada Faraj contributed to this report from Baghdad.