TEHRAN, Iran — Before Nazilla Akbari can check out the latest offerings on Twitter or YouTube, she scrolls through an array of icons on her smartphone, searching for the right workaround to bypass state censors.

It’s a cat-and-mouse game that has become second nature in Iran, where the clerically-led government restricts access to popular social media sites and where U.S. sanctions create other barriers.

“Every day I struggle for 40 minutes just to get connected to uncensored internet,” Akbari, a 30-year-old software developer, told The Associated Press. “Even after I do, the internet is so slow that I have difficulty even watching a short video.”

Iranian authorities have sought to limit Western cultural influence since the 1979 Islamic Revolution. They began blocking popular sites like Twitter, Facebook and YouTube when activists used them to organize mass protests and document a crackdown after a disputed election in 2009.

That hasn’t stopped Iranians from accessing such sites through virtual private networks, or VPNs, and other services. It also hasn’t prevented a number of top Iranian officials from using the sites to broadcast the official line. Foreign Minister Mohammad Javad Zarif frequently tweets in English, and accounts believed to be run by the offices of Supreme Leader Ayatollah Ali Khamenei and President Hassan Rouhani regularly post on their behalf.

Khamenei himself has urged the nation’s youth to “smartly use the cyberspace to slap the enemy in the mouth,” and pro-government accounts have proliferated on Twitter and Instagram.

Rouhani, a relative moderate in Iran’s clerical establishment, vowed to expand internet freedom when he was elected in 2013 but has failed to fully deliver on those promises, in part because the judiciary and security forces are dominated by hard-liners. In 2018, authorities blocked Telegram, an app that had been used by tens of millions of Iranians to send encrypted messages, after it was used to organize protests over economic hardships.

YouTube also remains largely off-limits, as it’s hard to download and view videos while using the workarounds.

“YouTube is like an online university, but it’s blocked,” Akbari said.

Hard-liners fear that full access to the internet would allow Western countries to penetrate the Islamic Republic and foment unrest against the ruling clerics.

“Cyberspace is controlled by foreigners,” said Ayatollah Mohammad Ali Movahhedi Kermani, a hard-line cleric who leads Friday prayers in Tehran. “They want to make the people pessimistic about the government.”

Authorities have developed their own closed system, known as the “national information network,” that blocks many foreign sites and slows access to others. Some refer to it as the “halal net,” applying the term used for that which is permitted under Islam. Officials say it is designed to protect the country from cyberattacks and US sanctions. Iran is also developing its own services for messaging, online banking and entertainment, part of a larger push for self-sufficiency amid Western sanctions.

The government has taken steps to expand access and widen bandwidths, with Rouhani claiming earlier this month that all towns and 78% of villages have access to high-speed internet. But many Iranians say surfing the web remains a disappointing experience.

“The number of users has grown at a much faster rate than the speed of the country’s internet,” said Danial Behzadi, an information technology expert. “In general, the internet in Iran is relatively slow, expensive and has poor neutrality.”

The sanctions have also created barriers, with the US government barring many tech firms from providing services in Iran. The Trump administration has ramped up sanctions, including on the country’s vital oil industry, since withdrawing the US from Iran’s nuclear deal with world powers last year.

Users trying to download apps frequently encounter messages saying such services are prohibited, and some American companies suspend accounts when they realize the users are in Iran.

The sanctions also restrict the ability of Iranians to shop online.

Iranians are unable to use major credit cards or online services like PayPal because the country is cut off from the international banking system. Amazon refuses to ship to Iran because of the sanctions. In a recent filing with the Securities and Exchange Commission, the online retail giant said it suspected Iranian embassies and diplomatic missions abroad had purchased more than $50,000 in goods, everything from books and apparel to toys and pet products.

Akbari recalls having to purchase a new keyboard for her laptop. When Amazon refused to send it to Iran, she asked a relative to buy one in Dubai.

“This is just an example,” she said. “There are thousands of things you see on the internet you want to buy, but you can’t.”

Despite the limitations — or perhaps because of them — Iranians have become skilled at evading censors through proxy servers and VPNs.

Software developer Mehdi Beygi said he recently received an email from a popular coding platform saying that his account had been restricted because of US sanctions.