Iranian journalist Maziar Bahari was imprisoned by the regime in 2009. Now he is being portrayed by Gael García Bernal in new feature Rosewater

Eight years ago, I asked the journalist and filmmaker Maziar Bahari to write an article for Index on Censorship magazine about his encounter with the intelligence services in Iran. It was one of the best things I ever published as editor. In a darkly funny article, he described his surreal meetings with three different agents, who questioned Bahari as he researched a piece for Newsweek on the suppression of civil society in Iran. There is a politeness and even civility in the interrogations in a hotel room, and Bahari detects a certain reluctance in their commitment to their job as the agents (who go under the pseudonym “Mr Mohammadi”) try to find out what he’s doing and whom he’s meeting.

Mr Mohammadi is responsible for the security of Iran. That includes protecting the values of its government. It's a tough job. It's like being in charge of Britney Spears's public image. The values change so often that the officials who put former colleagues on trial today are careful not to be incarcerated by the same people tomorrow (who may well have jailed them in the past). Mr Mohammadi's job is to keep the integrity of the regime intact and to stop those who plan to undermine the holy system of the Islamic Republic. But what does undermining mean? And what if it is the government that is doing the undermining (as it does constantly)? These questions seem to puzzle Mr Mohammadi. So he is more than a little paranoid and edgy these days. When he calls you for questioning, you don't know if he's going to charge you with something or seek your advice.

Two years later, Maziar was arrested while covering the elections in 2009. He was accused of being a spy and detained in Evin Prison. I remembered the article with a chill (“I don't know how Mr Mohammadi will react to my writing about these encounters,” Bahari had written. “Not too happily, I guess. He strongly advised me not to talk about them with anyone”) though well aware that in the midst of the regime’s crackdown on the protests, an article poking fun at its agents was likely to be the least of his troubles.

Daily Show star

Maziar’s ordeal is now the subject of Jon Stewart’s directorial debut, Rosewater, which previews at London’s Tricyle Theatre in a special screening for English PEN on 19 April.

Maziar had appeared on the Daily Show just before his arrest and Jon Stewart had taken a special interest in the case. Stewart’s original plan had been to make the film in Farsi and to cast Iranian actors, until Maziar asked him if he actually wanted the film to have an audience.

Iran’s green movement of 2009 embodied a youthful and moving spirit of rebellion and freedom on the streets, which was brutally surpressed. Unlike most of the other Iranians who were thrown into prison, Maziar at least had the protection of some of the most powerful news organisations in the world, as well as being a Canadian citizen.

I vividly remember evening meetings at our mutual friend Malu Halasa’s flat with campaigners, journalists and anxious friends, as well as his pregnant partner Paola, who always appeared remarkably composed at a time of such stress.

Newsweek, for whom Maziar was working in Iran, provided exceptional support – a model for any news organisation acting for journalists in trouble. Every time I called Nisid Hajari at Newsweek he would be on his way to the UN or the State Department, pulling every string and contact possible to get Maziar out, which included raising his case with President Ahmadinejad when he appeared at the UN in New York.

"Mr Hillary Clinton"

A turning point in the campaign to free Maziar came when Newsweek’s Fareed Zakaria interviewed Hillary Clinton on CNN. She condemned his treatment. Maziar recalls in his book Then They Came For Me that guards came into his cell and addressed him as "Mr Hillary Clinton". It was the first time Maziar realised that there was a campaign for his release – “I’m not alone” he shouted to himself.

His account of the beatings, torture and interrogations is underscored by the same irony and surrealism as the article he wrote for Index on Censorship: the guards who deprive him of his basic rights but offer him hair gel; his interrogator, Rosewater, who answers the phone to his wife as he’s beating Maziar (‘“Hi, sweetheart. I can’t talk right now” ) and is obsessed with New Jersey.

After his release, Maziar discovered that he had become a liability for the regime, thanks largely to Newsweek’s ceaseless raising of his case at every opportunity. They finally decided to let him go after Ahmadinejad’s visit to the UN in September.

The case should be a lesson to every human rights campaigner and every news organisation with journalists to protect: make noise, make trouble, get publicity, raise the case at the highest diplomatic and political levels, use your contacts to gain access to power, never give up.

Maziar Bahari now campaigns for press freedom in Iran as well as making films.

A screening of Rosewater will take place at the Tricycle Theatre, London, on 19 April, 3pm, and will be followed by a Q & A with Maziar Bahari, in discussion with Lindsey Hilsum, Channel 4 News International Editor. More details here.