Recep Tayyip Erdoğan may use this result to justify clampdowns on press freedom and protests in 'defence of national security'

The results of Turkey's nationwide municipal elections amount to a remarkable personal victory for its long-serving prime minister, Recep Tayyip Erdoğan. But the outcome will be seen by his opponents as a significant defeat for Turkish democracy and a worrying omen of a future of increasing authoritarianism.

Erdoğan, in power for more than a decade, was not on the ballot in Sunday's polls, but he dominated the campaign. Local issues were pushed aside as attention focused on multiple corruption allegations swirling around him and his ruling Justice and Development party (AKP) – and on his angry, intolerant, dictatorial leadership style.

The prime minister ensured the spotlight remained on him as he tirelessly toured the country, railing against "the enemy within", as he termed his critics, and claiming repeatedly that Turkey was under attack from spies and traitors. Particular venom was reserved for his erstwhile ally, the exiled Islamic cleric Fethullah Gulen and his Hizmet (service) movement.

"Those who attacked Turkey got disappointed. There won't be a state within a state… You have supported your prime minister. I thank you infinitely," Erdoğan told a victory rally in Ankara.

Conspirators against the country would now be punished, he warned. "We will enter their caves and… they will pay the price. How can you threaten our national security on Syria? Syria is currently in a state of war against us."

This was a reference to the leaking, and airing on YouTube, of a recording of a high-level government meeting on the Syrian crisis. In Erdoğan's view this was the latest, possibly most serious affront to his rule delivered via social media, and justified his controversial attempts to ban Twitter and YouTube. His censorship efforts may now intensify.

Kemal Kilicdaroglu, leader of the main opposition Republican People's party (CHP), warned Erdoğan against seeking revenge against his critics. "He has clearly started to threaten democracy, the law and social groups... You are going to start a witch-hunt? What happened to the rule of law?" he asked in a speech conceding defeat.

Erdoğan has been under increasing pressure since last summer's Gezi Park protests in Istanbul ignited a storm of street demonstrations across the country that broadened into a disorganised but energetic campaign to bring him down. This unrest was largely of his own making; the result of ill-judged decisions to use the police and security forces to repress the protests by force.

The hostility to Erdoğan, especially among young, urban Turks and the secular middle class, has many elements: his perceived illiberalism, his attempts to intimidate journalists and newspaper editors, the mass jailing of opponents in the military and elsewhere accused of subversion, his neo-Islamism and efforts to roll back Ataturk's secular state, and alleged corruption in government ranks.

But Erdoğan's main claim to fame – the record economic growth enjoyed by Turkey since the AKP took power – has begun to fade. For the first time, it was suggested, his remarkable grip on the working class and rural vote was beginning to slip.

The municipal poll results provide scant evidence to support this theory. The AKP's share of the vote was up six points on 2009, at around 45%, while the main opposition trailed with around 29%. On the other hand, the AKP total was 5% down on the last general election, when it polled 50% of all votes. Some voters, at least, may have turned against their prime minister.

What happens next will worry many Turks as they hear Erdoğan vowing to get even with his critics and opponents. That Turkey is now a deeply divided nation is only too clear. That Erdoğan's future actions may serve to deepen those divisions is the great fear.

One early consequence is expected to be a decision by Erdoğan to either seek the presidency, in elections due in August, or more likely, to change AKP rules so he can continue in the more powerful post of prime minister for a fourth consecutive term. Sunday's poll results will fuel his ambitions.

"The municipal elections have turned into a battle over the future of the country," wrote the columnist Yavuz Baydar in the newspaper Today's Zaman, before polling day. "The elections are deepening the torment over what identity Turkey should have – a democracy or arbitrary-autocratic rule, where the economy will be the criteria overriding all other necessities.

"The political watershed 30 March 30 will bring is a historic one. The social dimension is much more complicated than ever before. Voters are confronting, or feel blessed with, depending on how they perceive reality, the presence of a leader who has managed to define the agenda, no matter how tough the challenges have been and however ugly the truth.

"More importantly, will Turkey give the nod to an unaccountable, non-transparent, everything-under-one-man mode of governance?"

Hurriyet columnist Murat Yetkin suggested that was exactly what voters had done. "Half of those corruption claims in any other democratic country would be enough for the collapse of the government," he wrote. "In Turkey it cost only some 5 points of loss in support... Erdoğan's political recipe based simply on antagonism won again."