More than 50 million eligible voters cast their ballots in Turkey's local elections, amid corruption allegations and damaging security leaks that have shaken the 12-year rule of the Justice and Development Party (AKP) government.

The municipal elections have become a crisis referendum on the rule of Recep Tayyip Erdogan, Turkey’s prime minister, and his religiously conservative AKP.

The party, which swept to power in 2002 on a platform of eradicating the corruption that blights Turkish life, hopes on Sunday to equal or better its overall 2009 vote of 38.8 percent.

Let's give them [political opponents] an Ottoman slap. - Recep Tayyip Erdogan, Turkey's PM

Erdogan has been crisscrossing the nation of 77 million during weeks of hectic campaigning to rally his conservative core voters, during which he temporarily lost his voice.

"They are all traitors," Erdogan said of his opponents at a rally in Istanbul, Turkey's commercial capital and the most populated city, on Saturday.

"Let them do what they want. Go to the ballot box tomorrow and teach all of them a lesson... Let's give them an Ottoman slap."

Erdogan has purged thousands of people from the judiciary and police following the anti-corruption raids in December targeting businessmen close to Erdogan and sons of ministers.

The prime minister said that those behind the investigations were trying to form a "state within a state" or “parallel state”, blaming the movement of Fethullah Gulen, the US-based Turkish cleric whose followers are apparently highly influential in Turkey's police forces and judiciary. Many analysts say that the two sides used to be allies in the past in their struggle against Turkey's politically dominant military.

Lira loses value

The uncertainty has taken its toll on the stock market and on the Turkish lira, which has lost four percent of its value this year. Many foreign and domestic investors are awaiting the elections and their aftermath before making decisions.

The main opposition Republican People's Party (CHP), portrays Erdogan as a corrupt "dictator" ready to hang on to power by any means. Capture of the capital Ankara or Istanbul would allow them to claim some form of victory.

Erdogan formed the AKP in 2001, attracting nationalists and centre-right economic reformers as well as religious conservatives who form his base. Since his 2011 poll victory, he has in his statements, moved more towards these core supporters.

The corruption scandal, also involving anonymous Internet postings of tapped state communications implicating Erdogan in corrupt actions he denies and media interventions he confirms, was all but eclipsed in recent days by the leaking of a recording of a top-level security meeting.

YouTube and Twitter blocked

In the recording, the intelligence chief, foreign minister and military commanders discussed possible armed intervention in Syria. The Turkish intelligence chief, Hakan Fidan, allegedly talked about staging a fake attack on Turkish soil in order to start an operation on Syria.

Turkey has blocked YouTube and Twitter, and has reportedly intercepted various Domain Name Systems after tens of leaks had been shared on the two online platforms.

It is unclear who recorded the meeting and posted it on YouTube - though officials point a finger at Gulen’s movement.

Erdogan describes the movement as a terrorist organisation in an "alliance of evil" with major opposition parties.