Imran Khan's long rise to power in Pakistan has been far from conventional -- the winner of Wednesday's election is a cricket legend who traveled the world and reveled in his celebrity status.
His new job will be much more daunting -- he inherits a nation riven with economic woes, security threats and a resurgent military looking to increase its grasp on political life.
It's a lot for a politician who has enjoyed a rapid rise but whose party has, until now, struggled to make an impact on the national level.
Running a populist campaign directed at the nation's disenchanted middle class, Khan has drawn comparisons with another upstart celebrity-turned-politician: US President Donald Trump.
"He sounds like Trump -- what Trump is for the US, Khan will be for Pakistan," said Ayesha Siddiqa, analyst and research associate at London's School of Oriental and African Studies (SOAS) South Asia Institute.
Much like his US counterpart, Khan's celebrity has facilitated his rise. He has "several faces, as a sportsman and a hero," said journalist Zahid Hussain. "It's one of the reasons for his popularity, his charisma."
"He's a contradiction -- he's supposed to be a modern face but (has) lots of conservative thinking, on Taliban, religious issues," said Hussain.
The Election Commission of Pakistan announced on Saturday that Khan's PTI had won 115 of the 270 available seats, giving it a minority win in parliament. Analysts say, however, that he will have no problem forming an alliance to rule the nation as prime minister.
In claiming victory on Thursday, Khan put his religion on show, saying that "God has taken me to that level, given me an opportunity of a dream."
"God has given me that chance to fulfill that dream."
Dealing with Trump
Regardless of whether Khan becomes the Donald Trump of Pakistan, he will be expected to engage with the US leader, having distinguished himself as a candidate as a harsh critic of Washington, long Pakistan's most important military ally. But analysts have expressed skepticism over whether he will be willing to actually take on Washington.
Khan was an outspoken opponent of drone strikes in Pakistan's tribal areas, and called for the country to be less economically reliant on the US, but is likely to tone "down some of the rhetoric," said Siddiqa, the SOAS expert.
In a speech delivered Thursday night, he said that he is looking for "mutually beneficial relations" with the US.
"At the moment we have a one-way relationship with the US," he said. "America is fighting its own war. We need a balanced relationship with the United States."
The military has a huge amount of influence over foreign policy, and will be looking to repair relations with Washington, which suspended more than $1 billion in aid earlier this year over Pakistan's perceived failure to clamp down on terror groups operating from the country.
The White House has also threatened to take further punitive actions, including declaring Pakistan a state sponsor of terror, though experts have questioned how far the Trump administration may be willing to push Islamabad, for fear of having its supply lines to Afghanistan cut off.
While it remains to be seen how he will deal with Trump, Khan -- an ethnic Pashtun -- may be able to play a role in improving relations with Afghanistan, said journalist Rafia Zakaria from the independent Pakistan newspaper Dawn.
"You could definitely see his election as a handshake to Afghanistan, not (necessarily) the government in Kabul, but Afghanistan as in the Pashtun (people). What better than that to bring the Pashtuns together around a peace treaty or some sort of accord," he said.
Khan has previously talked of the need to talk to the Taliban, which has been increasing the amount of territory it controls in Afghanistan.
On Thursday he said that he wants to implement a policy of "open borders with Afghanistan, like in the EU."
He added that he would seek to improve relations with Iran and "use our power to ease tensions in the Middle East. We want to be the country that ends wars."
Belt and Road
The other major balancing act Khan will have to perform as leader is with China, which has been instrumental in keeping Pakistan's economy afloat with huge amounts of investment linked to Beijing's Belt and Road trade and infrastructure plan.
"At this point, the entrenchment of China in Pakistan is too deep to be kicked out at the stroke of a pen," said Zakaria.
Many outside observers have warned that the Belt and Road plan could end up with smaller economies being left with huge amounts of debt, for dubious rewards.
The Center for Global Development, a US-based think tank, warned earlier this year that Pakistan is "by far the largest country at high risk," with some $50 billion of Chinese-funded infrastructure and energy projects underway.
"Adding to Pakistan's risk of debt distress are the relatively high interest rates being charged by China," it said.
China has previously used its financial leverage for political gains. In 2011, Beijing reportedly agreed to write off debt in Tajikistan in exchange for disputed territory, according to the study, while last year it secured a 99-year lease on a port in Sri Lanka in return for renegotiating an $8 billion loan.
Despite the concerns, however, most analysts agreed that the country's financial dependence on Beijing is likely to prevent any kind of major shift from Khan on how he deals with China.
Khan said that Pakistan needs to "to continue our bond with China and continue our (China-Pakistan Economic Corridor) projects. We need to use China as an inspiration to lift our people out of poverty."
Maintaining the current balance will also likely be the case with India. Though Khan has made some conciliatory remarks regarding Pakistan's nuclear neighbor, saying he'd "like to lower tensions," it's unlikely he'll change much in the Islamabad-Delhi relationship, said Siddiqa from SOAS.
"Khan has gone to India and made all the right noises but when he comes to power, he'll succumb to the status quo."
In his Thursday speech, Khan said Pakistan's "number one priority" is to improve trade ties and cited his cricket career as a reason why he was more acquainted with Indian thinking than his predecessors.
"I am the one Pakistani that knows more Indians than any other leader, due to my cricket experiences," he said.
Pakistan's next government will face a "major challenge" over the economy, Siddiqa said ahead of the vote.
"There is no money. How do you plan for that?" she said. "It won't be resolved in the next four years."
Sorting out the country's finances is the "biggest challenge for a new government," agreed Hussain, the journalist, adding the first thing the new administration "will have to do is go to the IMF -- Khan has claimed that he won't go to the IMF -- but the situation will likely be that he has no choice but to acknowledge the international body."
Khan has promised to "power the economy" by cracking down on tax avoidance by the wealthy, said Zakaria. "How he goes about doing this is the big question. They have so much influence in government."
"I do expect that there are going to be illustrative cases, political enemies who are industrialists whose assets are frozen, I expect that to happen quite soon after he takes power," he said.
Khan ran his campaign largely on a promise to drain the swamp of Pakistani politics -- casting himself as above the fray, in contrast to his deposed opponent Nawaz Sharif. But, according to Husain Haqqani, a former diplomat with close ties to the powerful Bhutto family, that is a false comparison.
"He has never been in government, how do we know he's clean? He's never been in government so he can't have used government money -- yet. So its a false argument that this man is financially not corrupt with government money because he's never had government money," he said.
"Some things Khan says is absolutely right but you need legal methods, not arbitrary interventions."
Along with an often vague sense of policy and how to implement it, another key point of comparison with the US President is the two leaders' relationship to the media.
Siddiqa predicted that in power, Khan will act "like Trump" in dealing with the press.
"When he starts governing ... there will be questions, people will be critical, we will see greater pressure on the media," she said.
Both as a public figure and a loud voice on the campaign trail, Khan publicly feuded with the press and attacked newspapers and journalists, said Mosharaf Zaidi, newspaper columnist and political analyst. "He doesn't stand for press freedom unless the press freedom entails praising Imran Khan."
This will be a concern for many Pakistani journalists, who have already faced increasing restrictions on how they work. Khan may also step up proposed plans to further limit internet freedom in the country, copying censorship tactics from China.
"Imran Khan often shows a self-righteous authoritarian streak, describing opponents and critics as corrupt; anti-Islam; traitors. This might mean further limiting of civil liberties and media freedoms," said Haqqani.
"I think that Khan has shown himself to be very intolerant of dissent, anyone against him described as traitor, non-believers, he's played the religious card in this election, can charge people with blasphemy laws."
The biggest question over any Pakistani government is how much freedom it will have to operate 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.
It was long suspected that the military favored Khan's candidacy and many alleged the generals were putting their fingers on the scale during the election. Now that he has been elected, he is likely to enact military-friendly policies.
"(Khan) may not be in the pocket of the military but he will be the latest political creature of the military," said Haqqani.
Other analysts think that while he's portraying himself as a maverick, his ties to the military and his political allies mean there is very little chance of him upending the entrenched system and military influence.
"I think he believes he's using the military, not realizing that the military uses you," said Zaidi.
"I don't think there's any kind of substantial revolution coming. The electoral map, his choices of allies, friends, past leaders suggest that no such substantial change is coming."
- Imran Khan: Pakistan's Trump?
- Under Imran Khan's leadership, what does the future of Pakistan look like?
- Imran Khan wants to create a 'New Pakistan,' many fear more of the same
- Former cricket great Imran Khan claims victory in disputed Pakistan election
- Playboy cricketer to politician, Imran Khan says he's Pakistan's best hope
- Imran Khan's party wins Pakistan election but falls short of majority
- An Imran Khan victory would bode poorly for Pakistani women
- Pakistan PM Khan vows to grant Afghan refugees citizenship
- Imran Khan waits for confirmation of victory in election tainted by rigging claims
- Imran Khan says Prince William should know how much Diana was loved