Which country in the world currently imprisons more journalists than any other? The People's Republic of China? Nope. Iran? Wrong again. The rather depressing answer is the Republic of Turkey, where nearly 100 journalists are behind bars, according to the Organisation for Security and Co-operation in Europe. Yes, that's right: modern, secular, western-oriented Turkey, with its democratically elected government, has locked away more members of the press than China and Iran combined.

But this isn't just about the press – students, academics, artists and opposition MPs have all recently been targeted for daring to speak out against the government of prime minister Recep Tayyip Erdogan and his mildly Islamist Justice and Development Party, or AKP.

There is a new climate of fear in Istanbul. When I visited the city last week to host a discussion show for al-Jazeera English, I found journalists speaking in hushed tones about the clampdown on free speech. Within 24 hours of our arrival, one of my al-Jazeera colleagues was detained by police officers, who went through his bag and rifled through one of my scripts. They loudly objected to a line referring to the country's "increasingly authoritarian government". Who says that Turks don't do irony?

The stock response from members of the AKP government is to blame the imprisonment and intimidation on Turkey's supposedly "independent" judiciary. But this will not do. For a start, ministers haven't been afraid of interfering in high-profile prosecutions. In a speech at – of all places – the Council of Europe in April 2011, a defiant Erdogan, commenting on the controversial detention of the investigative journalist Ahmet Sik, compared Sik's then unpublished book to a bomb: "It is a crime to use a bomb, but it is also a crime to use materials from which a bomb is made."

Then there is the behind-the-scenes pressure that is exerted by the government on media organisations. "People are afraid of criticising Erdogan openly," says Mehmet Karli, a lecturer at Galatasaray University in Istanbul and a campaigner for Kurdish rights. "They might not be arrested, but they will lose their jobs."

In February, for example, Nuray Mert, a columnist for the Milliyet newspaper, was sacked and her TV show cancelled after she was publicly singled out for criticism by the prime minister. Last month Ali Akel, a conservative columnist for the pro-government newspaper Yeni Safak, was fired for daring to write a rare, critical article about Erdogan's handling of the Kurdish issue.

But the restrictions on freedom of speech don't stop with the media.

Exhibit A: last week, two students were sentenced to eight years and five months in prison by a court in Istanbul for "membership of a terrorist organisation", while a third student was sentenced to two years and two months behind bars for spreading terrorist propaganda. Yet the students, Berna Yilmaz, Ferhat Tüzer and Utku Aykar, had merely unfurled a banner reading "We want free education, we will get it," at a public meeting attended by Erdogan in March 2010.

Exhibit B: on 1 June Fazil Say, one of Turkey's leading classical pianists, was charged with "publicly insulting religious values that are adopted by a part of the nation" after he retweeted a few lines from a poem by the 11th-century Persian poet, Omar Khayyam, that mocked the Islamic vision of heaven. Say's trial is scheduled for October, and if convicted the pianist faces up to 18 months in prison. The irony is not lost on those Turks who remember how Erdogan himself was imprisoned in 1998, when he was mayor of Istanbul, for reading out a provocative poem.

Erdogan, re-elected as prime minister for the second time last June and now considered the most powerful Turkish leader since Kemal Ataturk, has become intolerant of criticism and seems bent on crushing domestic opposition.

"He is Putinesque," says Karli, referring to reports that Erdogan plans to emulate the Russian leader's switch from prime minister to president and thereby become the longest-serving leader in Turkish history. "Yes, he wins elections," adds Karli, "but he does not respect the rights of those who do not vote or support him."

Let's be clear: Turkey in the pre-Erdogan era was no liberal democratic nirvana. Since its creation in 1923, the republic has had to endure three military coups against elected governments: in 1960, 1971, and 1980. The AKP government is the first to succeed in neutering the military. And its paranoia is not wholly unjustified: Turkey's constitutional court was just one vote from banning the AKP in 2008, and a series of alleged anti-government plots and conspiracies were exposed in 2010 and 2011.

"I am concerned by the numbers [of imprisoned journalists] but they're not all innocent," the AKP MP Nursuna Memecan tells me. "Many of them were plotting against the government." It's a line echoed by her party leader. "It is hard for western countries to understand the problem because they do not have journalists who engage in coup attempts and who support and invite coups," declared Erdogan in a speech in January.

Perhaps. But the AKP's crackdown on dissent, on basic freedoms of speech and expression, has gone beyond all civilised norms. "We do need to expand free speech in Turkey," admits Memecan.

Those of us who have long argued that elected Islamist parties should not be denied the opportunity to govern invested great hope in Erdogan and the AKP. But what I discovered in Istanbul is that there is still a long way to go. The truth is that Turkey cannot be the model, the template, for post-revolutionary, Muslim-majority countries like Tunisia and Egypt until it first gets its own house in order. To inspire freedom abroad, the Turkish government must first guarantee freedom at home.

• Follow Comment is free on Twitter @commentisfree