By Sarah Rainsford
BBC News, Istanbul
Turkish police were on duty outside Beyoglu court from early morning.
Elif Shafak has called for a change in the law
Riot police lined up at the main gates complete with plastic shields and gas masks.
The courtroom itself was sectioned off behind a row of tall temporary fencing.
High security, for the trial of a novelist.
Elif Shafak stood accused of "insulting Turkishness". The charge related to her latest novel The Bastard of Istanbul.
The novel centres on two families - one Turkish, one Armenian - and includes discussion of the mass killing of Armenians in the dying days of the Ottoman Empire.
Armenia insists Turkey recognise that as genocide.
The author says her novel examines issues of memory and amnesia.
She had hoped it might promote empathy between nations.
Instead she was charged under Article 301 of the penal code - which holds a possible prison sentence of three years.
"In our culture no-one can brand their ancestors murderers or accuse them of genocide," Kemal Kerincsiz insisted ahead of the trial.
He is one of the nationalist lawyers who filed the initial complaint against the novel.
"Maybe in the West they're more tolerant, but here we can't accept those comments as criticism."
In the passages singled out by the lawyers as insulting, Armenian characters refer to the Turks as butchers and as ignorant - they talk of massacre and deportation.
The nationalists called that dangerous propaganda.
Elif Shafak gave birth at the weekend, so she was not in court to defend herself.
In the event, her testimony was not required.
The trial was over in less than 40 minutes - the judge acquitted the writer in her absence, and threw the case out of court.
Scuffles broke out outside the court
"I just talked to Elif on the phone - she was so happy and relieved," her husband Eyup told journalists immediately after the hearing.
But the nationalist lawyers did not stay around to hear the verdict.
They stormed out of court, shouting that the judge was working under political pressure.
"It was obvious he was going to acquit Shafak," one of the group fumed in the car park.
"He didn't even listen to the accused or the complainant. The judge's ruling is predictable - so we have pulled out."
As the nationalists emerged, they came face to face with left-wing supporters of Elif Shafak and free speech.
"We stand shoulder to shoulder against fascism," a crowd of around 50 people shouted, amid short spontaneous busts of applause.
Riot police ran in, as a shouting match quickly descended into scuffles.
Elif Shafak is the latest in a long line of Turkish writers to go on trial here.
The Armenian issue has been at the heart of many cases.
Others have focused on insults to the military, the judiciary or to the founder of modern Turkey.
This is the first time an author has been accused of insult in a work of fiction.
"If Article 301 will be interpreted in this way nobody can write novels in Turkey anymore, no-one can make movies any more," Elif Shafak warned, shortly before her case came to court.
"Then the words of a character could be used as evidence against the author or the film director. So I think it is extremely important to defend the autonomy of art and of literature."
EU observers who were at the trial welcomed the acquittal as the right decision - but called on the government to go further now, and abolish Article 301 altogether.
Turkey faces a highly critical progress report from the EU in November, with a crisis looming over the divided island of Cyprus in particular.
So writers' trials like this one have become symbolic of Turkey's commitment to the membership process itself.
"The Turkish government has a majority in parliament. This is an issue where they could act," MEP Joost Lagendijk said after the trial in Istanbul.
"If they don't, it makes it much harder to find a compromise on Cyprus as well.
"So this has an influence much wider than only freedom of speech.
"It can influence the negotiation process positively if something happens, and negatively if nothing does."
Pressure for change
The case against Elif Shafak may well mark a turning point.
Perhaps prompted by the apparent absurdity of a trial for a work of fiction, Turkey's prime minister gave his first ever hint on Thursday that some kind of change to the law might be possible.
Pressure for change is mounting steadily here at home now, as well as in Brussels.
"Many people warned the government that Article 301 would cause problems, but they turned a blind eye.
"Now it's a major stumbling block to our EU entry," Elif Shafak explained, frustrated.
"But even more important than that - we do not deserve this law.
"This is not the law that should be applied to our own citizens and we need to do something about it.
"The question is does the government have the will or the courage to take that step?"