The drama has laid bare the perilous state of Pakistani politics - a winner-take-all game in which security forces and the justice system are wielded as weapons to sideline those who have fallen out of favour with the country's powerful military establishment or political elite.
Once in office, he and his supporters employed those same tools to harass and silence journalists and political opponents who criticised him. But the well-worn playbook seems to be doing little to keep him in check, at least so far, and some analysts fear the showdown could erupt into violence. The last prime minister to be driven from office before Mr Khan, Mr Nawaz Sharif - the older brother of the current prime minister - was disqualified from holding office in 2017 over corruption charges in a controversial verdict by the Supreme Court.
But the crackdown appears to have heightened Mr Khan's popularity, analysts say, bolstering his claims that the military establishment conspired to topple his government in April. The crackdown on Mr Khan and his supporters has intensified frustrations among young, social media savvy Pakistanis and the older generation alike over the entrenched corruption and all-powerful hand of the military in the country's political system.