There was a time when the words "Muslim radical" painted a clear enough picture – a young man strapped with explosives, perhaps, or a bearded cleric calling for Sharia law from Land's End to John O'Groats. But things have changed. The protestors of the Arab Spring are both Muslim and radical, as are the bungling jihadis of Chris Morris's movie Four Lions. And now a new film, The Taqwacores, attempts to further stretch the definition.

The film's set up sounds familiar enough – a meek Muslim student named Yusef joins a hardcore Islamic commune in upstate New York and becomes radicalised. But this time, "hardcore" refers to punk rock. This is a commune where one Muslim, Jahangir, sports a red mohawk and announces morning prayers with an electric guitar. Another member is gay and wears a skirt and makeup. The bands that congregate there have names such as Osama's Tunnel Diggers and Boxcutter Surprise. They drink beer and smoke pot, and among them is a spitfire feminist in a burqa – complete with a Dead Kennedys patch – who freely redacts chunks of the Qur'an with a marker pen. "That ayah advises men to beat their wives," she says, about a contested verse in the holy book. "So what do I need that for?"

It's a budget production, at the cheap end of indie, and the story is simple enough. There's a fundamentalist faction in this commune that is at odds with the punk renegades such as Jahangir, and their battle comes to a head in a raucous final concert. Even though The Taqwacores received a mixed reaction when it was released in the US last June, the Hollywood Reporter championed the film's originality, and on this front, it is out on its own. To say nothing of its extraordinary back story: a movie based on a book based on a purely fictional punk rock scene that then spawned an entire music scene from scratch.

The original novel was written by Michael Muhammad Knight, a radical himself by most standards. At 17 he left home in upstate New York to study Islam in a madrasa in Pakistan. Fleeing an abusive father, among other things, he converted to Islam as an act of rebellion. But he soon found plenty to rebel against within Islam – not least its attitudes towards women, gay people and alcohol.

"So I imagined this fantasy world where Islam didn't have an absolute definition, and you had the power to define it yourself," Knight says today, a PhD student in Islamic studies in New York. That world was an imaginary Muslim punk scene called Taqwacore where these questions could all be resolved – "taqwa" being an Arabic term for consciousness of the divine. It was an attempt to reconcile his own fraught identity.

"At the time that I wrote it in 2002, I didn't know if I could call myself a Muslim," he says. "I didn't sign on to this whole checklist of beliefs. I felt that I'd failed as a convert and I was an exile, outside the mosque and on the margins. But punk celebrates that. The punk kids inspired me to not be afraid of who I was."

At first he self-published the book – Xeroxing copies that he spiral-bound by hand. Then he gave it away for free. He contacted Jello Biafra of the Dead Kennedys, who distributed it through his record label Alternative Tentacles. And then in 2004 it found an official publisher, the anarchist imprint Autonomedia. At which point the book appeared to take on a life of its own.

Just as the novel Fight Club by Chuck Palahniuk spawned actual fight clubs, The Taqwacores spawned real-life Muslim punk bands. Bands such as The Kominas from Boston, the all-girl Secret Trial Five from Toronto, Al Thawra (The Power) from Chicago and even a few bands out in Pakistan and Indonesia. They took Knight's book as a manifesto for a new kind of Islamic youth culture that respects women and gay people and isn't afraid to challenge Islam where necessary. A tour was organised in 2007 in which the bands – along with Knight – travelled through America and Pakistan. That tour became the 2009 documentary Taqwacore: The Birth of Punk Islam.

On that tour was a recent film school graduate from Ohio named Eyad Zahra. He'd been "blown away" by the book and wanted to see if this punk scene was real. "As a Muslim, there are things you're not supposed to question publicly and this book did – like gender equality, treatment of homosexuals," he says. "It allowed me to look at Islam with a new lens. A dirty, gritty lens." Zahra secured the movie rights from Knight and a second film was under way.

On the face of it, Zahra and punk rock are an odd fit. Mild-mannered and neatly turned out, he grew up praying five times a day, and describes himself as "a bit nerdy. I do drink, but not much. I was never actually into the music growing up." It was punk's "ideology" that appealed to Zahra. "Before Taqwacore, hip-hop was the rebel culture for American Muslims, but punk takes on social issues with less prejudice. It doesn't use derogatory words for gays."

Islamic punk band the Kominas.

As a result, Zahra's movie occasionally feels more intellectual than visceral, using the characters to drive the point home. "All the crazy fuckups and rejects of the community, they're coming together man, starting bands," says Jahangir, the mohawked character. "Nobody likes them. Muslims say they're not really Muslims, the punks say they're not really punks." Later, he describes the movement as "the ones who don't fit in at the Islamic Centre – the boys who missed their prayers, the girls who date behind their parents' back . . ."

But what he's describing is a fantasy of a Muslim punk, rather than the reality. According to one of the most prominent bands grouped under that banner, the Taqwacore scene was always more complicated than that.

Noureen DeWulf as female, burqa-wearing punk Rabeya in The Taqwacores. Photograph: film company handout

"There never really was a scene," says Imran Malik, of the Kominas, a so-called Taqwacore band from New Jersey, whose music features prominently on the movie soundtrack. Malik is 27, a young Pakistani American who was inspired by Knight's book, but less so by the "scene" it engendered. "A few bands came together for that documentary, but the film crew was paying for it, so it was fabricated and forced by someone who was trying to sell a narrative, a sexy narrative. Since then, a lot of those bands have either ceased to exist, or said they're not Taqwacore after all."

According to Malik, the idea of a Muslim punk scene was so attractive that journalists couldn't resist. "Newsweek wrote about a band called Secret Trial Five at a time when they hadn't even made any music. Not a single song. This was probably one of the most documented and interviewed scenes out there, and it wasn't even authentic."

Zahra agrees. "Today there might be 60 people tops who define themselves as Taqwacore artists," he says. "But they're scattered through America, Canada, Pakistan and Indonesia. There's not this collection of Muslim kids with mohawks in any one place. And the strongest followings are in Indonesia, where the bands are kind of hardline Islam and don't like gays and all that. Which isn't really the point."

Similarly, the characters of The Taqwacores movie seem confused. Their revolution is compromised. They're rebelling against Islam in order to fortify it. They pray at the local mosque where the attitudes they're fighting are taught – as though they haven't picked sides yet. And a rebel who doesn't know what to rebel against begins to veer into the realm of comedy.

The female punk in the burqa, Rabeya is the film's most compelling character – a noisy, sexually liberated woman who refuses to ever show her face. Zahra sees her as "an exaggeration of an American Muslim. You can't see her, she doesn't say much, and then we juxtapose that with someone who's not submissive at all. For some women who wear the hijab, it's an act of protest – they're wearing their faith on their sleeve." Noureen DeWulf, the actor who plays Rabeya, describes the character's burqa as "a fuck-you statement. She's taking something that's meant to make her invisible, and using it to make herself visible."

Ultimately, The Taqwacores wants to have its cake and eat it. It's never pretty when a major world religion tries to get into bed with a rebel culture, and even more so when they're as polarised as Islam and punk. Christian rock transparently attempts to make Christianity cool – if anything it rebels against rock's orthodoxies of intoxication and foul language. But The Taqwacores wants it all – to have bona fide punk-rock energy, while being equally cosy under Islam's canopy.

So in the end, what does Taqwacore mean? Malik from the Kominas understands it as "the idea of a complicated Islam. It's western Islam's first real voice of dissent. Because we are complicated. I don't even feel Muslim most days. I know the culture, but I'm also American so I'm informed by rock'n'roll, hip-hop and everything else. I call myself a non-denominational atheist Muslim, but what does that even mean?"

Knight, who coined Taqwacore says he wrote the book at a confused and lonely point in his life and today he's loth to offer any definitions. "I don't own the word," he says. "It's just a spectrum of the Muslim rainbow that wasn't seen before."

But the energy of his creation remains formidable. So far, for all its incoherence, it has given rise to two feature-length films, a loose collection of bands and acres of newsprint. And there is inspiration in that alone.

"I also heard that the film was being watched in a room overlooking Tahrir Square ," says Zahra, with pride. As Muslim youth rise up in protest and disaffection spreads throughout the Middle East, perhaps Taqwacore will find its true voice.

The Taqwacores is out on 12 August