Pakistan's cricket legend Imran Khan declared victory on Thursday in a divisive general election marred by a long delay in ballot counting and allegations of vote rigging by most opponents.
"God has given me a chance to come to power to implement that ideology which I started 22 years ago," Khan, 65, said in a televised speech from his house near the capital Islamabad.
But supporters of jailed former Prime Minister Nawaz Sharif said the vote count was rigged and called it an assault on democracy in a country that has a history of military rule.
Khan called for "mutually beneficial" ties with Pakistan's on-off ally the United States, and offered an olive branch to arch-foe India, saying the two nations should resolve the long-simmering dispute over Kashmir.
It is a stunning rise for an anti-corruption crusader who spent much of his political career on the fringes of Pakistani politics. The stock market shot up nearly 2 percent in early trading on relief that Khan was expected to be able to form a stable coalition.
With about half the votes counted from Wednesday's election, Khan's Pakistan Tehreek-i-Insaf (PTI), or Pakistan Movement for Justice, was in a commanding lead in the nuclear-armed, Muslim-majority nation, the country's election commission said.
Sharif's Pakistan Muslim League-Nawaz (PML-N) and rival Pakistan Peoples Party (PPP) both said their monitors in many voting centres were either kicked out during counting or had not received the official notifications of the precinct's results, but instead got hand-written tallies that they could not verify.
"It is a sheer rigging. The way the people's mandate has blatantly been insulted, it is intolerable," Shehbaz, PML-N president and Nawaz Sharif's brother, told a news conference as the counting continued.
Khan offered to investigate all the claims of rigging and said he wants to "unite" the country under his leadership.
Pakistan faces a mounting economic crisis that is likely to require a bailout from the International Monetary Fund, although PTI has not ruled out seeking succour from China, Islamabad's closest ally.
Election Commission of Pakistan (ECP) secretary Babar Yaqoob told reporters early on Thursday counting had been delayed by technical failures in an electronic reporting system and the tallying was now being conducted manually. The results had been due by around 2 a.m. (2100 GMT on Wednesday).
"There's no conspiracy, nor any pressure in delay of the results. The delay is being caused because the result transmission system has collapsed," Yaqoob said.
With 48 percent of the total vote counted, Khan's PTI was listed by the ECP in its provisional results as leading in 113 of 272 contested National Assembly constituencies.
Sharif's Pakistan Muslim League-Nawaz (PML-N) was ahead in 64 constituencies, and the Pakistan Peoples Party (PPP), led by the son of assassinated two-time prime minister Benazir Bhutto, led in 42 constituencies.
Although Khan still appeared likely to fall short of the 137 seats needed for a majority in the National Assembly, he should have no problems finding coalition partners from smaller parties and independents.