Lahore (CNN) -- Nawaz Sharif, the prime minister whose government was overthrown by a military coup more than a decade ago, appears to be back on top in Pakistan, election officials said Sunday.
According to unofficial results in Pakistan's violence-marred election, Sharif's party looks to have won most of the seats in the National Assembly. It won 16 of the 23 seats in the lower house, election officials said.
Imran Khan, candidate for the Tehreek-e-Insaf (Movement for Justice) party, said the elections were rigged.
"Police (were) used, and how the -- the staff of the Election Commission were used," he said. "And unfortunately it's because the provincial governments were in power right up till 20 days before the elections -- so they had plenty of time to place their people."
Still, democracy moved forward, he said.
"But I'm very optimistic that the foundation of what we call the new Pakistan has been laid," he said. "Pakistan will never be the same again. ... Because of the youth participation and female participation, we have seen incredible scenes at this -- vibrancy at this -- in the elections."
His party won four seats in the lower house, election officials said.
Further election results were not immediately available.
U.S. Secretary of State John Kerry called the election a historic democratic step.
"The Pakistani people stood up resiliently to threats by violent extremists," he said. "We'll be working with the new government to advance shared interests including a peaceful, more prosperous and stable future for Pakistan and the region."
Indian Prime Minister Manmohan Singh tweeted his congratulations to Sharif and the Pakistan Muslim League Nawaz party on their "emphatic victory."
Saturday's voting saw bursts of deadly violence aimed at polling stations that failed to deter Pakistanis keen to have their say in landmark national and provincial elections.
Voter turnout was nearly 60%, the chief election commissioner said early Sunday. Many were voting for the first time.
The national election marks the first transition between civilian governments in the nation's 66-year history.
In its short existence, Pakistan has experienced three military coups and been ruled by generals for half its life. It remains mired in political turmoil.
In March, the democratically elected government finished serving a full five-year term, paving the way for the elections.
Street parties erupted in the cities of Lahore and Peshawar early Sunday, with hundreds of people celebrating even before the results of the vote were in.
In his stronghold of Lahore, Sharif said he was confident his party will form the next government. He said he hopes his party won enough seats to form a government on its own but that he is willing to work with others to solve the country's problems.
The Election Commission extended polling hours in some constituencies in the southern city of Karachi, where there were complaints about the vote.
The Election Commission secretary, Ishtiak Ahmed Khan, told a news conference the election was free and fair across much of the country, despite the problems in Karachi.
Aside from claims of irregularities, four blasts hit Karachi as people voted, killing 14 people and wounding dozens. Across the country, 29 people were killed in Election Day violence.
Despite pre-election attacks, voters lined up at dawn at polling stations nationwide, eager to send off the caretaker government put in place in March.
"This is the first time I am voting and I am 60; I want change," said Shaheen Khan, who was at a polling station in Karachi, the nation's largest city. "There were thousands of people when I came. ... The queue was so long, people in wheelchairs and crutches all waiting to vote."
Waits of three hours or more were reported at some polling stations. Election officials also reported delays in opening at some polls, the official Associated Press of Pakistan news agency reported.
A statement from the office of interim Prime Minister Mir Hazar Khan Khoso thanked the people of Pakistan for "coming out in huge numbers" to vote, as well as everyone involved in participating in and organizing the elections.
He voiced "confidence that the next phase of counting of votes will also be completed smoothly," and reiterated the determination of the caretaker government to hand over power to the winners without delay.
More vote-rigging claims
The leader of the governing Pakistan People's Party, Taj Haider, alleged vote rigging in some constituencies in Sindh province and its capital, Karachi, in a news conference broadcast by CNN affiliate Geo TV. Haider called on the country's Election Commission to hold a new vote in the affected constituencies.
Leaders of the Sindh-based Muttahida Quami Movement, one of Pakistan's largest and most liberal parties, told reporters that they would boycott the elections over allegations of rigging.
The Sunni Ittehad Council and Jamaat-e-Islami parties also announced a boycott, Geo TV reported.
Many Pakistanis hope the polls will usher in reform in a country battling issues including corruption, a struggling economy and security threats.
President Asif Ali Zardari condemned Saturday's election violence but said the militants' "cowardly acts" would not stop people from exercising their right to vote.
An open letter from Malala Yousafzai, the Pakistani schoolgirl who was attacked by the Taliban last year for her efforts to promote girls' education, urged everyone, and particularly women, to use their votes.
"If we want education, electricity and natural gas in our country, we must take a step," said her letter, published by Pakistan's Dawn website. "Let's vote for our country. We never realized how much powerful our vote is. One vote can change our country."
Blasts target voters
In some cities, the insecurity was evident Saturday.
Two of the blasts in Karachi targeted the Awami National Party office, killing 11 and wounding 36, said Naeem Shah, a spokesman for Karachi police.
A third explosion was in the Karachi suburb of Landhi. It killed three people and wounded nine, according to the deputy commissioner of Malir district, Qazi Jan Mohammed. Voting continued afterward, he said.
A fourth explosion, which wounded four people, was in the Peerabad area of Karachi, Shah said.
Fakhruddin Ebrahim, the chief election commissioner for Pakistan, said he contacted the military over security concerns in Karachi and the harassment of polling station staff in the city. He said polling material was stolen in several areas.
Eleven people were killed in two separate bombings in Pakistan's volatile Balochistan province, district police officer Allauddin Kasi said. One of the attacks was on a vehicle carrying voters who had cast their ballots, he said.
Another targeted independent candidate Khadim Shah, the prime minister's office said in a statement condemning the bombing.
Elsewhere in Balochistan, at least four people were killed and eight injured in a clash between two groups at a polling station, police official Sardar Muhammad said.
In another incident, 12 Awami National Party supporters were hurt by a hand grenade thrown at a party electoral office in Quetta, said Syed Mobeen Ahmed, a deputy inspector general of police.
Brig. Muhammad Abdur Raheem, the military spokesman for Balochistan, said polling still went well in the province apart from interruptions caused by a few incidents. There was a good turnout, including by women voters, he said.
In the northwestern city of Peshawar, 12 people, children among them, were wounded when a bomb exploded at a polling station in a school, said Habibullah Arif, a local deputy commissioner.
Of the 86 million voters registered to cast ballots, there were 36 million new voters, according to the Election Commission of Pakistan.
There are more than twice as many women candidates as five years ago, with 161 running, compared with the 64 who contested the 2008 poll, according to the United Nations.
As the nation makes the transition after years of mostly military rulers, the economic, political and security situation remains unstable.
As well as high inflation and poverty rates, Pakistan has seen outbreaks of violence, in some cases by Islamic extremists.
Since April, the Taliban in Pakistan have killed dozens in attacks on the three main political parties. Many urban voters and parties regard resurgent fundamentalism as one of the country's biggest threats.
More than 600,000 security personnel were deployed nationwide leading up to the election, Information Minister Arif Nizami said Friday.
Pakistan's army, which helped deliver 650 tons of ballots to polling stations, deployed 91,000 troops around the country, a military spokesman said.
The ruling Pakistan People's Party is led by Bilawal Bhutto Zardari, the son of assassinated former prime minister and party leader Benazir Bhutto.
While his party became the first civilian government to complete a full five-year term -- the three governments after the death in 1988 of military strongman Zia ul-Haq were all brought down by the army -- its legacy is a deeply fractured country with a faltering economy.
The party's main opposition came from Sharif's Pakistan Muslim League Nawaz. One of the country's leading industrialists and richest men, Sharif has been prime minister twice before and was overthrown in a coup when Gen. Pervez Musharraf seized power in 1999.
His party -- Pakistan's second largest -- believes it would have won elections in 2008 had the assassination of Bhutto not given a massive boost to the ruling party.
Another contender was Khan, a former cricket star and heartthrob.
Not in contention is Musharraf, who returned in March from four years of self-imposed exile to take part in the elections. A court banned him from taking part in politics and his party, the All Pakistan Muslim League, announced a boycott.
Musharraf and his allies weren't the only ones upset with Pakistan's leadership ahead of the election. The New York Times "strongly protested" the expulsion of its Islamabad bureau chief -- an order that Declan Walsh received at 12:30 a.m. local time, at his home.
The Committee to Protect Journalists joined the Times in slamming the move, with its Asia program coordinator Bob Dietz saying "it shows just how much the authorities fear independent media coverage."
CNN's Saima Mohsin reported from Lahore and Aliza Kassim from Atlanta, and Laura Smith-Spark wrote in London. CNN's Nasir Habib, Shaan Khan, Saska Vandoorne, Jessica King and Greg Botelho, and journalist Imran Javaid contributed to this report.