ISTANBUL—Turkish voters chose stability over change on Sunday in a key vote that threatened to diminish the power of scandal-plagued Prime Minister Recep Tayyip Erdogan’s government.

Turkey’s 50 million eligible voters overlooked Erdogan’s attempt to limit free speech by shutting down Twitter and YouTube. They also ignored leaked wiretaps that allege he was involved in a corruption and bribery scheme and another leak alleging his top officials were plotting to begin a war with Syria. An espionage investigation regarding that leak is now underway.

Erdogan’s conservative Islamist Justice Development Party (AKP) took a majority of the mayoral elections across Turkey over the secular Republican People’s Party (CHP), the main opposition.

“Before him, I had no car, no shop, no nothing. Now look outside. There are hotels, there are people from all over the world coming to visit and the streets are safe and clean,” Demer said as a street-cleaner passed by. “Only the TV people say he is bad.”

This election had been widely regarded as a referendum on Erdogan’s rule. If he wins a majority throughout Turkey, the three-term leader is likely to run as president of the republic. Under Turkish law, a prime minister can only serve three terms.

Erdogan has been extremely popular among working-class Turks for his economic policies, which have cut high interest rates and raised living standards. However, political turmoil within the country in the past year has recently caused the Turkish lira to dive.

In Istanbul, home to nearly one-fifth of Turkey’s 75 million people, AKP’s incumbent mayor Kadir Topbas won again.

Erdogan, who was once mayor of Istanbul, voted at a city school earlier in the day.

“The people’s words will be decisive rather than the words of those who speak at rallies. For me, the people will make the final call and we will respect the people’s decision,” Erdogan told reporters.

In Taksim Square, scene of many violent protests last summer that began over the attempted gentrification of nearby Gezi Park and then morphed into a battle of wills between Erdogan and the demonstrators, there were more riot police than citizens or tourists. In the expectation of clashes, dozens of water cannon trucks, anti-riot vehicles and buses full of armed police were deployed on the outskirts of the square.

Ahmet Akyildiz had hoped the party he supports — the left-leaning People’s Democracy Party (HDP), associated with Kurdish rights — would make a strong showing.

Akyildiz, who works in a confectionery that sells fragrant cubes of Turkish delight, came to Istanbul from southeastern Turkey to build a better life and escape the turmoil in the countryside.

“We are Kurdish and we are Turkish. We don’t hate each other. The government says Kurds want to split the country. That is not true. We get married to each other, we are friends. We want a democracy,” Akyildiz said.

Outside Istanbul, voting day did see its share of violence and controversies at the ballot box. Clashes between rival groups in the southern provinces left eight people dead.

Hurriyet Daily News reported that attackers in the capital Ankara, who apparently supported the AKP, arrived in six minivans at a school and attacked supporters of another party with iron bars and kebab knives, wounding 10.

Also in Ankara, incumbent mayor Melih Gokcek denied the rival CHP had won the city and instead claimed the AKP was in power once more. Gokcek has already served four terms in office. He held a press conference late Sunday to say he won. His rival, the CHP’s Mansur Yavas, did the same.

There were also reports of power outages in major city centres, voter fraud at the polls and manipulation of results.

The Turkish government also delayed Sunday’s daylight savings switch to Monday — a move that confused many mobile phones, which automatically adjust to the time change.