The producers of Official Secrets, the film that tells the story of GCHQ whistleblower Katharine Gun, had to be dissuaded by Whitehall insiders from holding a special screening in Cheltenham, where the spy agency is based, the Observer has learned. Security agency sources say the film’s producer, Ged Doherty, asked them if they thought staff at the vast eavesdropping centre would welcome the chance to see the film starring Keira Knightley near where they work.

But the producer was advised this would not be a good idea. “Katharine Gun is not a popular figure at GCHQ; people still think her decision was a breach of national security. I think the producers were being a bit naive.”

The film tells the story of Gun’s decision in 2003 to leak a copy of a memo from the US National Security Agency asking them to listen into the communications of the smaller members of the UN Security Council, at a critical point in the run-up to the Iraq war. Gun, a translator, copied the memo and leaked it anonymously, before owning up a few days later to save her GCHQ colleagues from a witch hunt. The memo ended up in the hands of the Observer, which broke the story; Gun was arrested and charged with breach of the Official Secrets Act.

The events are dramatised in the film, in which Knightley’s portrayal of Gun has been praised by critics. The legal case against Gun was dropped by the British government in 2004, after her lawyer, Ben Emmerson QC, threatened to use disclosure to put the legal basis of the war itself on trial.

She had to abandon her civil service career and eventually left Britain altogether. For the past nine years she has been living in Turkey with her Turkish husband and their daughter.

Britain’s spy agencies have a love-hate relationship with Hollywood. While special screenings of James Bond films have been organised for MI6 staff, 007’s style and attitudes are not regarded as a model for an agency that prefers cerebral, low-profile recruits.