Garvan Walshe is a former national and international security policy adviser to the Conservative Party. 

It was more of a run-out after an unwise attempt at a cheeky single than a clean bowl down middle stump, but Imran Khan, the cricketer turned Prime Minister of Pakistan, was ejected from office last week, after defections from his coalition cost him his parliamentary majority.

Khan had persuaded the Speaker of Pakistan’s National Assembly to avoid holding a vote of no-confidence and tried to prorogue the House, but the Supreme Court forbade prorogation and required the vote, which Khan lost, to be held.

Khan won office in 2018 as the first civilian politician since the dictatorship of Zia ul-Haq not to emerge from the Sharif or Bhutto political dynasties. The one-time sporting playboy reimagined himself as an believing Muslim and embraced a populist style with gusto. His party won 149 of 342 seats in the National Assembly (the lower house) on just under one third of the vote. Khan cobbled together a six-party coalition.

But as economic problems mounted, his coalition partners began to waiver. Post-pandemic inflation and the jump in fuel prices caused by Russia’s invasion of Ukraine only increased the pressure. The Opposition put down a vote of no confidence.

Knowing he was going to lose, Khan got the Deputy Speaker, Qasim Khan Suri, to block the vote. Khan had argued that the no-confidence motion should be ruled out, claiming that it was the result of foreign (specifically American) interference. These efforts at “regime change” were, Khan claimed, enough to justify asking Arif Alvi, Pakistan’s president, to dissolve parliament before the no confidence vote.

Needless to say, there is no credible evidence of an American plot, as though this were Iran in the time of Mossadeqh; nor is there a United Fruit Company conspiring as in Guatemala of the1950s.

What Khan did face was powerful domestic opposition, from both the Sharif and Bhutto dynasties as well as the army. The Sharifist Pakistan Muslim League (Nawaz) — named after Nawaz Sharif, the former Prime Minister – and the Bhuttos’ Pakistan People’s Party joined forces to lead the opposition coalition that won the vote of no confidence.

The new Prime Minister is Shebaz Sharif, Nawaz’s brother. Nawaz was banned from holding public office in 2017 after the Panama Papers leaks showed him to be the beneficial owner of eight offshore companies.

Khan, ironically, had brought the Supreme Court case that led to Sharif’s disqualification. Now he holds street protests alleging the same court is working for the Americans.

Yet rather than showing how unstable Pakistan’s politics can be, these events show how much progress the country has made since the disastrous 2000s when Islamists took over the red mosque in Islamabad threatening the survival of the state, and Benazir Bhutto, whose father was executed by Zia ul-Haq in 1979, was herself assassinated.

Khan was not deposed in a coup, or even hounded out of office by street demonstrations. He lost a vote of confidence that he had tried to avoid by procedural chicanery but which the courts compelled the parliament to hold. As is fitting in a parliamentary system, he lost the vote, and was replaced by someone who could command a majority in the National Assembly.

Though it would be an exaggeration to suggest Pakistan has become a Nordic democracy, where everyone’s vote counts equally and the rule of law is upheld with consumate impartiality, its political institutions have done a reasonable job of mediating political disputes between centres of power in the country, and bringing about change without violence.

Though corruption is endemic, political patronage networks have become deeply embedded throughout Pakistani society, and the army retains an outsized level of influence over the country’s politics, Pakistan is much closer to being an (admittedly rather imperfect) democracy than at any time since Ayub Khan’s coup in 1958.

The crucial test of Pakistan’s return to democracy will be how the conflict between the new government and Khan plays out. With the support of a third of voters, and experience of organising street politics, Khan has the means to carry on his battles by extra-parliamentary means. However, it would be astonishing if the new government were not in a position to discover evidence of corruption or malfeasance in office that could be used to bring selective prosecutions against Khan and his office.

If Khan is really a democrat, he’ll focus his activty on building support at the next elections, which are due in a year anyway, and try to win again. If his opponents are so too, they’ll let him campaign and hope to beat him at the ballot box. Such restraint is rare in politics anywhere: if there is a silver lining to be extracted from the chaos of the 2000s it should be a memory of what can happen when all restraint is put aside and politcal victory is pursued à la outrance.