In the tea houses of Istanbul the mood is generally optimistic as customers listen to the news of the European economic crisis. “Turkey doesn’t need Europe,” says one tea drinker.

“Look at Greece – it was inside the European Union and they’re going bankrupt.” Osman, a middle-aged estate agent, adds that “when you compare Turkey today with Turkey 20 years ago, everything has got better.”

Not everybody in the tea house is quite so positive. Its manager says: “I think the economy is going well for those with money. But talk to somebody on the minimum wage and see how they feel.” There is some Schadenfreude over the problems facing the EU, given that it has so far rejected Turkey as a member. But one customer, looking up from his card game, says “I have just been to Germany and it is still better abroad.”

Turkey has been one of the world’s great political and economic success stories of the last decade. Over 70 million people under quasi-military rule of great brutality for 80 years appeared at last to be coming under civilian control. Torture stopped in the prisons. Elections not army coups d’état – four in Turkey since 1960 – determined who held power in Ankara. The Justice and Development Party (AKP) led by the Prime Minister, Recep Tayyip Erdogan, first elected in 2002, was just the sort of moderate, democratic pro-capitalist Islamic party that the West wanted to encourage. The foreign media boosted Turkey uncritically last year as a model for the Arab world as police states started tumbling.

There is more substance to the Turkish “miracle” than there was to most of the over-hyped booms in Europe, from Ireland to Greece. Political and economic changes here were real. The AKP outmanoeuvred the military leadership and its powerful allies in the state bureaucracy and appeared to break their long tutelage. In 2001 the economy had been a barely floating wreck as inflation touched 80 per cent a year and the Turkish lira halved in value. Banks closed and tens of thousands of enterprises went bankrupt. All these disasters became a distant memory as Turkey acquired a “tiger” economy. In a decade Turkey’s GDP and exports both doubled in value. Small and medium-sized manufacturers became energetic exporters. Foreign investment, the key to growth in Turkey, poured in and the economy became the 15th largest in the world. It is these gains that are now under threat. Political reforms stalled two years ago. One foreign observer says “Erdogan decided not to use his political capital to resolve the conflict with the Kurds, the dispute over Cyprus and relations with Armenia”. Overconfidence in Turkey’s new-found strength diverted attention from crucial questions, the most important of which is bringing an end to the Kurdish insurgency.

Some Turkish liberals suspect that, after being in power for almost a decade, the AKP has found it convenient to adopt the mechanisms of repression used by its predecessors. “The AKP had been on the periphery of political life and is now at the centre,” says Cengiz Aktar, professor of political science at Bahcesehir University in Istanbul. “They decided to stop the reformist process and enjoy life.”

The clamp down has been severe. This month Reporters Without Borders (RSF) demoted Turkey to 148th place out of 178 countries in its annual World Press Freedom Index. Its report said: “The judicial system launched a wave of arrests on journalists without precedent since the military dictatorship.” Some 99 journalists are in jail, about 60 per cent of whom are Kurdish. “It is a sort of political cleansing by the judiciary and the police,” says Erol Onderoglu, the RSF representative for Turkey.

Often journalists are held for more than a year without knowing the charges against them, and an editor can be jailed for any article appearing in his paper critical of government policy. In one case a Kurdish editor was sentenced to 166 years in prison, later reduced to 20 years by the High Court, for such a piece. Osman Kovala of Anadolu Kultur, a human rights organisation in Istanbul, says there is “still no clear distinction between expression of an opinion and membership of a terrorist organisation”.

Liberals fear that the so-called “deep state”, a secret cabal of soldiers, police and bureaucrats dealing in assassination and disappearances, is still in business, stalking its enemies and protecting its hitmen. Government critics suspect the AKP is no longer interested in rooting out these sinister agents.

In 2007 the murder of the Armenian-Turkish journalist Hrant Dink was widely believed to be their work and became a cause célèbre. Shot in the back by a 17-year-old student, his murder had all the marks of a well-organised plot. But, in January, a court in Istanbul appalled a broad swathe of Turkish opinion by finding the gunman had largely acted alone. Convinced of state connivance in Dink’s death thousands of marchers commemorated it by shouting the slogan, “The killer state will pay”.

The AKP government could argue that its most important struggle has been to end the military’s grip on the state. “I was amazed last year to see the ex-Chief of General Staff in prison,” says Murat Belge, professor of comparative literature at Bilgi University. “This is a miracle for Turkey.” Suggesting that civilian control is not as deeply rooted as many Turks assume, he believes the reason why the army has not overthrown the AKP government has been that the US does not want it to.

Mr Erdogan, a pious, populist nationalist of great political skill, is sounding and acting more and more like an autocrat. His belligerent personality may make him averse to seeking a compromise with the Kurds, but his intransigence is attractive to Turks who like the idea of a powerful state. “The Turks are childish about being powerful,” Mr Belge says. “Power is a magic word for them.”

A further cause of the faltering impetus of reform in Turkey is its failure to enter the EU. Expectations of EU membership in 2004-9 played a central role in promoting liberal democracy. Realisation that accession is unlikely to happen soon is having a reverse effect. Atilla Yesilada, an economic consultant at Istanbul Analytics, says “the fact that Europe no longer has the energy to absorb Turkey is a blow to hopes of creating a liberal democratic society”.

Rejection by Europe has been compensated for, at least psychologically, by Turkey’s expanded role in the Middle East but this intervention is beginning to sour. A couple of years ago, Turkey had developed good relations with most of its neighbours, particularly governments in Tehran, Baghdad and Damascus. Turkish trade to the Middle East expanded fast. Come the Arab Spring, Turkey adeptly changed horses, abandoned old allies and backed protesters and insurgents in Libya and Syria.

A foreign observer said: “The European leaders might behave to Mr Erdogan as if he was something the cat dragged in, but in Egypt he was treated like a demi-god.” But the advantages of this popularity can be exaggerated. Egyptians may like Mr Erdogan, but they are not asking him to rule them. At the start of this year Turkey is having to pay a price for an overconfidence that has provoked hostility on the part of the Syrian and Iraqi governments.

Will the Turkish boom turn out to be a bubble? Previous recessions have all seen outflows of foreign capital. The European banks investing here are themselves fragile. But Turks still make things like ships and cars. The outskirts of Istanbul are filled with workshops producing furniture, textiles and shoes alongside more technical products.

Mehmet Tuysuz employs 33 people making valves for medical equipment. He speaks well of the government, saying that it “helps small and medium-sized plants like us. They got rid of the mafia in the municipality, fire and tax departments.” He says in the 1990s he was frustrated by officials extracting bribes as the price for removing bureaucratic obstacles.

The next year should tell if Turkey is going to join the sick men of Europe. The year may also tell if Turkey has at last escaped the legacy of an autocratic state.