Pakistani lawmakers have endorsed Imran Khan as their next prime minister, ahead of a ceremony on Saturday that sought the World Cup cricket hero sworn in as leader of the nuclear-armed nation.
Khan scraped together a simple majority in a confidence vote held in the lower house of parliament, three weeks after an election tainted by claims of military meddling and ballot rigging.
"Imran Khan has secured 176 votes," National Assembly speaker Asad Qaiser said after the vote, broadcast live from the lower house of parliament.
He had needed 172 votes for a majority. His only rival, Shahbaz Sharif of the ousted Pakistan Muslim League-Nawaz (PML-N), won 96 votes, Qaiser said, with some opposition parties including the third-largest Pakistan People's Party (PPP) abstaining from the vote.
The result brings him one step closer to ending decades of rotating leadership between the PML-N and the PPP, punctuated by periods of military rule.
Khan, clad in a waistcoat and traditional white shalwar kameez garments, smiled broadly and could be seen wiping tears from his eyes while clutching prayer beads as the count was announced.
He had appeared relaxed before the vote, smiling and shaking hands with other parliamentarians, including Sharif.
The former cricketer, who captained Pakistan to World Cup victory in 1992, won the July 25 election but fell short of an outright majority, forcing him to partner with smaller parties and independents in order to form a government.
Some television channels flashed archive images of Khan during his 1992 triumph as the vote was announced.
The election was branded "Pakistan's dirtiest", after widespread claims through the campaign that the powerful military was trying to fix the playing field against the PML-N and in Khan's favour.
Rival parties have alleged "blatant" vote-rigging, with several parliamentarians shouting protest slogans inside the assembly ahead of the vote. The army and Khan have denied the claims.
The work begins
Khan and his Pakistan Tehreek-e-Insaf (PTI) party campaigned on promises to end widespread graft while building an "Islamic welfare state".
The party has already formed a government in its stronghold of Khyber Pakhtunkhwa province, and an alliance with regional parties in the southwestern province of Balochistan.
It is expected to form a coalition government in powerful Punjab province, formerly a PML-N stronghold, in coming days. Sindh province remained in the hands of the PPP.
PTI candidates were also voted speaker and deputy speaker of the National Assembly this week, putting Khan in a strong position to carry forward his legislative agenda.
He will face myriad challenges including militant extremism, water shortages, and a booming population negating growth in the developing country, among others.
Most pressing will be a looming economic crisis, with speculation that Pakistanwill have to seek a bailout from the International Monetary Fund.
He will also have to contend with the same issue as many of his predecessors: how to maintain a balance of power in civil-military relations.
In the West, Khan is often seen as a celebrity whose high-profile romances were tabloid fodder, but at home he cuts a more conservative persona as a devout Muslim who believes feminism has degraded motherhood.
Known in Pakistan as "Taliban Khan" for his calls to hold talks with insurgents, he increasingly catered to religious hardliners during the campaign, spurring fears his leadership could embolden extremists.