ANKARA/ISTANBUL (REUTERS) - Turkish Prime Minister Recep Tayyip Erdogan declared victory in local polls that had become a referendum on his rule and said he would "enter the lair" of enemies who have accused him of corruption and leaked state secrets. "They will pay for this," he said.
But while Mr Erdogan's AK Party was well ahead in overall votes after Sunday's elections, the opposition Republican People's Party (CHP) appeared close to seizing the capital Ankara.
Mr Erdogan, fighting the biggest challenge of his 12-year rule, addressed supporters from a balcony at AKP headquarters at the end of a long and bitter election campaign in which he has labelled his opponents "terrorists" and an "alliance of evil".
The harsh tone of his balcony address suggested he felt he now had a mandate for strong action against his enemies. "From tomorrow, there may be some who flee," he said.
The election campaign has been dominated by a power struggle between Mr Erdogan and a moderate U.S.-based cleric, Fethullah Gulen, whom he accuses of using a network of followers in police and judiciary to fabricate graft accusations in an effort to topple him. Mr Erdogan has purged thousands of police and hundreds of judges and prosecutors since anti-graft raids in December targeting businessmen close to him and sons of ministers.
"We will enter their lair," he said. "They will pay the price, they will be brought to account. How can you threaten national security?"
The turbulence has unnerved investors, helping keep the lira currency near record lows and driving stocks down some 8.6 per cent since late last year. The strong AKP showing, signalling political continuity, could calm nerves.
"From a market perspective, the election result appears to be more or less what the doctor ordered: a solid win for the AKP which shores up the position of Turkey's ruling party," said Nicholas Spiro, head of Spiro Sovereign Strategy.
At the end of last week, the crisis reached a new level when a recording of a top-secret meeting of security officials about possible intervention in Syria was posted anonymously on YouTube. The action, for which Gulen denies any responsibility, raised serious concern about government control of its own security apparatus and fears of further damaging leaks.
Nato member Turkey, under Mr Erdogan, was long held up as a model for a Muslim democracy and indeed the prime minister carried out many reforms that eased human rights and drove the economy. But since a crackdown on anti-government protests last June he has been accused of intolerance.