Had things worked out differently, Alex Gibney and Julian Assange could have been soulmates – instead, they've ended up more as enemies. Gibney is one of the most prolific documentary-makers of today, and his films often take the perspective of the victim or antihero. As such, Assange was hard to resist. "Here's this tremendously romantic figure travelling the world with a laptop in his knapsack, exposing abuses of power," says Gibney. "That sounds like a pretty good story to me."
He's not the only one: the saga of WikiLeaks, the group's part in exposing US atrocities in Afghanistan and Iraq, and the subsequent sexual charges levelled at Assange, is one of the biggest of our era. It's a real-life, 21st-century spy thriller full of twists – and the race to tell it is on. Gibney's former colleague Charles Ferguson (director of the Oscar-winning Inside Job) was at one time working on an HBO/BBC documentary. Another film-maker, Laura Poitras, has the co-operation of WikiLeaks for her movie, as does Ken Loach. The Hurt Locker writer Mark Boal is reportedly working on a WikiLeaks script. Steven Spielberg's DreamWorks has just wrapped The Fifth Estate, with Benedict Cumberbatch as Assange. And those are just the frontrunners.
But Gibney's documentary We Steal Secrets: the Story of WikiLeaks is first out of the gate – though the central subject is conspicuous by his absence. That's part of the reason their relationship soured, explains Gibney. The director was in talks with Assange for almost a year. Initially, they got on. Jemima Khan (one of We Steal Secrets' producers) introduced them – Gibney even attended Assange's 40th birthday party in Norfolk, along with Vivienne Westwood and Bianca Jagger, not to mention his rivals Ferguson and Poitras. "Charles got in trouble because he kept sneaking out his camera," Gibney says with a laugh. "Laura always had access to Julian. And now she's got Snowden" – as in Edward, whose own whistleblowing saga is the next must-have subject. Poitras filmed Snowden's Hong Kong interview for the Guardian in June.
But negotiations broke down when Assange told Gibney the going rate for an interview was $1m. Gibney said he never paid his subjects. He goes on: "[Assange] then came up with an outrageous idea: 'How about you spy on the other interview subjects and report back to me, because I want to know what they're saying.' I said, 'No. I can't do that for you. I don't work for you.' [Assange] said in a huff, 'I don't work for you, either.'"
Even without that interview, We Steal Secrets feels like the inside story. It's a typically polished Gibney product, shaped for maximum dramatic impact, with swooping CGI representations of cyberspace that wouldn't look out of place in a Matrix sequel. And Gibney gets prime material, including intimate footage of Assange from another documentary-maker, Mark Davis, and testimony from one of Assange's Swedish accusers, from former WikiLeaks spokesman Daniel Domscheit-Berg, and from hacker Adrian Lamo – who weeps at the recollection of shopping Bradley Manning to the CIA.
Gibney's version of events has drawn the ire of the "Assangistas", as he calls them. From their point of view, most of the film's interviewees are its enemies. Neutrality seems impossible in this world. WikiLeaks published an annotated transcript of the film, disputing key points (inevitably, someone leaked it to them). They deny Assange asked for $1m. They condemn Gibney's "sensationalist" editing and narration. They describe the film's title as "irresponsible libel" (it's actually the NSA director Michael Hayden who says "we steal secrets", the "we" being the US government). Gibney disputes their points, dismissing many as trivial. "I'm satisfied we didn't get anything wrong."
And one benefit of Assange's non-cooperation was that it pushed Gibney to focus on Manning, the soldier on trial for leaking the war documents to WikiLeaks. It's here the film is strongest. Manning's online chats with Lamo are rendered full-screen, and the troubled human behind the text shines through. He discusses his sexuality and gender-identity issues, his political conscience and alienation. "im in the desert, with a bunch of hyper-masculine trigger happy ignorant rednecks as neighbors," he types, "and the only safe place i seem to have is this satellite internet connection." Manning is the real hero and protagonist of the piece.
Gibney has come under fire for focusing on Manning's personality, and even for turning him into, in the words of one blogger, "the crudest gay caricature". Isn't he deploying the same smear tactics as the US government? "That's not what the film is doing," says Gibney. He argues that Manning's character is at the heart of what went wrong with WikiLeaks' supposedly anonymous system. "If there's this perfect leaking mechanism, and Manning therefore could get away scot-free, why did he then reach out to Lamo? Manning actually outed himself. Because he desperately needed to talk to somebody. Lamo was also openly bisexual, and Manning remarks on that. He wanted to discuss these issues and found the perfect person – then Lamo lied to him and turned him in. It's an important part of the story."

As for Assange, Gibney suggests arrogance undid what his genius had wrought. "I think he liked living life as if he was in some spy thriller, but the more famous he got, the more he came to inhabit this idea of being a spy, as opposed to a transparency radical. So now he's 'getting intel' on people and lying to throw people off. You don't speak truth to power, you speak lies to power." Assange's paranoia was not unfounded, admits Gibney. At least one WikiLeaks volunteer was discovered to be an FBI informant. "But there was an element of him that was always in that paranoid zone. I think ultimately he flipped over."
It's safe to assume Gibney has been struck off Assange's party invite list. But he is used to making enemies, and has a reputation for holding the powerful to account. Subjects he's weighed in on in the past decade include the Enron scandal, Iraq and Afghanistan (Taxi to the Dark Side, for which he won an Oscar), political lobbying and Freakonomics. Most struggle for years to make one film, but Gibney churns out several a year. No wonder rivals compare him to an old master, who simply puts finishing touches to his studio's work as it rolls off the production line. "It's not that bad," he says. "I do all the interviewing. I do all the shoots. I write the narration, I'm just not in the editing room every day. It's not like we crank them out in a hurry. It's just that there are a few going on at once." Already this year, he has given us an explosive expose of the Catholic church's complicity in sexual abuse – Mea Maxima Culpa: Silence in the House of God – which followed the trail all the way to Pope Benedict, and may even have played a part in his resignation. Gibney compares WikiLeaks' response to that of the Catholic League, who denounced Mea Maxima Culpa as "a fraud" and even issued threats against him. He didn't take them too seriously though. "Usually when you get threatened that's not the problem," he says. "What you fear is that something unexpected will happen ... but at the end of the day, you drive yourself crazy if you think about that shit too much."
That's where he and Assange differ, perhaps. But in the wider struggle for transparency and democratic accountability, they are fundamentally in agreement. Gibney unequivocally condemns the Obama administration's persecution of whistleblowers like Manning and Snowden: "They're trying to send a message, and that message is, 'Watch out, because we're coming after you hard.' That's not what I would call the rule of law."
The WikiLeaks story is by no means over; it will likely be decades before a definitive account can be told. Gibney has at least told his before WikiLeaks fatigue sets in – though it could have a short shelf life as a result. Never mind; the production line rolls on. His next film is about disgraced cyclist Lance Armstrong, which will be ready for festivals by autumn. He has been following him since well before last year's doping scandal, including every stage of the 2009 Tour de France. It should be quite a story.
• This article was amended on Wednesday 10 July 2013. The original article said director Charles Ferguson is working on a WikiLeaks documentary. We have since found out that the project has been put on hold. The article has been amended accordingly. It was further amended on 11 July 2013 to clarify that Daniel Domscheit-Berg is a former WikiLeaks spokesman and not one of "Assange's Swedish accusers".