Iran has some of the strictest controls on internet access in the world and blocks access to social media platforms such as Facebook and Twitter, although many users are able to access them through widely available software.
"Foreign messaging companies active in the country are required to transfer all data and activity linked to Iranian citizens into the country in order to ensure their continued activity," Iran's Supreme Council of Cyberspace said in new regulations carried by state news agency IRNA on Sunday.
The council, whose members are selected by Iran's supreme leader, Ayatollah Ali Khamenei, gave social media companies a year to comply, IRNA said, adding that the measures were based on the "guidelines and concerns of the supreme leader."
The new requirements could affect messaging app Telegram in particular. The cloud-based instant messaging service has gained popularity because of its high level of security and is estimated to have about 20 million users in Iran, which has a total population of about 80 million.
In November authorities said they had arrested administrators of more than 20 groups on Telegram for spreading "immoral content" as part of a clampdown on freedom of expression.