Eight years ago, when President Mahmoud Ahmadinejad first took office, the Iranian government announced plans to develop a national internet network.
The project attracted little attention at the time but now, with less than two months to go until the next presidential election, some analysts say it is so well advanced that the authorities could soon be in a position to cut off the entire country from the world wide web.
When Iran's former Information Technology Minister Mohammad Soleimani complained last week about the difficulties he was having accessing the internet, he was expressing the frustrations of many.
"This morning I was struggling to open my Gmail account," he told the Iranian news agency ILNA. "In the end I had to give up. Why doesn't anyone want to take responsibility for this?"
For months now, Iranian social media sites have been full of postings about slow download speeds and intermittent access.
While some put the blame on the country's overloaded and outdated internet infrastructure, others have a more sinister explanation for what is going on.
"When we get old we'll be able to tell our grandchildren about the time when a demon came along and nationalised the internet," wrote Habil, an angry internet user from Tehran.
What Habil was referring to was the Iranian government's plan to create what it is calling a "national information network" - in effect a sort of corporate intranet system for the whole country.
The authorities say the project will improve internet access and protect the country from cyber attack.
Critics say what it will actually do is to seal the country off from the world wide web.
Aziz Ashofteh, the co-founder of the popular Iranian website Balatarin (an Iranian version of Digg) says government programmers have spent the past few years working on a system which will enable people to go about their business and communicate with each other inside the country, while at the same time giving the government the power to control their access to the world outside.
He told the BBC that the government "now has a 'switch off' button for the internet, without being concerned about potential damage to governmental departments and the banks".
London-based Iranian IT analyst Mahmoud Enayat says the authorities have a long track record in blocking sites they consider undesirable. Their first targets were sites with adult content, or an openly anti-government message. But the turning point came in 2006 when the popular BBC Persian site was blocked.
"After that, (filtering) became a political tool," says Mr Enayat. "They were even blocking access to independent news sites."
Despite the government's efforts, Iran has become a nation of internet enthusiasts.
According to the latest Iranian figures about 45 million people out of a population of 75 million are now online, making Iran the country with the highest proportion of internet users in the Middle East.
"Iran has a very tech-savvy population," says John Rakowski, an internet infrastructure analyst with Forrester research company.
"More than half the population are under 35. They don't remember a time when the computers didn't exist."
For much of the past decade these young Iranians have been finding increasingly sophisticated ways of bypassing the government's attempts to filter a succession of sites.
The result is that global social media sites like YouTube, Facebook and Twitter are all hugely popular and widely used in Iran despite being officially off limits.
This became especially evident after the disputed presidential election in 2009 when big street protests were organised via the internet.
As the authorities tried to restrict the movements of international journalists covering the story, young Iranians with mobile phones posting news and videos on social networking sites kept the rest of the world in touch with the dramatic events unfolding on the ground.
The authorities want to avoid anything similar happening when Iranians go to the polls again this June, and observers say this could be one motivating factor behind their plans for a national internet system.
But internet analysts say comparisons with other countries also trying to maintain strict controls on the internet, like China and North Korea, raise big questions about how far the Iranian government will be able to go.
'Like food or water'
North Korea has a nationwide intranet called Kwangmyong (meaning "bright") which offers a limited number of local news and chat services.
"The difference is the North Korean people never had a taste of the internet," says John Rakowski. "The people of Iran have already had access to the internet, blogging, Twitter. To take that away is like taking away a necessity like food or water."
China, unlike North Korea, has a vast network of "netizens" but they operate on home grown sites like Weibo, the Twitter equivalent microblogging site, and Baidu, a local search engine that is more popular than Google.
"There are Iranian equivalents to Facebook, Twitter and YouTube," says Mahmoud Enayat. "But none of them has been successful."
"The likes of Baidu are built by the private sector in China. That can't happen in Iran, as Iranian companies haven't been able generate an income stream," he says.
So does the idea of national internet system have anything to offer to ordinary Iranians?
The government's claim that it will protect against cyber attacks has been roundly dismissed by industry insiders.
Collin Anderson is an American researcher who has been mapping the emergence of the new national network in Iran. He accesses systems through proxy sites and says he has had no problem breaking through the firewall protecting the new system.
"It just adds five minutes of extra complications," he says.
But one area where the new system could score points is speed.
The national internet promises a new system which will be up to 60 times faster than the best speeds currently available.
To make the point the government is now deliberately making sure that access to local sites is much faster than to overseas ones.
It is a situation which Reza Moeini of Human Rights Watch describes as "digital apartheid".
Since the government first announced its plans for the national internet in 2005, it has clearly invested a lot in state of the art technology infrastructure - fibre optic cables, and new data centres to enable many more sites to be hosted inside the country rather than abroad.
The results are already being felt in some areas.
"Before this, if someone, for example, wanted to visit the Ministry of Finance's website, the traffic would have gone outside the country and would have come back," says Mahmoud Enayat.
Now access is not only much faster, but it is cheaper too. There's no need to pay for international bandwidth.
But it is by no means clear that speed will be enough to compensate for access to sites which enable people in Iran to keep in touch with each other and with the rest of the world.