Islamabad, Pakistan (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 have said, despite claims by other parties of vote rigging.
According to unofficial results disclosed Sunday from the country's violence-marred elections over the weekend, Sharif's party, the Pakistan Muslim League Nawaz (PML-N), looks to have won most of the seats in the National Assembly.
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. Sharif was subsequently jailed before going into exile in Saudi Arabia. He returned to Pakistan in 2007.
Support for the Pakistan Peoples Party (PPP), which completed a five-year term in power in March, appeared to have fallen away at Saturday's elections after it struggled to tackle the country's myriad problems of extremist violence, chronic power shortages and an enfeebled economy.
Imran Khan, the former cricket star whose party was participating in general elections for the first time, said voting was rigged.
"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," said Khan, suggesting that police and electoral officials were "used."
He said his party was gathering evidence of the irregularities.
Khan, who was injured in a dramatic fall at a campaign rally just days before voting began, was considered to be a wild card in the election.
Analysts saw him and his Pakistan Tehreek-e-Insaf party (PTI) as popular with members of the urban middle class, who support his call to end drone strikes in the country's restive tribal regions and his pledge to sweep away rampant corruption by ending foreign aid.
His party appeared to have secured enough votes to be a notable presence in parliament. And Khan said that despite the alleged voting irregularities, democracy had advanced in the elections.
"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."
PPP officials also complained of vote rigging in some constituencies in Sindh province and its capital, Karachi, during the elections Saturday, calling on the country's Election Commission to hold a new vote in the affected areas. Other smaller parties threatened boycotts over the alleged irregularities.
Protests, led by Khan's supporters, took place in Karachi over the reported problems.
The provincial government responded Monday by imposing a ban on gatherings of four or more people for rallies and protests, CNN affiliate Geo TV reported.
Sharif and the PML-N appeared to be the main beneficiaries of the elections.
In his stronghold of Lahore, Sharif said he was confident his party would form the next government. He said that he hoped 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.
Indian Prime Minister Manmohan Singh tweeted his congratulations to Sharif and the PML-N on their "emphatic victory."
Sharif had suggested that if elected, he would seek to improve relations with New Delhi. India and Pakistan have fought three wars since their partition in 1947. Frosty relations resulting from the 2008 Mumbai terrorist attacks, for which India blamed a Pakistani-based group, have thawed in recent years.
President Barack Obama expressed a willingness to work with the next government that is formed in Islamabad.
"The United States and Pakistan have a long history of working together on mutual interests," Obama said in a statement. "And my administration looks forward to continuing our cooperation with the Pakistani government that emerges from this election as equal partners in supporting a more stable, secure, and prosperous future for the people of Pakistan."
During campaigning, Sharif seemed to take a vague stance on issues of interest to the United States, like the fight against terrorism.
But analysts said they saw that as a political move to secure support from his conservative Islamic base. They noted that Sharif had worked well with U.S. officials during his previous two terms as prime minister during the 1990s.
Afghan President Hamid Karzai called Sharif on Sunday to congratulate him, the Afghan government said.
Violent extremism remains a significant problem in Pakistan, as underlined by frequent deadly attacks by groups like the Pakistani Taliban on people campaigning for the elections. Attacks over the weekend targeted polling stations.
Karachi, the country's biggest city, and Balochistan, a restive province that borders Iran and Afghanistan, appeared to suffer the worst of the violence Saturday and Sunday.
But the attacks failed to deter Pakistanis keen to have their say.
Voter turnout was nearly 60%, the election officials said Sunday. Many people were voting for the first time.
The Election Commission secretary, Ishtiak Ahmed Khan, said the election was free and fair across much of the country, despite the problems in Karachi.
His view received qualified support from election observers from the European Union who reported that at the polling stations they visited, "polling was generally rated as satisfactory or good."
The E.U. observers said in a statement Monday that a higher rate of problems was seen in Sindh, the province where the PPP and PTI had complained of irregularities.
In Karachi, the observers said they "undertook limited observation, during which they saw some serious problems in polling and were also restricted in their activities."
They said they identified some problems in the counting of votes across the country, with 9 out of 59 stations rated as "poor or inadequate."
The national election marks the first transition between civilian governments in the nation's 66-year history. In March, the democratically elected PPP government finished serving a full five-year term.
Pakistan has experienced three military coups and been ruled by generals for about half its history.
CNN's Aliza Kassim, Laura Smith-Spark, Jethro Mullen, Nasir Habib, Shaan Khan, Neda Farshbaf, Saska Vandoorne, Jessica King, Greg Botelho, and journalist Imran Javaid contributed to this report.