A Pakistani voter casts his ballot at a polling station in Islamabad, Pakistan on Saturday. / B.K. Bangash, AP

by Hani Yousuf and Lisa Friedman, Special for USA TODAY

by Hani Yousuf and Lisa Friedman, Special for USA TODAY

KARACHI, Pakistan -Former Pakistani Prime Minister Nawaz Sharif declared victory as unofficial, partial vote counts showed his party with an overwhelming lead following a historic election marred by violence Saturday, including a string of attacks that killed 29 people.

If his victory is confirmed, it would be a remarkable comeback for the 63-year-old Sharif, who has twice served as the country's premier but was toppled in a military coup in 1999. He spent years in exile before returning to the country in 2007. His party weathered a strong campaign by former cricket star Imran Khan that energized Pakistan's young people.

Sharif expressed a desire to work with all parties to solve the country's problems in a victory speech given to his supporters in the eastern city of Lahore as his lead in the national election became apparent based on unofficial, partial vote counts announced by local Pakistan state TV.

The results indicated Sharif's party has an overwhelming lead, but would fall short of winning a majority of the 272 directly elected national assembly seats, meaning he would have to put together a ruling coalition.

"I appeal to all to come sit with me at the table so that this nation can get rid of this curse of power cuts, inflation and unemployment," Sharif said.

Voters turned out in droves in the hope of pushing for a solution to the nation's woes in a historic election that marks the country's first democratic transition of power in its 66-year history, despite a string of terrorist attacks.

One attack targeted the office of the Awami National Party (ANP) on Saturday morning, killing at least 10 and wounding more than 30. In the town of Sorab in the southwestern province of Baluchistan, gunmen targeted people outside a polling station.

The violence comes following the deaths of more than 150 people in pre-election attacks including a suicide bombing, kidnappings and the slaying of the prosecutor investigating the death of former prime minister Benazir Bhutto.

"There is violence in the country and some people are trying to see these elections fail, but we are hopeful," said Maleeha Kiyani, a 21-year-old political science student from Faisalabad, west of Lahore.

Dressed in green and standing in line at a polling station in Karachi's affluent Defence neighborhood, Ayesha Athar, 22, waited with her sister, Wersha, 23, to vote after polls were late to open.

"I think for the first time, we feel like this might be a free and fair election," Ayesha said. "But people are so pumped up, (officials) are going down the line and asking people not to leave before they vote."

In addition to Sharif's apparent lead, it also appeared that the Pakistan Tehreek-e-Insaf Party (PTI), led by the charismatic former cricket star Imran Khan, could deprive the PML-N of crucial seats in the province of Punjab and of the majority the party needs in parliament to give Sharif hope of leading the country.

While Sharif has tried to bill himself as the candidate of experience, Khan appealed to voters' desire for change.

Rahila Aslam, 53, compared Saturday's elections with those in the 1970s, where people were voting for Prime Minister Zulfikar Ali Bhutto, father of Benazir Bhutto.

"I was too young to vote, but you could see the people's emotions - they were all voting for Bhutto. Now, I see the same emotions for Imran Khan," she said.

While leaders of other parties relied on online and television campaigning, reluctant to take part in rallies on the ground for fear of terrorists attacks, Sharif and Khan were able to meet with voters - a big advantage in a country with large rural areas where many do not have access to technology.

With the PML-N and the PTI taking much of the vote, the ruling Pakistan People's Party (PPP) could suffer defeat by coming in third. Politicians in the party, which came to power in 2007 on a wave of sympathy following the assassination of Benazir Bhutto, have widely been accused of corruption.

While voters said they hoped for change, analysts say the violence is unlikely to come to an end following the election.

"I doubt that the Taliban will accept a democratic system," said Siegried Wolf, a political scientist at the University of Heidelberg. "I'm afraid the current situation in Pakistan will continue as long as the Taliban has not established a political regime that corresponds with its social and political world views."

While campaigning, Sharif said he planned to end Pakistan's involvement in the U.S.-led war on terror - leaving some with fears that such a move could allow militants a greater reign over parts of the troubled country.

Athar Hussain, director of the Asia Research Center at the London School of Economics, said despite the anti-U.S. rhetoric that has sprung up in the elections, there would be no significant changes in the relationship between the two countries.

"The Pakistan army is heavily dependent on U.S. assistance and has also a relationship with the U.S., so I think any change in attitude would be marginal rather than substantial," he said. "(But) there's bound to be some change after the U.S. withdrawal in Afghanistan, that's bound to happen regardless of which government is in power."

The new prime minister will face challenges apart from those related to terrorism, Hussain said, including youth unemployment and a downturn in the economy.

"Probably to begin with the government would have a honeymoon period, but I don't think that would last too long because the economic policies â?¦ are not capable for dealing with Pakistan's main problem," he said.

For Pakistanis who risked their lives to go to the polling stations, there is still hope the new government will herald in a better and more peaceful age for the country.

"Earlier, it felt useless," said Humera Khan, a 40-year-old accountant voting for the first time. "This time it feels like people have united to change the system."