By Jonny Dymond
BBC News, Istanbul
The Turkish parliament has approved changes to a new penal code - a key condition for the start of European Union membership talks.
Journalists raised concerns about some aspects of the code
The code will come into effect at the beginning of June.
The last-minute changes came after journalists said that some clauses were highly restrictive of media freedom.
Turkey is due to start entry talks with the EU in October, but is not expected to be allowed to join the bloc for at least another nine years.
Few pieces of reform legislation have been as difficult to get through parliament as the new penal code.
Late last year, Turkey's entire EU membership project appeared to be under threat when the government insisted on including a clause criminalising adultery in its reformed code.
After some heavy hints from Brussels, the clause was dropped.
A couple of months ago, just as the code was supposed to come into force, journalists protested at clauses covering what could or could not be published.
They said that some were as bad as those in the old code.
Some of those clauses have been changed, but there are still restrictions that will raise eyebrows in western Europe: criticising some state institutions is still a criminal offence, as is receiving payment or reward from a foreign power or body for publishing material deemed "contrary to fundamental national interests"
- such as suggesting that the killings of Armenians in World War I was a genocide.
But the code as a whole has been welcomed by EU officials and human rights activists as a giant step forward for the Turkish penal system.