Omar Robert Hamilton was a wannabe film-maker in Washington when the Egyptian revolution kicked off in January 2011. His immediate reaction was to book himself on to the first available plane. “Like a lot of people, I thought this was the moment that was going to define the coming years, so I decided to drop everything and get involved.”

Four days later he was on the streets of Cairo, part of an 18-day uprising that would leave almost 900 people dead and more than 6,000 injured. But the resignation of president Hosni Mubarak on 11 February did not put an end to the protests – or the carnage.

Hamilton’s powerful debut novel, The City Always Wins, opens nine months after that, in a city morgue, where activist Mariam is trying to help relatives of murdered protesters: “She stopped counting the dead an hour ago. These corridors are so compressed with bodies and rage and grief that something, surely, is going to explode. Everywhere are the cries of a new loss, a shouted question, a panicked face, a weeping phone call. They are dead, they are dead, they are all dead. The hospital’s morgue is full. It was not built for this.”

The attention to detail in these harrowing scenes suggests that they are written from first-hand experience. Six years after getting on that plane, 32-year-old Hamilton is wary of sounding vainglorious, admitting: “Some people spent much more time in the morgues than I did, but, yes, I was there.”

Soon after his arrival in Cairo, he realised that the best contribution he could make was his film-making skills. “I was very good friends with a lot of people there and between us this media organisation was put together,” he says. The collective, Mosireen, was the idea of his friend Khalid Abdalla, an actor from United 93, Green Zone and the adaptation of Khaled Hosseini’s The Kite Runner. The initial mission was to document the revolution, creating an archive of reportage and testimony so that events could not be denied and victims could not “disappear”.

“Then, in August 2013, the military coup happened, which began this long crackdown. I took all the hard drives of all the footage that I and my colleagues had accumulated to New York and was going to turn them into a two-hour documentary version.” But what he thought would be a film script came out as prose and, after only a couple of weeks “writing in the dark”, Hamilton realised he had a novel on his hands.

Anti-government protesters demonstrate in Tahrir Square, the centre of Egypt’s anti-government demonstrations, in 2011. Photograph: Tara Todras-Whitehill/AP

True to its documentary origins, The City Always Wins is a novel of many voices, allowing the parents of the dead their own monologues of grief. The central consciousnesses are those of Mariam and fixer-turned-multimedia-producer Khalil, who meditates on the responsibilities of the storyteller in times of crisis as he selects the soundtrack for the latest podcast. “Today,” he says, “I am a brutalist and will build in logical, unquestionable blocks: news, interview, music, finish. Today I am a modernist and will slice between segments to reveal hidden truths through catalytic combinations. Today I am Gothic and the spectacle of music will tower over the logic of the interview and empiricism of news. Today I will find your music.”

Hamilton, like his character, is the “returnee” child of a cosmopolitan family, but although he is clear that “I’m very in the book”, the correspondences are not direct or simple: “In a way, I’m split between Khalil and Mariam.”

Khalil’s father is a Palestinian who has turned his back on his country of origin, emigrating to the US and changing his name from Nidal to Ned. “Tell me what Palestine did for you to abandon her in the framed map at the end of the hallway?” Khalil demands. “What sewed up the Arabic in your tongue?” Hamilton’s mother, the Egyptian writer and cultural activist Ahdaf Soueif, is very different. “She was down there [in the protests] as much as me,” he says.

In March, they're shocked by a man with whip marks ... in October they’re watching people being run over by tanks

One of two sons of Soueif and the poet Ian Hamilton, he was brought up in the UK, going from London’s King’s College school to Wadham College, Oxford, where he read English. “I bounced about a bit after college,” he says, but by 2008 he had made a short film, which introduced him to a group of film-makers who were coalescing around a new centre in downtown Cairo. In the same year, he became involved in helping his mother to set up the Palestinian festival of literature (Palfest).

He counts his first visit to Palestine – accompanying Soueif on a research trip while he was still at school – as “one of his foundational political experiences” and has since gone on to play a lead role in Palfest. Despite its focus on the streets of Cairo, The City Always Wins makes it clear that the fate of every Arab country is closely tied to that other embattled land.

Part of the strength of the novel is the way it pushes beyond the familiar tropes of war writing – whether on film or in fiction – questioning the politics of looking as as well as of recording, and acknowledging that there are moments when the camera simply has to be turned off. “The camera does all sorts of strange things to you,” Hamilton says. “It can make you feel invincible and intrusive, and it distances you from things you might want to be involved with in a different way.”

“You also develop a very difficult relationship with violence,” he continues. “In March, someone would be shocked by a man with whip marks on his back. In October, they’re watching people being run over by tanks and, by November, dead bodies are being left in piles of trash. You keep having to ratchet it up to keep people clicking.”

The novel vividly dramatises this conundrum in what becomes, in part, a meditation of the impossibility of winning a revolution. Khalil has a dog-eared copy of Age of Revolution, a classic pessimist history of the French Revolution by the Marxist historian Eric Hobsbawm. “I know the passage I need to avoid,” Khalil says. “The one I thought could never happen to us … There are no Islamists in Hobsbawm’s universe. We’re not liberals versus conservatives here. We have the [Muslim] Brotherhood and the army: two extreme rights. And us.”

Later on, Khalil is less confident: “Maybe Hobsbawm is right. We’ve been doing the same thing for hundreds of years. Marching, fighting, chanting, dying, changing, winning, losing, marching …” The language of the novel undercuts this defeatism, with its admiration for a generation of bright young revolutionary “martyrs”. In Arabic, he points out, the words martyr and witness come from the same root: “It’s the witness who wouldn’t stand down.”

So does Hamilton himself share Hobsbawm’s pessimism? “I still think it’s wrong to think of the revolution as a phenomenon that began and ended,” he says. “It’s part of a long historical process in which this is an event. Everyone says there’s been no successful revolution, but in a longer history they are interruptions that change the course of things, and we won’t know what the result is for a very long time.”

In the short-term, there is a continuing mission to keep fighting for comrades such as his cousin, Alaa Abd El-Fattah: blogger, software developer and activist to whom the book is dedicated and who is 30 months into his latest, five-year prison sentence for organising a protest without permission. “He’s a very complete political animal, which is what makes him dangerous to the authorities,” says Hamilton. “He represents the best of the new generation of people in Egypt, so for them he is a symbol and to have him in prison is a statement of their symbolic power.”

Although he wrote much of the novel in New York, Cairo is Hamilton’s “centre of gravity”, which he now shares with his wife, Yasmin El-Rifae. A fellow activist, she is working on a book about the group Operation Anti-Sexual Harassment, whose work provides a shocking strand in the novel about sexual violence against women during the revolution. As for Hamilton, his next project is a screenplay, but his ambition is to alternate between films and books. “The novel is such a flexible form,” he says. “You can throw anything its way and it can take it.”