Russia could block access to Facebook and Twitter if the social media companies fail to fulfil its demand to move data on Russian users to servers located within the country, officials have warned.

Alexander Zharov, the head of Roskomnadzor, Russia’s communications watchdog, said the western companies had nine months to bring their operations in line with Russian internet security laws. “They’ve been given time to comply,” he said.

A law approved in 2014 by Russia’s president, Vladimir Putin, requires domestic and foreign companies to store the personal data of Russian citizens on servers in Russia. Those who refuse can be fined or prevented from operating in the country. In 2016, Russia blocked LinkedIn, the professional networking website.

Last week, Moscow ordered Facebook and Twitter to pay fines of 3,000 roubles (£36) over their refusal to obey the law, a move that was mocked by social media users. However, the fine was the minimum allowed under the law, and Zharov warned that the scale of punishments would steadily increase.

Russia has threatened in the past to block the two sites for violations of the law, but this is the first time it has issued such a specific ultimatum.

Both Twitter and Facebook have been widely used by the anti-Putin opposition to coordinate demonstrations and publish investigations into alleged high-level corruption. Critics fear storing the personal data of users in Russia would allow the Kremlin’s security services to access information on opposition activists.

Facebook said in November that it had 6.2 million users in Russia, a number dwarfed by the 70 million Russians who use VKontakte, the country’s most popular social networking website.

VKontakte’s founder, Pavel Durov, was forced to give up control of the company after backing street protests against Putin in 2011-12. It is now owned by the Mail.ru group, which belongs to the Kremlin-friendly billionaire Alisher Usmanov.

Russia has also attempted, with limited success, to block Telegram, the messaging service set up by Durov in 2013. It continues to be widely used, including by senior Russian government officials who are reported to use VPNs (virtual private networks) to get around the ban. Officials last month threatened to block popular VPNs unless they agreed to restrict access to websites banned by Russia.

Zharov’s comments came shortly after Russia’s parliament approved a bill that would allow Moscow to cut off the country’s internet traffic from foreign servers. Critics say the move would lead to greater censorship, while the authors of the bill say it is aimed at making Russia’s internet less vulnerable to cyberwarfare.