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, the 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 December's 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, which 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 to modern life, while keeping a tight control over how Iranians use it and what information they receive. The regime's solution is to exert control over cyberspace by creating a so-called "halal net," a 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 the 2009 protests over the disputed re-election of hard-line President Mahmoud Ahmadinejad, then-nascent social media spread the word of the events among Iranians and brought videos of the shooting death of 26-year-old Neda Agha Soltan to the world.
Since then, 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 Hassan Rouhani, a relative moderate in the ruling clerical establishment, that have 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 the damaged economy. Even after the latest protests ended, he argued that it is 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 has evolved into what is known as the National Information Network., which 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 in the network are also gamed, 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.
The network resembles China's "Great Firewall," which blocks access to thousands of websites. Chinese internet users also find access to websites outside 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 U.S. intelligence firm Stratfor wrote in a Jan. 17 analysis.
Hard-liners have suggested removing Iran entirely from the internet and creating its own network at home.
Meanwhile, in the United States, 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 to communicate freely, according to U.S. officials briefed on the meetings.
However, fear of crossing U.S. sanctions has made companies skittish. Some firms do not allow their services to be used in Iran, preventing Iranians from accessing many encrypted communication apps or VPNs. They have remained reluctant even when the Trump administration has floated the ideas of easing some sanctions or offering carve-outs, said the officials, who demanded anonymity.
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.
Organizations including the Washington-based Public Affairs Alliance of Iranian-Americans have called on the U.S. 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 the alliance's Morad Ghorban.