The irony in Iran's recent explosion of protests was that it was the country's theocratic government itself that provided the oxygen that fueled their startlingly swift spread, blazing from city to city.
For the past four years, authorities have encouraged wider internet use, allowing service providers to offer 3G and 4G networks, which in turn prompted a massive expansion in the use of smartphones. In 2014, around 2 million Iranian had smartphones; today, an estimated 48 million do. That means around half the population has in their pockets a device that can broadcast images and videos to the entire world and trade information away from state control and censorship.
The government snuffed out the protests in part by shutting down that oxygen, blocking the encrypted Telegram messaging app that protesters used to communicate. But the block was only temporary: Business people quickly complained over the shutdown of Telegram channels they use to promote and sell their goods.
As the Islamic Republic approaches the 40th anniversary of the revolution that brought it to power, it is trying to reap the benefits of a tool indispensable for modern life, while keeping a tight control over how Iranians use it and what information they receive. Tehran's solution to exert control over cyberspace is by creating a so-called "halal net," a totally locally controlled version of the Internet.
"The Islamic Republic is not black and white. It shows a myriad of contradictions and its Internet policy I think is one of the great examples of those contradictions," said Sanam Vakil, an associate fellow at Chatham House who studies Iran.
Since the 1979 Islamic Revolution, the government has tightly controlled information. The Internet, however, has threatened that control. During Iran's 2009 protests surrounding the disputed re-election of hard-line President Mahmoud Ahmadinejad, still nascent social media spread word of the events among Iranians and brought videos of the shooting death of 26-year-old Neda Agha Soltan to the world.
Since that unrest, Iran has barred Facebook, Twitter and other sites along with YouTube, which it had already been blocking. That has led to many Iranians to use virtual private networks, or VPNs, to elude the blocks.
It was the policies of President Hasan Rouhani, a relative moderate in the ruling clerical establishment, which allowed the proliferation of smartphones since he came to office in 2014. Rouhani's aim was to provide a tool for commerce as he tried to rebuild a damaged economy. Even after the latest protests ended, he argued that it was as impossible to stop people from using the Internet.
"If you want cyberspace to be useful to the community, come forward with a solution using it to promote the culture instead of blocking it," he said.
The idea of Iran setting up its own "halal," or "permissible," Internet first came in 2011 in the wake of the 2009 protests. It's evolved into what's known as the National Information Network.
It is essentially a net neutrality supporter's nightmare: The network has some 500 government-approved national websites that stream content far faster than those based abroad, which are intentionally slowed, according to a recent report by the Campaign for Human Rights in Iran. Service providers offer cheaper packages to customers accessing only the NIN websites. Search results also are gamed within the network, allowing the government to censor what users find.
One of the principal designers of the network is the Iran Telecommunications Co., owned by proxies of the powerful Revolutionary Guard.
It resembles in a way China's "Great Firewall," which blocks access to thousands of websites. Chinese internet users also find access to websites outside of the country slower.
Iran's "performance in strangling access to opposition content during the most recent protests proved that Iran is hard on China's heels in terms of controlling the flow of information," the private US intelligence firm Stratfor wrote in a January 17 analysis.
Hard-liners have suggested removing Iran entirely from the Internet and creating its own at home.
Meanwhile, the Trump administration is trying to find ways to increase Iranians' access to the Internet. Officials have met with Google, Facebook, Twitter and other tech companies to ask what more they can do to help people in Iran and other authoritarian-run countries communicate freely, according to US officials briefed on the meetings.
But fear of crossing US sanctions has made companies skittish. Some firms don't allow their services to be used in Iran. That prevents Iranians from accessing many encrypted communication apps or VPNs. They've remained reluctant even when the Trump administration has floated possibly easing some sanctions or offering carve-outs, said the officials, who weren't authorised to discuss the conversations and demanded anonymity.
So it remains in question whether Iranians will have access to an open Internet if anger over the economy boils over into protests again, as many predict it will
Organisations like the Washington-based Public Affairs Alliance of Iranian Americans and others have called on the US to offer specific guidance to online firms allowing Iranians to access apps and services.
"This movement has continued despite persecution by hard-line elements," said Morad Ghorban of the PIAA.