At the Istanbul book fair last November, there was a signing for the politician Selahattin Demirtaş’s short story collection Seher (Dawn). Demirtaş, former leader of the pro-Kurdish People’s Democratic Party (HDP), has been in pre-trial detention since November 2016, and 20 authors stepped in for him as an act of solidarity. It lasted more than six hours as hundreds queued to get their copies signed.

Demirtaş wrote the stories in prison and the book is his first work of fiction, selling more than 200,000 copies. It is being published in 11 territories, including the UK next spring. Some of the stories are political satire – one is addressed to the prison letter-reading committee that vets what he writes – but most are portraits of working-class life on the margins. There is also a chilling story about an “honour killing”, the title story of the collection.

Facebook Twitter Pinterest The pro-Kurdish opposition leader used a 10-minute telephone call to his wife to broadcast an election speech. Photograph: HDP/AP

Demirtaş is a charismatic figure, renowned for his wit and considered one of the most talented politicians of his generation. Under his leadership, the HDP became one of the most progressive parties in Turkey, entering parliament for the first time three years ago. He was arrested along with fellow HDP politicians after parliament voted to lift MPs’ immunity. The terrorism charges against him are considered to be politically motivated. In a surreal development, Demirtaş is running for president from his prison cell, defying a virtual media ban on the HDP through tweets (via his lawyer and family), and delivering his campaign speech via a phone call to his wife shared on social media. His debut as a writer last year is likely to have enhanced his popularity.

The HDP’s success is critical: if it wins 10% in the elections on 24 June, it could end President Recep Tayyip Erdoğan’s majority in parliament.

There’s a saying here: if you want to be a writer, you need to go to prison. It’s a joke, but still a fact for our generation Burhan Sönmez

“There’s a saying in Turkey: if you want to be a writer, you need to go to prison,” says PEN International board member Burhan Sönmez. “Everybody repeats it. It’s a good joke, but still a fact for our generation.” His award-winning novel Istanbul, Istanbul is set in a prison cell, based on his own experience when he was imprisoned as a student. The celebrated poet Nâzım Hikmet was repeatedly jailed during his career – Sartre and Picasso were among the artists who campaigned for his release in the 1940s. Others include Orhan Kemal (who wrote a prison memoir about sharing a cell with Hikmet) and Sevgi Soysal, who remains an influence on Turkish feminists. The RSC has just produced a dramatisation of Can Dündar’s book We Are Arrested, written in prison after his arrest in 2015. Güray Öz, a journalist on the newspaper Cumhuriyet, which Dündar edited before his exile, has published a book of essays since his release from prison last July. In an interview he described Silivri prison as the “father” of his book.

Facebook Twitter Pinterest Can Dündar, right, arrives at court for his trial in Istanbul in 2016. Photograph: Sedat Suna/EPA

Since the failed coup two years ago, there have been more journalists imprisoned in Turkey than anywhere else in the world. The columnist Ahmet Turan Alkan has written a novel, Sağ Yanım (My Right Side). He has been in pre-trial detention for almost two years, facing charges that include attempting to overthrow the constitutional order. He wrote for Zaman, a publication allied with the Gülen movement that the government holds responsible for the failed coup, and which has since been closed down. It is solely Alkan’s journalism that is being used as evidence against him for such a serious charge. He says that he has never liked prison literature. “I would like to invite my potential readers to try and be aware of the beautiful things in life through my writing, not mentally place them inside a prison.” A religious conservative, Alkan said in court this month that he has become a dissident. He describes his novel as a confrontation with “rightwing delusions and myths”: “I tried to face up to everything that I had been through,” he says from his cell. “More importantly – and sadly – everything that I once believed in, and fought for, for many years. My novel became the product of some sort of catharsis.”

My​ cellmates usually watch TV. Of course every writer wants to write in a quiet place but this is not a luxury I have Ahmet Altan

In April, Turkey’s biggest bookshop chain, D&R, was sold to Turkuvaz Media Group, which is close to the government. A publisher reported last month that some of its authors are no longer being stocked. “The government is not just closing down publications and imprisoning writers, but also setting up a financial siege,” says Sönmez. Publishers, he believes, will continue to defy the climate of intimidation. He points out that some were activists following the 1980 coup and had to face violence. Risk is not an issue. “They care about keeping that line,” he says, “and publishing books that are openly critical.”

Despite the government’s control of the media, Demirtaş’s book has not been banned (it is sex rather than politics that tends to lead to direct literary censorship in Turkey). And established authors in prison are continuing to write and publish, too. The bestselling writer Ahmet Altan is serving a life sentence, along with his brother, the economist Mehmet Altan, that has been widely condemned as politically motivated and based on bogus charges. He has written a book of essays covering literature, religion and prison life, and is appealing against his sentence. He describes writing at a white plastic table with a ballpoint pen, sometimes for nine hours a day. “My cellmates usually watch TV. Of course every writer wants to write in a peaceful and quiet place. This is not a luxury I have. But once I dive into my writing, I forget where I am.” His collection is due to be published in Germany, Spain and Norway this autumn, with English editions also planned. It is the first time his work will appear in translation before being published in Turkish: “I want the whole world to hear my voice,” he says. “Of course I want my own country to hear my voice, too, but it looks like this won’t be possible for a while.”