By Katharine Houreld and Mehreen Zahra-Malik
ISLAMABAD (Reuters) - A string of militant attacks and gunfights that killed at least 17 people cast a long shadow over Pakistan's general election on Saturday, but millions still turned out to vote in a landmark test of the troubled country's democracy.
The poll, in which some 86 million people are eligible to vote, will bring the first transition between civilian governments in a country ruled by the military for more than half of its turbulent history.
Despite the searing heat, many went to the polls excited about the prospect of change in a country that is plagued with Taliban militancy, a near-failed economy, endemic corruption, chronic power cuts and crumbling infrastructure.
"The team that we elect today will determine whether the rot will be stemmed or whether we will slide further into the abyss," prominent lawyer Babar Sattar wrote in The News daily.
However, opinion polls have suggested that disenchantment with the two main parties, the Pakistan People's Party (PPP) and the Pakistan Muslim League - Nawaz (PML-N), could mean that no one group emerges with a parliamentary majority, making the next government unstable and too weak to push through much-needed reform.
A late surge of support for the party of former cricket star Imran Khan has made a split mandate all the more likely. Khan, 60, is in hospital after injuring himself in a fall at a party rally, which may also win him sympathy votes.
"The timing of such a split couldn't be worse for Pakistan," Sattar said. "The challenge of terror and economic meltdown confronting us won't wait for a party to be granted (a) clear mandate."
A bomb attack on the office of the Awami National Party (ANP) in the commercial capital, Karachi, killed 11 people and wounded about 40. At least two were wounded in three blasts that followed, and media reported gunfire in the city.
Four died in a gunbattle in Baluchistan. Gunmen on a motorcycle opened fire near a polling station in the restive province as well, killing two people, police said.
Several were injured in an explosion that destroyed an ANP office in the insurgency-infected northwest, and there were further casualties in a blast in the city of Peshawar.
Pakistan's Taliban, who are close to al Qaeda, have killed more than 120 people in election-related violence since April. The group, which is fighting to topple the U.S.-backed government, regards the elections as un-Islamic.
The Taliban have focused their anger on secular-leaning parties like the ruling coalition led by the PPP and the ANP. Many candidates, fearful of being assassinated, avoided open campaigning before the election.
A major religious party, Jamaat-e-Islami, said it was pulling its candidates out of Karachi because of allegations of vote-rigging by its local rival.
SHARIF LIKELY TO WIN MOST VOTES
Results from nearly 70,000 polling stations nationwide are expected to start trickling in from around 10 p.m. (1700 GMT).
Voters will elect 272 members of the National Assembly and to win a simple majority, a party would have to take 137 seats.
However, the election is complicated by the fact that a further 70 seats, most reserved for women and members of non- Muslim minorities, are allocated to parties on the basis of their performance in the contested constituencies. To have a majority of the total of 342, a party would need 172.
Despite Pakistan's history of coups, the army stayed out of politics during the five years of the last government and threw its support behind Saturday's election. It still sets the nuclear-armed country's foreign and security policy and will steer the thorny relationship with Washington as NATO troops withdraw from neighbouring Afghanistan in 2014.
However, some fear that the military could step back in if there is a repeat of the incompetence and corruption that frustrated many Pakistanis during the last government.
Power cuts can last more than 10 hours a day in some places, crippling key industries like textiles, and a new International Monetary Fund bailout may be needed soon to rescue the economy.
The party of former prime minister Nawaz Sharif, the PML-N looks set to win the most seats in the vote. But Khan could deprive Sharif of a majority and dash his hopes for a return to power 14 years after he was ousted in a military coup, jailed and later exiled.
A Herald magazine opinion poll this week showed the PML-N remained the front-runner in Punjab, which, with the largest share of parliamentary seats, usually dictates the outcome of elections.
However, it found that nearly 25 percent of voters nationally planned to vote for Khan's Tehrik-i-Insaf (PTI), placing it just behind the PML-N.
It also pointed to an upset for the PPP, placing it third. Pakistan's politics have long been dominated by the PML-N and the PPP, whose most prominent figure is President Asif Ali Zardari, widower of assassinated former premier Benazir Bhutto.
Khan, Pakistan's best-known sportsman who led a playboy lifestyle in his younger days, is seen by many as a refreshing change from the dynastic politicians who long relied on a patronage system to win votes and are often accused of corruption.
Khan appeals mostly to young, urban voters because of his calls for an end to corruption, a new political landscape and a halt to U.S. drone strikes on Pakistani soil. About one-third of the country's population is under the age of 30.
"It's the first time I have voted," said Rizwana Ahmed, 42, as she stood at a polling station near a slum in the capital waiting to cast a vote for Khan's party.
"I never felt like my vote counted before, it was always the same people or their families. Now there's someone new."
Pakistan, which prides itself on its democratic credentials, ordered the New York Times bureau chief in Islamabad to leave the country on the eve of the polls, the daily said on Friday.
A two-sentence letter was delivered by police officers to the home of the bureau chief, Declan Walsh, it said. No reason was given. (Writing by John Chalmers and Michael Georgy; Additional reporting by Gul Yousafzai in QUETTA, Mubasher Bukhari in LAHORE and Jibran Ahmed in PESHAWAR; Editing by Nick Macfie)