The battle between Imran Khan's supporters and the powerful Pakistani military has this week been raging on two fronts – on the streets and on social media. And on one battlefield, the former prime minister seems to have the upper hand.
Within hours of Imran Khan's arrest on Tuesday, Pakistan's government had clamped down on the country's internet, in a move to quell resistance.
The capture of the swashbuckling political leader immediately sparked protests nationwide.
In Lahore, Nighat Dad rushed home after hearing Khan had been detained. Leaving the office in the city centre, the lawyer's staff had already started to encounter violent protesters.
"A mob tried to attack their cars and stop them from leaving," she told the BBC.
As one of Pakistan's leading digital rights activists, she was also keeping an eye on the discourse raging online.
Images of stone-throwing protesters in clouds of teargas unrolled across social media and pinged across WhatsApp groups. Video of the arrest – Khan being swarmed by paramilitary troops – went viral. His party, the Pakistan Tehreek-e-Insaf (PTI), spat out rapid-fire updates on their Twitter page.
To control the rapidly escalating situation, the government flipped the switch. Across the country, social media sites went down – people struggled to load Facebook, YouTube and Twitter.
Mobile networks were also blocked in some places, resulting in a full connectivity outage. Elsewhere, internet speeds were throttled.
When the blackout came, for most Pakistanis it wasn't unexpected. Those that could, booted up their VPNs – demand for the services which reroute a user's internet location skyrocketed by 1,300%, trackers later told the BBC. Those with mobile access continued on WhatsApp.
Shutting down the internet has become a familiar move in the authoritarian playbook, particularly in South Asia in recent years. Authorities plunge the country offline to control the flow of information, and suppress any dissent or protest, experts say.
"Governments have a hammer, and it's easy to treat the internet as a nail," says Kathik Nachiappan, a South Asia expert based in Singapore.
In Pakistan, the move has particular impact because it shuts down what is seen to be the only place to get "real news" in the country – a decade of attacks on the country's independent journalists and newspapers by the military authorities is widely regarded to have muzzled the mainstream media.
Trust that mainstream outlets will adequately inform the public has broken down so much that people go online to find out "what is truly going on", says Uzair Younus, a Pakistani politics expert with The Atlantic Council, a US-based think tank.
"People say 'OK, it's not worth really watching television, because the military is governing what can and cannot be said,'" says Mr Younus.
So when it comes to breaking news like Khan's arrest, people flock online, to reputable journalists and YouTube channels as well as social media.
"I was glued to my screen at work, watching Geo News, one of the country's largest broadcasters," says Mr Younus. "But then I was getting a whole lot more information about protests – who had been shot, where tear gas was being shared – on WhatsApp and on Twitter. Geo was not covering any of that."
Of course, there are all the usual issues that come with relying on social media news – in Pakistan's bitterly complicated political scene, misinformation, disinformation, and conspiracy theories are all rampant, and often peddled by the political actors themselves.
This video can not be played
Watch Tuesday's dramatic arrest of Pakistan's former prime minister
No matter what kind of information people are consuming, limiting online access is a gross violation of fundamental rights, says Ms Dad, who runs the Digital Rights Foundation in Lahore.
"When you shut down the Internet, people have no choice in accessing information," she says.
She argues the authorities' blanket ban violates freedom of speech, access to information and the right to assembly – which are all enshrined in Pakistan's constitution. Internet access is a human right recognised by the United Nations.
But for Pakistanis, internet censorship days have become increasingly common since Mr Khan was voted out by parliament last April.
The charismatic politician has been on the comeback trail ever since, charging around the country on a convoy, loudly claiming his removal was illegitimate and the charges against him are false. He has spurred thousands to attend his rallies.
Netblocks, a UK-based internet monitor, has counted at least three major internet disruptions linked to Khan's rallies before his arrest – but this week's was the worst yet.
"This is possibly the most severe censorship that we've tracked for Pakistan in recent times," Netblocks researcher Alp Toker told the BBC.
"The scale of it and the fact it involves multiple forms of disruption – both the mobile networks and the social platforms – show a concerted effort to control the narrative."
Netblocks identified that the mobile networks affected had gone down in areas in Punjab – a Khan stronghold and Pakistan's most populous province. The telecoms authority later confirmed it had sent around the kill order following a directive from the interior ministry.
For Pakistan's current rulers, shutting down the internet is a significant move and one not taken lightly. It cuts off public access to healthcare, emergency and financial services.
It has been a big hit to an already failing economy, affecting businesses across the country. Tens of millions of Pakistanis – from delivery drivers to the tech community – rely on the Internet to earn a living.
On Wednesday, hundreds of Pakistani business leaders and civil rights figures signed a letter condemning the internet shutdown, expressing fears that it would negatively affect the country's vibrant tech sector – one of the only areas bringing in much-needed foreign investment.
But political watchers say it's clear that authorities are willing to sacrifice all that to cut off one of Mr Khan's greatest advantages- his dominance online.
His party, the PTI, has the major edge over political competitors with a younger, tech-savvy voter base. Its social media machine – credited with delivering the 2018 election – is miles ahead of the competition.
The military and the government are worried about the party using social media for "anti-army political mobilisation" says Asfandyar Mir, a Pakistan politics and military watcher with the United States Institute of Peace. It's something that Khan himself is personally invested in, he says.
"The military in particular sees the scale of retweets and likes on twitter as a signal of political strength which can have knock on mobilisation effects," he said.
Since Khan's arrest, the PTI has been feeding a legion of about nine million followers on Twitter with hourly updates. Khan himself has over 19 million followers on Twitter – the military has about six million and the current PM, Shehbaz Sharif, 6.6 million followers.
What's even more galling for the military now, is that they had previously hitched their social media presence to Khan's bandwagon.
When Khan rose to power in 2018, then with the support of the military, the generals had outsourced the task of building their not insignificant social presence to the PTI as a joint effort. But when Khan and the army fell out, the PTI managed to wrest away most of their online following.
The military has since found itself on the back foot online, struggling to control the narrative, says Mr Younus. It fended off campaigns from the PTI coordinating followers through hashtags and site attacks.
Under attack on their YouTube account this week, the military at first disabled rabid comments from Khan's supporters. In the end, they just turned the whole thing off.
"Because they don't have the capability the PTI does on social media, the obvious answer was to turn it all off because that's the only way they can control things," says Mr Younus.
But blocking social media is only one layer of disruption. Much more crucial to organising efforts for protesters is WhatsApp – the messaging app seen as the backbone for information flow in the country.
Both political sides are pushing out their message on the app, but the PTI again has a slight upper hand.
"They've done a fantastic job of creating these communities and groups through which they proliferate information or their own narrative," Mr Younus says.
On Friday, as the situation remained tense across the country, most citizens still had little access to the internet.
The army had been deployed in the capital and the twists and turns in Khan's legal case threatened to kick protests off again.
Some people had regained access to Facebook and YouTube, but the restrictions were patchy and arbitrarily applied across the country.
The political fervour, however, remains at an all-time high and the discussion is still raging online.
"People are charged and emotions are high, not only because of what's happened to Imran Khan but also because of the economic downfall in the country," says Ms Dad.
"It's a mix of anger and frustration that has come to a boiling point. Everyone has something to say."
Why India is the world leader of internet shutdowns
Love letters and landlines return in cut-off Kashmir
Imran Khan's arrest was illegal – Supreme Court
Why was Imran Khan arrested?
Mass protests across Pakistan after ex-PM arrest
Polarised politics are tearing Pakistan apart
The cricket hero bowled out as Pakistan's PM
Millions told to wear masks as poor air quality hits North America
22-month-old child among injured in French playground attack
Trump told he could face charges over documents
Catching the men who sell subway train groping videos
Maps and images show scale of Ukraine dam floods
Misogyny helped jail a mother. Science freed her
What to do with the bodies of those killed in Sudan
Why this teen says he was rejected by top US colleges
The only place in the world selling lab-grown meat
Could AI create more work for humans?
Why it took 42 years to convict a 90-year-old in India
Why is Japan redefining rape?
Tech Decoded: The latest news direct to your inbox
Tech Decoded is the BBC's international technology newsletter, bringing you the latest twice a week
Why the city that never sleeps is slowly sinking
The generation clocking the most hours
© 2023 BBC. The BBC is not responsible for the content of external sites. Read about our approach to external linking.