Last Friday, Orhan Pamuk, Turkey's most celebrated writer, was subjected to a grotesque public shaming. Branded a "traitor" by fascist agitators whom a like-minded police force did little to contain, and pelted with stones and eggs outside the court where he was to have been tried for insulting Turkishness, he remained calm and dignified. At a party hosted by his publishers that same evening, he looked relaxed, even cheerful. As did Hrant Dink, the Turkish-Armenian journalist and editor who was prosecuted in the same court earlier this autumn, also for "insulting Turkishness," and the columnist, scholar, and longtime human rights activist, Murat Belge, who will be going to court on February 7 with four other columnists charged with insulting the judiciary. Also in attendance were several editors facing charges on account of books they have published, the Turkish and European human rights activists, and the dozen EU parliamentarians who had, like Pamuk, been insulted and/or assaulted by fascist agitators in and outside the court earlier in the day.

This is hardly the first time a Turkish writer has been pilloried for speaking his mind. Nâzim Hikmet, the great modernist poet who who shared the 1950 International Peace Prize with Pablo Neruda, spent most of his adult life in prisons. When an entire generation of writers found itself behind bars after the 1971 and 1980 coups, it kept itself going by reciting his verse. In the 1990s, when the army was waging war against the Kurdish PKK in the southeast, the mantle passed to Yasar Kemal, Turkey's other great living author, who, like Pamuk, has often been tipped as a Nobel contender. He wrote an article about the Kurds that resulted in his being prosecuted and vilified in much the same way that Pamuk is today.

A recent dirty tricks campaign drew the two authors into a highly publicised dispute, so great significance was given to Kemal's presence at the trial last Friday. Everyone knew he was there to support not just Pamuk but all writers who dare to question the national myth - that Turkey has no black spots in its history, that the path it must follow is the one decreed by its founding father, Atatürk, and that its army never makes mistakes. Sooner or later, most serious writers find themselves branded traitors: therein lies their importance. What makes Pamuk's case different is that retribution came so very late.

Until last February, Pamuk enjoyed a de-facto immunity that the state accords only to those with a profile in the west. For this read: powerful friends who will kick up a fuss if anything happens to them. With this immunity came responsibilities that Pamuk has taken very seriously. In the 90s, when other writers were being jailed for speaking up for the Kurds, it would, he thought, have been wrong to stay silent. So he spoke and, by speaking, eased the pressure on the others. Having spoken, he was of course pressed to speak for a multitude of other causes, not all of them worthy. The literary grapevines of Istanbul abound with stories about his standoffishness, but as his friend and translator, I know just how much thought he gave the endless string of moral dilemmas spilling from his fax machine. If something seemed important - if a principle was at stake - he'd always make time for it, no matter how long it kept him from the beckoning desk.

That is my understanding of what happened last February. Turkey had at last been given a date for EU accession talks. A pro-European Islamist government was pushing through a package of reforms, and the old monolithic republic was moving towards a permissive secularism in line with Europe. A grassroots democracy movement was taking shape, and it seemed possible to speak about topics previously marked taboo.

It was in this context that Pamuk told a Swiss newspaper that "30,000 Kurds and one million Armenians were killed in these lands and nobody but me dares to talk about it" - and the important thing to remember about this sentence is that it appeared first in Europe. Because by last February, there was consternation in some cogs of the Turkish state machine about the "true costs" of entering Europe. By which I do not mean Jihadis or Islamist fundamentalists wishing to drag the country east. These are old-guard secularists - the Kemalist authoritarians who will see their power severely curbed if Turkey's bid is successful. To keep that prospect at bay, they needed a scandal that would play into the hands of anti-Turkish nationalists in Europe, exploit divisions about EU entry inside the ruling party, and drum up anger against the EU and Europeans throughout Turkish society. What better target than a writer already famous on both sides of the divide?

The shameful spectacle last Friday was consistent with this agenda. In the street outside the court, the biggest fascist banner (ignored by the European press but of central interest to the Turkish) named Pamuk and six others facing charges for speaking out on the Armenian issue, branding them "missionary children", meaning they are not pure Turks but bastard hybrids, spawns of European proselytisers.

To Turkish readers, the banner is also a reminder that many of the 301 defendants were (like so many others in the business and professional elites) educated in Istanbul's foreign lycées or abroad. The implication is that they are not to be trusted. They have European friends. And now they're helping them overrun the country. That allegation has found echoes in even the moderate press: however appalled they might have been about the "security breakdown", most columnists agree that Europeans had no business being there in court in the first place. Even if the government drops the charges against Pamuk, the people behind the prosecution will still have achieved their primary aim: to inflame the Turkish public's fears about Europe.

That's how important writers are in Turkey. That's how their words get policed, twisted and appropriated. As I sit here in my study in Bath, safe in the knowledge that my own words will never know this fate, my mind keeps going back to last August, when Orhan first told my partner and me about the pending prosecution. After we had discussed it for some time, I asked Orhan what outcome he most hoped for. He thought for a moment and said, "I want to be able to sit here, at this table, and have the conversation we've just had, knowing that no one cares about it."