By his own admission, film-maker Julien Temple's relationship with Joe Strummer was a complex one. He had known him briefly in the early days of the Clash, when he filmed the band for "four or five months before they had a recording contract". But their friendship quickly soured when Temple became part of the clique around the Sex Pistols, about whom he went on to make three films: 1977's Sex Pistols Number One, 1979's Great Rock'n'Roll Swindle and 2000's retrospective documentary, The Filth and the Fury.

"I think it came off the rails because I was involved with the Pistols camp," says Temple. "You had to choose, really. There was a lot of mutual slagging off." But Temple also feels the relationship floundered because of a certain similarity in the backgrounds: Strummer, as everyone now knows, was the public-school-educated son of a diplomat, and Temple had been at Cambridge. "At that moment, you had to be kind of an immaculate punk, and Joe really had to reinvent himself. John Lydon was the real thing; he seemed to come from nowhere. But Joe was known and had more baggage, and had to reinvent himself. So having a guy like me hanging around was probably not the best thing for him." He chuckles. "You know, it takes one to know one."

Nevertheless, when Strummer relocated to Somerset in 1997, the pair renewed their friendship. "I just remember when he used to knock on my door. It was so exciting, this knock. You'd just think, 'Wow, I'm up for a good time now.' You knew it was going to be a session of some kind."

By the time of Strummer's death, three days before Christmas 2002, Temple was part of a circle of friends who found themselves "very deeply affected" by his early demise: they were, he says, "in stasis", unable to work out how to honour his memory. First, they attempted to build a stone circle in the back garden of the singer's Somerset home, "in the old druid style with big levers and stones, trying to line them up by the stars and all that kind of thing".

This, he concedes, was a nice idea in theory, but perhaps a little ambitious in practice: "It was a kind of Spinal Tap thing. It went on for about six weeks, in the mud in February; we got about three stones done and then we thought, 'We've had enough of this, bring in the diggers,' which Joe would have liked. So we got a digger and, having done three stones in six weeks, we got the rest done in an afternoon. I suppose you could say it was very Joe-like, a mixture of the old way and the new way. But that was all we managed to do, and I just felt that maybe it would be a kind of a good way of moving on if we all got together and made this film. I thought we could make this thing that Joe would be remembered by, then we could get on with the rest of our lives."

The result is The Future Is Unwritten, a two-hour documentary that traces Strummer's life at public school, the punk years, the "lost decade" after the Clash split, and his final apparently contented years fronting the Mescaleros and tentatively discussing reforming the Clash. His life has a strangely cinematic arc to it: by the time of his death, he had made peace even with those "hippy" friends he had rather coldly abandoned in order to become an immaculate punk, while one of his final gigs legendarily saw him reunited with the Clash's Mick Jones, tearing through a version of White Riot.

Despite this, a surfeit of visual material ("I've never come across a guy who was more photographed, even before fame; you can always tell he's directing the pictures as if he had a sense of destiny about himself") meant The Future Is Unwritten proved surprisingly tough to make.

But Temple's past form is in making successful documentaries about complex subjects. The last time I met Temple, he was talking hopefully of editing his film about Glastonbury down into a 12-hour cut. You got the impression that even the festival's notoriously laid-back organisers thought he'd gone a bit barmy; and yet, 18 months later, the film Glastonbury emerged, a more manageable two hours long.

"I thought if I could get through the Glastonbury film, I could get through this, but I had the same old breakdown, hacking through jungles of film, not finding the key or the inspiration or whatever," he says. Eventually, he came up with the idea of interviewing Strummer's friends and fans around a series of campfires. In his later years, Strummer had become obsessed with building campfires, most famously at Glastonbury, "almost as a creative statement - there was this idea that it was a great leveller, that it reached back to prehistoric man, that people never really meet each other that profoundly in any other context".

Temple's first attempt to recreate a Strummer campfire, however, was rather too successful in conjuring what he describes as their "bacchanalian" spirit: "The first one was in the middle of a blizzard in February in Somerset, and I don't know who it was, but someone put magic mushrooms in the tea and ..." He trails off, chuckling. "It was an interesting night, but I don't think much of it ended up in the film."

These hallucinogenically enhanced early days notwithstanding, the campfire idea worked: Temple held them in Somerset, by the Thames ("a bit of London Calling"), under the Westway flyover so mythologised on the Clash's debut album, and in New York, Los Angeles and Granada. The range of interviewees is startling: The Future Is Unwritten is presumably the first documentary in history to solicit the opinions both of Martin Scorsese and Bez from the Happy Mondays, with Clash bassist Paul Simonon the only puzzling absence.

It's packed with striking moments: some startling footage of life in the west London squats where Strummer formed his first band, the 101ers; Temple's own film of the Clash's first recording session; clips of an aimless post-Clash Strummer appearing on a US cable talk show, at a loss to explain what he's doing with his life; Mick Jones recalling his dismissal from the Clash with a peculiar combination of bitterness and maniacal laughter ("I think he'd had a few drinks by then," offers Temple); the contrast between a sweet, mumsy-looking, middle-aged Spanish woman reminiscing fondly by the campfire, and the footage of her 30 years ago, when she was Palmolive, fearsome drummer of all-girl punk band the Slits.

The Clash are the kind of band who inspired such fierce devotion that any criticism is often shouted down as heresy, a situation only compounded by Strummer's early death. But, to its immense credit, The Future Is Unwritten steers clear of hagiography and seems unafraid of challenging commonly held wisdom about the band. There is a telling moment where the film cuts between footage of the nascent Clash performing a ferocious version of Career Opportunities, and the Clash at their commercial peak, playing the same song five years on before a packed US sports stadium. The latter sounds absolutely dreadful, rather giving the lie to the official line that the band broke up at the height of their powers. Lumbering and sanitised, it's audibly the work of the one thing the Clash are never supposed to have become: bored, moneyed rock stars. "And," notes Temple darkly, "they're all prancing around onstage as well."

Conversely, the Clash mark two, formed after Mick Jones's sacking and oft-derided (not least by Strummer himself, who called their 1985 album Cut the Crap "a shitty way to end a great group") come out of the film surprisingly well. "Some of the live stuff they did is absolutely fantastic," nods Temple. "There was this one line with Joe - that it was all a complete mistake and should be written out of history like so much of his past - but there were other times when he would say he was quite proud of that last album in a weird way."

The Future Is Unwritten doesn't seem to have quenched Temple's desire to make documentaries about problematic musical subjects. As if to prove the point, his mobile phone rings. On the other end is the notoriously difficult Ray Davies of the Kinks; Temple is also planning a film about his volatile relationship with his brother Dave - "with a kind of Rashomon element to it, where you have two different versions of the same events seen through Ray's eyes and Dave's eyes". He's clearly - and rightly - pleased with the end result of his labours over Strummer, though one nagging doubt remains. "I did keep second-guessing what Joe would have made of the whole thing. I did think, 'Am I doing this guy justice?'" He frowns. "I think he would have thought that it was faintly ridiculous, if he was alive. He would have kicked the cans out of the window"