An Iranian blog-hosting service has refused to comply with the authorities after being told to disclose private information about one of its users.

Iran's cyberpolice, known as Fata, wrote earlier this month to Bayan, a Tehran-based IT firm, asking it to reveal the log records for a blogger using its hosting service.

Bayan refused, saying it could not pass on the information because of its users' right to privacy under Iranian law and argued that the request could only be met if it was made through a judiciary court.

The firm has since made the exchange of communications public on its website, which prompted praise among web users in Iran who see it as a rare move to uphold citizens' rights. Bayan redacted the name of the blog in question.

The police's letter was sent from Fata's head, Seyed Kamal Hadianfar, who asked Bayan's director to immediately disclose the log details behind the blog, which could have potentially revealed the blogger's identity and IP address.

In a polite and detailed response, Bayan's Ali Ghadiri cited Iran's cyberspace law passed by the parliament and told Hadianfar it would be illegal for his firm to comply with the request.

For Bayan to be able to disclose the information, "someone should file a suit and a court case should be opened," Ghadiri said in his letter. "Protecting people's privacy is one of the main principles of their security on web." Fata has insisted on its request but has so far been met with closed doors.

Bayan identifies itself on its website as a private firm but it is not clear if the company is affiliated to any political institution in Iran.

Amin Sabeti, a London-based Iranian web researcher, said he believed revelations about NSA surveillance had encouraged Bayan to be wary of disclosing information about its user. "This is a positive step," he told the Guardian. "I think the NSA revelations have influenced people in Iran too and I can't rule out that they might have taken a different approach had we not seen the outrage about GCHQ and NSA surveillance."

Iran has a vibrant blogosphere, even though more than 5m websites – including Twitter and Facebook – are blocked in the country. Many people access blocked addresses using proxy websites or virtual private network services.

The country's cyber police brought embarrassment for the authorities in 2012 when a blogger it had arrested, Sattar Beheshti, died while in custody. Beheshti's mother has since come forward accusing the forces of killing her son and launching an intimidation campaign against her family. Iran's judiciary reportedly arrested a number of people in connection with Beheshti's death but court sessions did not find any officials complicit in his death. Despite this, the former head of Iran's cyberpolice was sacked from his position.

Until a year ago, Iran's ministry of information and communications technology was in charge of policing the country's online community but in 2012, the supreme leader Ayatollah Ali Khamenei, ordered officials to set up the supreme council of virtual space, a body which is closer to Khamenei than the government.

This has made it difficult for president Hassan Rouhani to implement his promises on lifting the ban on social networks after a year in office. Earlier this month, however, Rouhani intervened directly when the authorities blocked access to WhatsApp, a mobile messaging service, and ordered for its ban to be lifted. He is yet to deliver on his promises about Facebook and Twitter.

A number of people are behind bars in Iran due to web-related issues, including several employees of the Iranian gadget news website, Narenji, who have been in jail since December with little information public about their current situation.