For cricket legend-turned-politician Imran Khan , his party’s first place in a national election, putting him on the brink of becoming the country’s next prime minister, is the culmination of a battle that started more than two decades ago.

For years, he was dismissed as a political dilettante who could not convert his personal popularity into significant seats in parliament for the Pakistan Tehreek-e-Insaf (PTI), or Pakistan Movement for Justice, he founded.

But Wednesday’s election has dramatically changed that, crossing new boundaries for the country and putting the former sports star on the brink of power. With nearly half the votes counted PTI held a commanding lead, and Khan declared victory in a speech on Thursday.

George Weah, one of Africa’s greatest footballers who took over as president of Liberia earlier this year, is the only other internationally recognized sports personality to head his country’s government.

As prime minister, the 65-year-old Khan will be tested on several fronts, from dealing with an urgent foreign currency shortage to managing a tense relationship with the United States.

“I don’t discount the role that experience in sports leadership can translate into other domains,” said Sameer Lalwani, the co-director of the South Asia program at the Stimson Center think tank.

“(But) he has never had to govern... I worry that what we’ve seen about his public profile and the way he portrays himself, that he is much more likely to surround himself with sycophants.”

Khan will also have to battle allegations that he has been helped by military both during the campaign and in the vote count - rival parties have said soldiers at voting centers threw out their observers when counting began.

Khan has denied the accusations.

An Oxford graduate, he campaigned hard on a populist promises of a prosperous Pakistan that breaks away from its persistent legacy of corruption.

Before the advent of PTI, Pakistani politics has been dominated by two parties - former prime minister Nawaz Sharif’s Pakistan Muslim League-Nawaz and the Pakistan People’s Party of assassinated former leader Benazir Bhutto - when the military has not been in power.

CRICKET STAR

Khan began his cricket career in 1971 as a fast bowler known for his pace and aggressive tactics. By the time he retired more than 20 years later, he was regarded as one of the world’s best ever all-rounders.

A glamorous fixture of London’s high society in his younger days, he was captain of Pakistan’s team of talented but wayward stars and - with a reputation as a stern taskmaster - led them to win cricket’s World Cup for the first time in 1992.

He is still known as “Kaptaan” (captain) in Pakistan.

After his retirement, Khan raised funds to open a cancer hospital in the memory of his mother in his native Lahore in 1994.

He has mostly shed the playboy image and made public shows of devotion to Islam, building a large political following in northern Pakistan, especially with the conservative Pashtun population.

Earlier this year, he married his spiritual adviser. Khan’s previous two marriages, particularly when he wed his first wife, British heiress Jemima Khan, had captivated international tabloids.

Khan started the PTI in 1996, but until 2013 it briefly held only one seat in parliament.

“It’s been a 22-year struggle for justice for the people of Pakistan,” Khan told Reuters in an interview earlier this month.

His party became the country’s third-largest in the National Assembly in the previous election, benefiting in part from a groundswell of support, especially from young, urban voters fed up with the country’s corruption.

Relations with Washington

Khan has been critical of the United States’ policy in the region and vocally opposed drone strikes on Pakistani territory.

He will have to manage a tense relationship with Washington, which has accused Islamabad of not doing enough to root out Taliban militants.

Earlier this year, President Donald Trump tweeted that the United States had “foolishly” given Pakistan more than $33 billion in aid.

Khan opposes the United States’ open-ended presence in Afghanistan. In his victory speech on Thursday, he said he wanted “mutually beneficial” relations with Washington, and peace in Afghanistan.

“I do think he will be publicly more adversarial.. (But) he is certainly capable of being more pragmatic, that just hasn’t served his purposes in campaigning and branding himself,” said a former senior US official, who has met Khan several times.

The official, speaking on the condition of anonymity, said Khan’s stance on the United States would likely be moderated by military, which is seeking a more stable relationship with America.

ECONOMIC CHALLENGE

Khan will also have to urgently resolve a currency crisis that threatens Pakistan’s fast-growing economy, which expanded by 5.8 percent in the past year but will most likely need its second bailout from the International Monetary Fund (IMF) since 2013.

He has said his future government will launched an anti-corruption campaign and poverty reduction program modeled on China, Pakistan’s traditional ally that has financed billions of dollars of infrastructure projects.

At the same time, he has promised to build an “Islamic welfare state”, create 10 million jobs and build 5 million homes for the poor.

Asked how he would fund such social spending, he vowed to double Pakistan’s woefully low tax collection rates - the country has one of the world’s lowest tax-to-GDP ratios - by cracking down on wealthy tax dodgers.