FILE PHOTO: Iranian President Hassan Rouhani speaks during a meeting with Muslim leaders and scholars in Hyderabad, India, February 15, 2018. REUTERS/Danish Siddiqui/File Photo

DUBAI (Reuters) - Iranian President Hassan Rouhani has criticized the ban imposed on popular messaging app Telegram by the conservative-run judiciary, saying the move was “the opposite of democracy”.

Iran blocked Telegram - widely used by Iranians, the state media, politicians and companies - earlier this week to protect national security, state television said, weeks after a similar move by Russia.

Iran had been considering the ban since January when protests over economic grievances erupted in more than 80 cities and later turned into demonstrations against the clerical and security elite.

Some officials said protesters used Telegram to organize rallies, which were ultimately contained by the Revolutionary Guards and their affiliated volunteer Basij militia. The app was temporarily blocked in January.

“Failure to follow legal procedures and the use of force and judicial means is ... the opposite of democracy,” Rouhani, a pragmatic cleric who has advocated expanding social freedoms, said in an Instagram post late on Friday.

“The filtering and blocking of Telegram was not carried out by the government which does not approve of it,” said Rouhani, who has opposed restricting access to social media.

Rouhani’s powers are dwarfed by those of Supreme Leader Ayatollah Ali Khamenei who is close to conservatives and hardliners.

Iran’s Shi’ite Muslim clerical rulers are wary of any revival of anti-government unrest should President Donald Trump refuse to extend U.S. sanctions relief on Iran on May 12, a deadline he set for European signatories of Iran’s 2015 nuclear deal with six world powers to “fix flaws” in the accord.

Government filtering prevents Iranians from accessing many internet sites on the official grounds that they are offensive or criminal. But many Iranians evade the filtering through the use of VPN software, which provides encrypted links directly to private networks abroad, and can allow a computer to behave as if it is based in another country.