Imran Khan has been ousted as Pakistan's prime minister after a vote of no confidence in parliament. But what led to his downfall? When Imran Khan was elected prime minister in 2018, he seemed to have almost everything.
A national hero from his cricketing days, he had transformed into a charismatic politician. After years of struggle, he managed to supplant the two rival established political dynasties that had dominated Pakistan for decades.
He emerged as a new force, with vibrant rallies full of catchy songs that amplified his staunch anti-corruption message and his vast social media presence. Mr Khan promised to bring "change" to the country, creating a "new Pakistan".
No prime minister has ever completed an entire five-year parliamentary tenure in Pakistan, and Imran Khan looked as though he could well be the first.
However, his position appeared so secure also helps explain his downfall. Both sides deny it, but it's widely acknowledged he came to power with the help of Pakistan's powerful army and intelligence services - and now he has fallen out with them.
Mr Khan undoubtedly had significant, genuine public support in 2018.
But he also had the covert backing of what is referred to as "the establishment" or the military in Pakistan. The army has directly or indirectly controlled the country for most of its existence, and critics labelled Imran Khan's government a "hybrid regime".
The support for Mr Khan exemplified itself in a host of different ways. During the 2018 election campaign, media outlets reporting sympathetically on his opponents had their distribution curtailed, while some candidates standing for election were either cajoled or coerced into joining his party.
"He was made by them," one defecting member of Imran Khan's party told the BBC, referring to the military. "They were the ones that brought him into power."
His chief opponent, Nawaz Sharif, was first disqualified and then convicted on corruption charges. Many suspected that Mr Sharif had indeed been involved in corruption in the past - but the real reason he was being punished at this stage was his own falling out with the army.
Mr Sharif had started his political career as a protégé of a military dictator before later growing more independent and invoking the ire of the "establishment". He has always denied being involved in corruption, claiming the charges are politically motivated.
After coming to power, Mr Khan, by contrast, proudly proclaimed he and the army were on "one page" when it came to policy decisions.
The results worried civil society activists, with a spate of attacks and abductions targeting journalists and commentators critical of Mr Khan's government and the intelligence services. They both denied involvement, but no other culprit was ever identified.
Mr Khan has insisted his focus is on improving governance. For example, he has made some impressive expansions to the social welfare system, introducing a health insurance scheme in large parts of the country.
However, in other areas, he has faltered. His decision to appoint an inexperienced and underqualified political newcomer to a key position, chief minister of Punjab, the country's most populous province, was widely ridiculed.
At a loss to explain why Mr Khan refused to replace his appointee, Usman Buzdar, despite overwhelming criticism, rumours spread that the prime minister's wife, a spiritual guide of sorts, had warned him Mr Buzdar was a good omen and - if he were to be sacked - his entire government would collapse.
There were other challenges, too. The cost of living in Pakistan has been rocketing up, with sharp rises in food prices and the rupee falling against the dollar.
Imran Khan's supporters blame global conditions, but public resentment against him has risen. "The Sharifs might've filled themselves up, but at least they got work done" has become a common grumble.
Still, the prime minister looked to be the best bet for the military for a while. He cut an impressive figure on the world stage. His decision not to order a complete lockdown during the coronavirus pandemic was vindicated by fewer than expected deaths - though no one can still be exactly sure why.
Meanwhile, his opponents were becoming increasingly vocal in their opposition to the military, naming the army chief, Gen Bajwa, and the head of the intelligence services (ISI), Lt Gen Faiz Hameed, as being responsible for "selecting" Imran Khan to office.
|Revealed In 2022
Best Day Trading Strategies for Beginners
The dynamic changed dramatically last year. A number of observers told the BBC the army began to grow increasingly frustrated with Mr Khan's failure to deliver good governance, particularly in Punjab, and perhaps at how they were being publicly blamed for bringing him into power by the opposition.
Most crucially, a rift began to appear between Gen Bajwa and Lt Gen Faiz Hameed, who was widely seen as hoping to become the next army chief.
Lt Gen Hameed was apparently so confident of his prospects that he had even previously told officials in neighbouring Afghanistan he would be the next man in charge of the army.
However, one source close to the military said that while Lt Gen Hameed was seen as someone who could handle "dirty jobs" effectively, a reference to manipulating politicians or silencing critics, he was not seen as someone fit "to lead the institution".
The tension between the two powerful figures was noticed during a private interaction with influential commentators last summer. One journalist asked a question, only to be told by the head of the ISI that time had run out.
"I'm the chief," interjected Gen Bajwa curtly, "and I'll decide when we're done," before taking the question and answering it at leisure.
In October, the dispute escalated and enveloped Imran Khan. Gen Bajwa was understood to want a new man in charge of the intelligence services, and the army announced a change in roles.
Mr Khan, however, who had developed a close relationship with Lt Gen Faiz Hameed, resisted, apparently wanting him to stay on until elections had taken place - the assumption being that Lt Gen Hameed could once again help ensure Mr Khan's victory.
The prime minister held off issuing a formal notification approving the posting change for nearly three weeks before eventually relenting. The now visible cracks between the military and Imran Khan's government emboldened the opposition.
When they began plotting a vote of no confidence and sounding out potential defectors from within his party and coalition allies, a number of sources told the BBC, the military made clear that they were going to be "neutral" on this occasion.
One defecting member of Mr Khan's party told the BBC he and other parliamentarians used to receive "calls" from the intelligence services, directing them on what to do.
"We used to be manhandled," he said indignantly. However, once Lt Gen Faiz Hameed left office, the "calls" stopped. "Now the army is not interfering," he added.
Journalist Kamran Yousaf told the BBC that the military had been involved in "managing" Imran Khan's allies and a slim majority in government. "Once that support was missing, his downfall was inevitable," he said.
Further differences have emerged between Mr Khan and the army, notably in foreign policy. Although he defended visiting Moscow on the day Russian troops crossed into Ukraine and brusquely rejected attempts by Western officials to issue a condemnation of President Vladimir Putin's behaviour, Gen Bajwa said last week that the invasion "must be stopped immediately".
Mr Yousaf said Imran Khan had also earlier "scuttled" an attempt championed by Gen Bajwa to partially restore trade with regional rival India "because of the political cost".
Ironically, previous civilian governments have fallen foul of the Pakistani military because they have favoured improving ties with India - but at that stage, the military wasn't.
Mr Khan, however, has repeatedly indicated he will not give up the fight. He alleges he is the victim of a US-led attempt to affect "regime change" in Pakistan because of the anti-Western tilt in his foreign policy, which has included criticism of America's war in Afghanistan.
Most analysts have dismissed this as a deliberate exaggeration of a diplomatic cable sent by the Pakistani ambassador in Washington.
It's a narrative. However, that does appear to be resonating with Mr Khan's supporters, tapping into a reservoir of anti-Americanism in the country.
Ironically, the Pakistani army has fuelled an atmosphere conducive to conspiracy theories by repeatedly warning of the dangers of vague "foreign plots" or "foreign agendas".
TOP 3 CRYPTOCURRENCIES TO INVEST IN 2022
Mr Khan once told his cricket team to "fight like cornered tigers", and he looks set to be a formidable character in opposition. Source: MSN