Many Iranians continue to access the services despite the bans, circumventing the technical blocks by routing traffic through an overseas internet address.

Twitter has been blocked in the country since 2009 but Rouhani has official accounts that tweet both in Persian and English. Former president Mahmoud Ahmadinejad has also fostered a sizeable Twitter fanbase.

Instagram is the last major social media service officially available in Iran, and Rouhani’s official account has posted more than one thousand times, often showing pictures of flag-waving crowds and the president himself on photo-ops, with accompanying messages in Persian.

It is unclear when Iran’s ban is due to go into effect. The country curbed access to some internet services, including intermittently restricting Instagram, a year ago, a move that Donald Trump criticised at the time.

The block comes as Iran has increasingly been blamed for attempts to use social media to disrupt politics in the UK and the US. In August, Facebook, which owns Instagram, deleted hundreds of accounts on both services that were linked to Iranian state media.