When Pakistan’s government censored the media, former Prime Minister Imran Khan’s party posted campaign videos on TikTok. When the police barred his supporters from holding rallies, they hosted virtual gatherings online.

And when Khan ended up behind bars, his supporters produced speeches using artificial intelligence to simulate his voice.

Khan’s message resonated with millions across the country who were frustrated by the country’s economic crisis and old political dynasties: Pakistan has been on a steep decline for decades, he explained, and only he could restore its former greatness.