It was, intimates the author G Willow Wilson, a moment of indisputable serendipity. After enjoying glowing praise for The Butterfly Mosque, her intriguing memoir exploring her conversion to Islam and romance with an Egyptian, the young American turned her gaze towards the youth movement in the Middle East.
"Living in Cairo, I had been full of admiration for the way religion, politics - the whole future of the region, really - was being shaped by technology," she remembers. "At the time, I thought there was a novel set in the world of these bloggers and 'hacktivists', because I could see that their energy could be harnessed for something really extraordinary."
And then, just as she finished writing this new novel, which she called Alif the Unseen, those very same people were gathered in Tahrir Square, imploring Mubarak to leave office. Tunisia and Libya, meanwhile, were also embarking on dramatic new journeys. "These kids could see a brave new world," she says. "And that's what I've tried to capture in the book."
Yet for all its contemporary relevance, Alif the Unseen isn't a hastily cobbled together Arab Spring novel. Part fantasy, part thriller, part Arabian myth and part romance, Alif is a young, disgruntled hacktivist in an unnamed Emirate who falls in love with the wrong girl and goes on the run from state security, ending up in an "Empty Quarter" inhabited by genies.
Somehow, Wilson manages to keep the various fantastical, technological, political and religious plates spinning without ever losing track of the story, or getting bogged down in polemic. The odd lapses into Young Adult territory are balanced by enjoyable references to decades of contemporary culture: there is one memorable moment when the cornered Alif turns to Vikram The Vampire (a nod to one of the five types of djinn) when all seems lost. Vikram sneaks them past their pursuers with a persuasive "these are not the banu adam you're looking for" - a direct homage to Star Wars.
"Well spotted," she laughs. "I've spent my entire writing career speaking to separate audiences - broadly, comic book fans, Muslims and literary types. And I just thought with Alif I could write the book I wanted to write, and gather together all the things I'm passionate about; western pop culture, the religion of Islam and Islamic mysticism and politics in the Middle East.
"So that's why I wasn't at all worried about dropping djinn and ancient texts into what, initially, seems like a relatively straight story set in the contemporary world because, as a writer, I've also always been interested in the fantastical, too. We live in this ultra-rational age where anything wonderful, magical or transcendent is somehow suspect, and I think we've lost something important because of that. I want to bring that wonder and awe back a little bit."
In that sense, though Alif the Unseen was recently compared to Harry Potter in the New York Times, it has more in common with Philip Pullman's His Dark Materials trilogy: Alif's world is recognisable and yet subtly different from our own. The crucial difference is that Wilson has been careful not to be as dismissive of organised religion as Pullman.
"I wanted to draw as precisely as I could on real mythologies and real beliefs of the Middle East," says Wilson. "But I did have to be mindful of not betraying the trust of the Muslim community I live in, and I was keen that western readers should understand more about Islamic belief and mythology in a way which was separate from the hugely politicised discussion about terrorism and oil and so on.
"I guess I didn't want to make believers nervous, put it that way. Some people have come up to me at readings and said the book has made them want to make Dua or recite Ayat Al-Kursi and, you know what, that's not a bad idea. That's why, at various points in the book there's the Hand of Fatima, the Hamsa motif."
And it's such dedication to talking about faith within an exciting, page-turning novel, which makes Alif the Unseen so interesting. Wilson, in the end, picks her battles with great care. It's as if, as an American convert to Islam, she has been able to tap into the best from both worlds. "It was difficult," she admits. "But I was writing from the gut."
In Alif the Unseen, the Emirate in which the action take place remains unnamed. G Willow Wilson explains why
"There's a simple reason I didn't just say 'this is set in Abu Dhabi', and it isn't political at all. It's just that I wanted the place to consist of many different aspects of the Middle East which don't all exist in one single Emirate. It needed to have the bustling, modern feeling of a place like Dubai, with the native aristocracy coexisting with migrant workers. But I wanted it to have oil, too. And it was really important that it felt like a place which had been through many iterations over time, so even though Jeddah has some of those things, I drew on Cairo when giving my Emirate a history to explore.
In the end, where exactly it is isn't as important as bringing a level of emotional and linguistic authenticity. I was really keen to create a fantasy that was unique to the world I was writing about, rather than just drop a westernised story into a Middle Eastern Emirate. Hopefully, that will mean people from the Middle East will really enjoy a book set in their world, and western readers will look at the dilemmas of so many young people in the Middle East and think that their struggles are not so different from their own."
Alif the Unseen (Atlantic) is out now in the US and will be released to the rest of the world on September 1. Visit www.aliftheunseen.com for more information.