The criticism was sharp and bold. “In this land corruption, rape or being a big thief, animal or child abuser, not having any dignity, is not a crime,” Roya Mirelmi, an actress, wrote under a picture she posted of Ms. Hojabri that got 14,133 likes. “But in my motherland, having a beautiful smile, being happy and feeling good is not only a crime but a cardinal sin.”

President Hassan Rouhani, elected in 2013 on the promise of expanding personal freedoms, has promoted social media, tried to defend Telegram and increased the speed of the internet to allow Iranians to stream video on cellphones. But now, hard-liners have set their sights on Instagram.

In April, the commander of the national police, Kamal Hadianfar, announced that “Instagram celebrities” would soon be arrested and that 51,000 Instagram pages were under police surveillance for vulgar and obscene videos.

“Instagram started out as an innocent tool, available on the internet, where people would upload photos and write some words,” said Hamidreza Taraghi, a hard-line analyst. “But the Westerners behind it gradually turned Instagram into a mischievous tool for dangerous subversive actions against the state or pornographic purposes,” he said. “Naturally we must block it.”

That Instagram should come into the cross hairs of the hard-liners is no surprise. For decades the ruling clerics, bowing to reality, have said that people are free to do as they like, but only in the privacy of their own homes.

So a balance has been maintained. In the public realm in Iran, conservative Islamic rules apply and are enforced, so women have to wear veils and are normally barred from singing or dancing. (There are exceptions, such as the dancing in the streets that followed an Iranian World Cup victory.) In the private sphere they are free to ignore the strictures.

But Instagram has brought down the walls between private and public life in Iran. All one has to do is search “#Iran” to peek right into the Iran the clerics do not want you to see: dancers, clips of the deposed shah, girls in bikinis.