Islamabad, Pakistan (CNN) Cricket legend Imran Khan is poised to take the reins as Pakistan's next prime minister, as his party won the most seats in the country's general elections, full official results show.
But Khan's Pakistan Tehreek-e-Insaf (PTI) party failed to win an outright majority in the National Assembly, with 115 of the 270 available seats in Wednesday's vote, according to Pakistan's election commission. The voting was marred by violence, including a deadly suicide attack, and allegations by other parties of election rigging.
The ruling Pakistan Muslim League (PML) came in second with 64 seats and the Pakistan People's Party (PPP) won 43. Opposition parties on Friday said they rejected the results and would call for new elections.
Analysts say Khan has sufficient support to form an alliance with independent national and small regional assembly members without needing to team up with extremist religious parties, as some had feared. His victory comes in the country's second democratic transition in its history.
Khan, who campaigned on a populist anti-graft platform, had already declared victory on Thursday, vowing to transform the nation and clean up Pakistan's public institutions. He said that corruption was "eating away this country like a cancer."
He pledged an end to decades of what he calls the Sharif and Bhutto families' corruption and misrule. His win also has been widely trumpeted as historic for breaking the decades-long two-party dominance of Pakistani politics.
In a nation obsessed with cricket, Khan cleverly leveraged his star status to transition into a career in politics, founding the PTI, otherwise known as the Justice Party, in 1996. While banking on the PTI's success as a regional party, Khan and his anti-graft mantra struck a chord with young and middle-class Pakistanis.
Khan's popularity has surged in recent years as he shared his vision for a "new Pakistan" at a time when the country's middle class has grown disenchanted with an economy on the brink of crisis. The currency has spiraled, inflation is persistent and debt remains high.
Khan was also widely seen as the preferred candidate of the country's powerful military, which has directly ruled Pakistan for almost half its independent existence since 1947, and has maintained an outsize influence over politics throughout that period.
He was a fierce critic of the US war on terror, particularly the country's use of drone strikes in Pakistan, which targeted terrorist networks but also killed Pakistani civilians.
But as the Pakistani military cooperates with the United States, it is unclear whether Khan will continue to criticize a Donald Trump-led Washington.
The question now is how much freedom a Khan-led government will have under the military's close gaze.
The country was under direct military rule for more than half its 71-year existence, and the army still retains huge power and influence.
Some critics allege military generals were putting their fingers on the scale to tilt the election towards Khan. Now that Khan has been elected, he is seen as likely to enact military-friendly policies.