Despite the service being blocked for ordinary citizens, many of Iran’s top officials tweet regularly, including the president, Hassan Rouhani, and the foreign minister, Mohammad Javad Zarif.

Even the office of the supreme leader, Ali Khamenei, maintains accounts in several languages.

Iranian users – who can get round the restrictions using privacy software – were quick to point out the irony that Twitter was banned after mass protests against Ahmadinejad’s re-election in 2009.

In defence of Donald Trump’s Twitter diplomacy | Mary Dejevsky

Read more

The protests, which came after accusations of election-rigging, were considered the first time in the world the service was used to promote and organise demonstrations, and earned the nickname the Twitter revolution.

Twitter and other social media sites would go on to play a significant role in protests around the Middle East during the Arab spring a couple of years later.

Ahmadinejad, who was president from 2005 to 2013, has been pushing for a return to frontline politics in the run-up to the presidential election in May.

However, his erratic and insubordinate style saw him fall out with the conservative establishment during his time as president, and Khamenei advised him last year against running again.