Eight people were killed in isolated clashes in Turkey on Sunday during municipal elections that Prime Minister Tayyip Erdogan hopes will validate him in his battle against a corruption scandal and a string of damaging security leaks.

The voting may have become a crisis referendum on the rule of Erdogan and his Islamist-rooted AK Party, and he has been crisscrossing the nation of 77 million during weeks of hectic campaigning to rally his conservative core voters.

Voting went ahead peacefully in most parts of the country but fights broke out between groups supporting rival candidates in two villages near the southeastern border with Syria. Six people were killed in a shoot-out in Sanliurfa province while two more died in a village in Hatay, security officials said.

The clashes were over local council positions and were not directly linked to the wider tensions in the country.

The level of support for Erdogan will be crucial for his Islamist-rooted AK Party's political survival, as well as his possible bid to become the president in August.

"Today it is what the people say which matters rather than what was said in the city squares," Erdogan told reporters as he voted in Istanbul, his supporters chanting "Turkey is proud of you" as he left the polling station.

Erdogan has purged some 7,000 people from the judiciary and police since anti-graft raids in December targeting businessmen close to him and sons of ministers. He blames the raids on U.S.-based Islamic cleric Fethullah Gulen, an ex-ally, who he says is using supporters in the police to try to topple the government.

"They are all traitors," Erdogan said of his opponents at a rally in Istanbul on the eve of the vote. "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."

AK's main opposition, the 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.

AK, which swept to power in 2002 on a platform of eradicating the corruption that blights Turkish life, hopes to equal or better its 2009 vote of 38.8 percent and markets have steadied this week in expectation of such a result.

A vote of less than 36 percent, not considered likely, would be a huge blow for Erdogan and unleash AK power struggles. A vote of more than 45 percent, some fear, could herald a period of harsh reckoning with opponents in politics and state bodies.

As voting got under way in western Turkey at 8 a.m. (0600 GMT), an hour later than in the east, some voters subscribed to Erdogan's belief that he is the victim of a plot to unseat him.

"You have to look at why they want to unseat the government now. Turkey is a new state, it is getting stronger and the big countries don't want that," said Vahap Selbuk, 20, a student preparing for university entrance exams.

On a sunny morning at a school in the central Istanbul commercial district of Sisli, others saw the election as an opportunity to express their opposition to Erdogan's government.

"We expect a ray of hope in the elections. Even if the AK Party vote doesn't fall that much, we expect them to lose big cities at least. If not we're thinking of living abroad," said Alper Palabiyik, 30, a financial adviser.

"It will be a long night for us but a longer night for that dictator," he said. Voting ends at 5 p.m.

"Alliance of evil"

Erdogan formed AK in 2001, attracting nationalists and center-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 graft scandal, also involving anonymous Internet postings of tapped state communications implicating Erdogan in corrupt actions he denies, was all but eclipsed in recent days by the leaking of a recording of a top-level security meeting.

In the recording, the intelligence chief, foreign minister and military commanders discuss possible armed intervention in neighboring Syria's civil war. A senior government official described the leak as one of the biggest crises in modern Turkey's history, threatening further sensitive disclosures.

The leak seemed particularly to target MIT intelligence chief Hakan Fidan, possibly Erdogan's closest confidante.

Officials suggest Gulen's Hizmet network released the recording, giving an alarming sense in Ankara that government has only tentative control of state bodies and part of the security apparatus while power struggles play out.

Hizmet denies orchestrating the leak scandal and maneuvering to control the state apparatus, but those close to the network say they fear a heavy crackdown after the elections.

Erdogan, who describes Hizmet as a terrorist organization in an "alliance of evil" with major opposition parties, seems likely to act quickly to tackle the leaks and he may have given a first indication of that in his speech on Saturday.