"They play cricket like war," says the British ambassador to Afghanistan. But when they come up against international teams, "they're going to be stuffed!" he guffaws, a little too smugly for comfort. Like most observers of Afghanistan's cricket team a couple of years ago, he didn't give the side much hope of making a lasting impact on the great game.

Their journey from nobody-nomads to playing in the top tier of world cricket has consumed reams of paper in the past 18 months, with misty-eyed observers - myself among them for this website - leaning heavily on clichés in an attempt to contextualise their success. Happily, someone else has done this far more creatively in an engrossing new film, Out of the Ashes, which premieres at the Edinburgh Film festival this week.

Tim Albone, Leslie Knott and Lucy Martens, the young film-makers, embarked on this remarkable project several years ago, when Albone, a former journalist for the Times, was based in Kabul.

"The foreign editor asked me to do a piece on cricket in the country. I was struck by the characters, the passion and the lack of facilities. It was cricket but not like anything I had seen before," he told Cricinfo. "They played on bumpy, dusty, uneven pitches. They used bricks for wickets, old, cracked bats and tennis balls. I was struck by the passion and the commitment and the natural talent. I kept in touch with the team, following them on the internet after I'd left Afghanistan, and when I heard they were trying to make it to the World Cup in early 2008, I thought it would make a wonderful film. I'd always wanted to do a documentary and to spend a long time following one story and that's what I got to do with this one."

So impressed was Sam Mendes that he lent his considerable backing as executive producer, and the film is due to air on the BBC in the near future.

Afghanistan's success on the pitch is the crux of the film's narrative: their struggle, then success, in Jersey before leapfrogging everyone to reach this year's World Twenty20 in the West Indies. But the real fascination comes with the characters we meet.

It pays to remember that most of the team had never left their native country, let alone found themselves in the impossibly white and middle-class surrounds of Jersey and its Royal potatoes.

"I'd never heard of Jersey. I thought it was New Jersey in USA," says Hasti Gul, a lisp reinforcing his naturally gentle demeanour. "Are there Muslims and halal food in Jersey?" asks another. "No, they call it pork, I think. It's pork, isn't it? God help us if we have to eat that meat." The sight of a pizza is exciting, then terrifying. "Are you sure this doesn't have any donkey meat?"

At Dubai airport there are scenes reminiscent of Sacha Baron Cohen's Borat, when one of the squad steps nervously onto an escalator for the first time before self-consciously regaining his composure in front of the camera. The irrepressible Taj Malik, who began as coach before he was emotionally dumped, then introduces himself (and nation) to weary travellers, including an American, who seemed both excited and confused at once, and a little scared.

In Jersey the senior players can't keep their eyes off the titillating hemlines of the fairer sex. These snatched glimpses of excitable Afghans undoubtedly raise a smile, but the message is clear and poignant: this group of men haven't seen much, at all, outside Afghanistan. The sea was a mystery, as was swimming in it. Bingo-winged ladies in their 80s, dancing? That was new and a sight to behold, if only briefly. A lush-green outfield, as soft as feather pillows, was as alien as the Pimms being sipped beyond the boundary.

And so the message that comes across is that cricket is the passport to seeing the world. As individuals, each has fought his own personal battle, and as judged by the rousing speeches before each match - "Let's show the world Afghanistan is a great nation" - their main aim is to spread the good name of their country. Not that they don't take the sport seriously - far from it. Their determination to win has upset opponents the world over. The film records a moment when one player is cruelly run out by his ball-watching partner. "Why did you send me to play with a fucking bisexual?" he screams at the coach.

Perhaps the most striking aspect of the film is the closeness with which Albone was embedded with the team. He, Knott and Martens travelled everywhere with them, sharing the bus, meals, good times and bad. Imagine a documentary-maker trying to follow England, India or Australia.

"Despite the crowds, I never felt threatened. Everyone was just so overjoyed at the team's achievements and so happy we were capturing it all," Albone says on the team's triumphant return to Kabul. "Soldiers fired guns in the air in celebration, people hung out of windows of cars and screamed around the city's streets and the players were treated like heroes. The next day I left Jalalabad for Kabul. I was travelling in a car with only a driver. On the trip we came across some police who stopped us; in the road were blood stains and spent bullet cartridges - only minutes before, we were told, the police had been in a gun battle with the Taliban, some had been killed. It was a lucky escape."

That moment, he is keen to point out, was a rarity, however, and he remains more convinced than ever of cricket's unique ability to transcend boundaries and borders. "It's made me love cricket even more. There are very few sports in the world, if any, where the same thing could happen. Cricket has given Afghanistan the chance and they've grabbed it with both hands. Could you imagine a football team being created and making it to the world cup in 10 years? In 2001, the year they formed the cricket board, Afghanistan were 90th in the world, the worst at the time. By 2010 they'd made it to the World Twenty20. Amazing."

Out of the Ashes
Bungalow Town and Shabash Productions

Out of the Ashes will premiere at the Edinburgh International Film Festival from June 17 and will screen on BBC4's Storyville strand later this year