After more than two decades of political campaigning, much of it spent in the political wilderness, Imran Khan has finally become Prime Minister of Pakistan. Along the way, as his ex-wife Jemima Khan noted on Twitter, he endured “humiliations, hurdles and sacrifices”. Now, the former cricket legend and philanthropist could become one of the most powerful civilian leaders the country has known.

Older readers will of course be familiar with him. After playing cricket for Oxford while he studied politics, philosophy and economics at Keble College, Khan became one of the best known Pakistanis in Britain. He figured prominently in tabloids for his social life, was often spotted at exclusive private members clubs like Annabel’s and Tramp.

He befriended Mick Jagger, Sting and Goldie Hawn while being on nodding terms with Prince Charles and other royals. He married Jemima Goldsmith, the journalist and filmmaker sister of Zac, and invited Princess Diana to Pakistan.

For Pakistanis, Khan was one of the few people who did them proud. Winning the Cricket World Cup in 1992 was a rare moment when Pakistan distinguished itself internationally. Pakistanis had grown weary of being principally depicted as a Third World basket case beset by social problems where women, minorities and the poor were treated appallingly. At times when boorish and condescending English cricketers like Ian Botham described Pakistan as “a place to send your mother-in-law”, Khan confronted that racism publicly.

Pakistanis craved a confident, good-looking spokesman and the former cricketer could play the part. It’s one of the reasons why many voted for him.

“I believe Oxford educated Imran Khan can stand toe to toe with world leaders and make a strong case for Pakistan,” wrote Haroon, a Pakistani singer and one of many celebrities, including cricketers, singers and actors who backed him. But he was also supported by a bewildering array of people from religious conservative backgrounds, wealthy businessmen, grafters from the middle classes, taxi drivers and factory workers.

Khan is many things to many people. Central to his appeal is that he has not been in power before. It was common to hear his supporters say: “We’ve tried the others”, referring to the parties of former prime ministers Benazir Bhutto and Nawaz Sharif, “let’s try him this time”. For people alarmed at endemic levels of corruption, Khan represents a rare, honest and financially “clean” leader valiantly battling against an entrenched venal order. For religious conservatives and nationalists, he soothes feelings of injured pride and rouses their spirits.

There are people whose support he should be embarrassed by. Sara Taseer, a Singapore-based entrepreneur, declared herself appalled by the sight of poor Baluch women lining up to vote. “Love seeing this turnout of women,” she tweeted, “but then I think would I allow these ladies to make a decision even about what be cooking in my kitchen today? And these ladies will decide on the future of the nation. Scary thought.”

And there are supporters he should stay clear of. Asad Umar, Khan’s finance minister to be, posted photos of himself courting the support of Fazlur Rehman Khalil, someone whose name is on a US terror watchlist.

Khan’s rhetoric is often studded with references to the plight of the poor and the ravages of the elite. “A country shouldn’t be measured by how its wealthiest live,” he said in his first speech after the election, “but by how its poorest people are treated.” Critics say that message is at odds with the composition of his party, which is dominated by some of the wealthiest people in Pakistani politics. Many of Khan’s candidates this time around were also drawn from conventional old parties or military regimes, undermining the claim that their election will herald a “new Pakistan”.

There are contradictions people notice in Khan's own pronouncements. When I interviewed him for The Independent, he came across as thoughtful, polite, serious and even good-humoured. On the campaign trail, however, he was seen as boastful and arrogant – making crude jibes against his opponents, taunting voters who support his rivals as “donkeys”, and denouncing liberals as “bloodthirsty”. He has forcefully denounced terrorism, and yet has been accused of being soft on the Taliban. Khan was a critic of Pakistan’s blasphemy laws and has defended religious minorities, but more recently vowed to protect the laws and accused his opponents of being part of a foreign plot to undermine it.

When I first came to Pakistan to report for The Independent, Khan was a fierce critic of General Pervez Musharraf’s military rule. I saw him on the streets supporting an independent judiciary, interviewed him the night before he was arrested for defying emergency rule, heard him speak out against attacks on the press, enforced disappearances, civilian casualties in military offensives, and covered his protests against CIA drone strikes. Those experiences do not easily reconcile with the image of him as a mere shill for the Pakistan army.

As prime minister, Khan will want to be the most powerful leader in the country. That distinction has usually belonged to the head of the army, which has ruled the country directly for three decades and wielded its clout backstage for the rest. It will be interesting to see how he negotiates these structural tensions. Some of the areas of dispute between Khan and the army have faded: drone strikes are rare, military operations he opposed are a thing of the past, and the US-led, Pakistan-backed “war on terror” is all but over.

So, how will Khan rule? As a crusader against corruption and champion of the poor, or as an angry demagogue? Will he strengthen Pakistan’s feeble civilian institutions or disappear into the shadows of the military? Can he unite all the different Pakistanis he appealed to this afternoon, or will he seek to deepen the dangerous political divisions that this election has revealed? Will Pakistan pursue peace with its neighbours, or will old modes of chest-beating belligerence endure?