Basma Abdel Aziz was walking in downtown Cairo one morning when she saw a long line of people standing in front of a closed government building.
Returning hours later, Ms. Abdel Aziz, a psychiatrist who counsels torture victims, passed the same people still waiting listlessly — a young woman and an elderly man, a mother holding her baby. The building remained closed.
When she got home, she immediately started writing about the people in line and didn’t stop for 11 hours. The story became her surreal debut novel, “The Queue,” which takes place after a failed revolution in an unnamed Middle Eastern city. The narrative unfolds over 140 days, as civilians are forced to wait in an endless line to petition a shadowy authority called The Gate for basic services.
“Fiction gave me a very wide space to say what I wanted to say about totalitarian authority,” Ms. Abdel Aziz said in a recent interview.
“The Queue,” which was just published in English by Melville House, has drawn comparisons to Western classics like George Orwell’s “1984” and “The Trial” by Franz Kafka. It represents a new wave of dystopian and surrealist fiction from Middle Eastern writers who are grappling with the chaotic aftermath and stinging disappointments of the Arab Spring.
Five years after the popular uprisings in Egypt, Tunisia, Libya and elsewhere, a bleak, apocalyptic strain of post-revolutionary literature has taken root in the region. Some writers are using science fiction and fantasy tropes to describe grim current political realities. Others are writing about controversial subjects like sexuality and atheism, or exhuming painful historical episodes that were previously off limits.
In a literary culture where poetry has long been the most celebrated medium, writers are experimenting with a range of genres and styles, including comics and graphic novels, hallucinatory horror novels and allegorical works of science fiction.
“There’s a shift away from realism, which has dominated Arabic literature,” said the Kuwait-born novelist Saleem Haddad, whose new book, “Guapa,” is narrated by a young gay Arab man whose friend has been imprisoned after a political revolt. “What’s coming to the surface now is darker and a bit deeper.”
Science fiction and surrealism have long provided an escape valve for writers living under oppressive regimes. In Latin America, decades of fascism and civil war helped inspire masterpieces of magical realism from authors like Gabriel García Márquez and Isabel Allende. In Russia, the postmodern novelist Vladimir Sorokin has published disturbing and controversial futuristic novels that surreptitiously skewer the country’s repressive government.
Dystopian themes are not entirely new in Arabic fiction. But they have become much more prominent in recent years, publishers and translators say. The genre has proliferated in part because it captures the sense of despair that many writers say they feel in the face of cyclical violence and repression. At the same time, futuristic settings may give writers some measure of cover to explore charged political ideas without being labeled dissidents.
“These futuristic stories are all about lost utopia,” said Layla al-Zubaidi, co-editor of a collection of post-Arab Spring writing titled “Diaries of an Unfinished Revolution.” “People really could imagine a better future, and now it’s almost worse than it was before.”
In the turbulent months after the uprisings, when the promises of democracy and greater social freedom remained elusive, some novelists channeled their frustrations and fears into grim apocalyptic tales. In Mohammed Rabie’s gritty novel “Otared,” which will be published in English this year by the American University in Cairo, a former Egyptian police officer joins a fight against a mysterious occupying power that rules the country in 2025.
Mr. Rabie said he wrote the novel in response to the “successive defeats” that advocates of democracy faced after the 2011 demonstrations that ended President Hosni Mubarak’s 30-year rule. While there are parallels to present-day Egyptian society, setting the story in the near future allowed him to write more freely, without drawing explicit connections to Egypt’s current ruler, he said in an email interview translated by his Arabic publisher.
Nael Eltoukhy, whose darkly satirical 2013 novel, “Women of Karantina,” takes place partly in a crime-ridden Alexandria in the year 2064, said he felt that a futuristic farce was the best way to reflect the jaded mood in Egypt.
“In Egypt, especially after the revolution, everything is terrible, but everything is also funny,” he said in an interview. “Now, I think it’s worse than the time of Mubarak.”
Gloomy futuristic stories have proved popular with readers, and several of these novels have been critical and commercial hits. “Otared” was a finalist for this year’s prestigious International Prize for Arabic Fiction.
Publishers say the books have caught on with the public in part because they distill a collective feeling of frustration.
This new body of post-revolutionary literature shows a sharp tonal shift from the ecstatic outpouring that arrived immediately after the Arab Spring, when many writers published breathless memoirs or dug out old manuscripts they had stashed away for years.
Celebrated Egyptian novelists like Ahdaf Soueif and Mona Prince wrote firsthand nonfiction accounts of the 2011 protests in Tahrir Square. The Syrian novelist Samar Yazbek published diaries she kept during the Syrian uprising. A new generation of writers drew inspiration from the stunning scenes of citizens rising up together against entrenched dictatorships.
“There was something about the experience of the revolution where suddenly you had a voice, and your voice had weight and it had meaning,” said Yasmine el-Rashidi, an Egyptian journalist whose first novel, “Chronicle of a Last Summer,” about a young woman’s political awakening in Cairo during and after Mr. Mubarak’s rule, will be published in the United States next month.
In the years since the revolution, that optimism has withered, and the authorities have cracked down on creative expression across the region. In Saudi Arabia, the poet Ashraf Fayadh was sentenced to death last year for his verses, which religious authorities called blasphemous. After an international outcry, his sentence was reduced to eight years in prison and 800 lashes.
In Egypt, under the strict rule of President Abdel Fattah el-Sisi, the government has shut art galleries, raided publishing houses and confiscated copies of books it views as controversial. Last year, customs officers seized 400 copies of “Walls of Freedom,” about Egyptian political street art, and charged that the book was “instigating revolt.”
“We are concerned now with what we publish,” said Sherif-Joseph Rizk, director of Dar al-Tanweer Egypt, an Arabic publishing house. “If something is banned, it does create commercial problems.”
Despite explicit protections for free speech in Egypt’s 2014 Constitution, the authorities have targeted individual writers and artists. The novelist Ahmed Naji is serving a two-year prison sentence for violating “public modesty” with sexually explicit passages in his experimental novel “The Use of Life.” Many fear that his imprisonment will lead to more self-censorship.
“The Arab Spring and the revolution broke people’s fears and gave them the initiative to express themselves,” said Ms. Abdel Aziz, whose novel, “The Queue,” was published in Arabic in 2013. “Now we are back to oppression.”
Ms. Abdel Aziz, 39, earned a master’s degree in neuropsychiatry in 2005 and now works part time at a center in Cairo that counsels victims of torture and violence. She has published two short-story collections and several nonfiction books on sensitive subjects like torture and the human rights violations committed by Egyptian security forces.
But after Mr. Mubarak’s fall, writing a factual account felt like an inadequate way to capture the surreal experience of ordinary Egyptians who lived through the uprisings and subsequent crackdowns, she said. Instead, she aimed to write a universal story that reflected what was unfolding around her but transcended geography and current events.
She started writing “The Queue” in September 2012. The novel follows a young salesman, Yehya, who was shot during a failed uprising. Yehya is denied medical treatment and forced to wait in an endless line to petition The Gate for a permit to have surgery. As he grows weaker, the line only gets longer, stretching on for miles.
Ms. Abdel Aziz uses coded language for loaded political terms and events throughout the novel, which was translated by Elisabeth Jaquette. The 2011 uprising against Mr. Mubarak is called “the First Storm.” A later civilian revolt that ended in bloodshed is referred to as “the Disgraceful Events.”
Ms. Abdel Aziz worries about the growing scrutiny Egyptian writers and activists face. About a dozen of her friends are in prison, she said. She has been arrested three times for taking part in demonstrations and protests. But she feels that living in fear is futile.
“I’m not afraid anymore,” she said. “I will not stop writing.”