Erdogan (right) had predicted an increase in support
Turkish Prime Minister Recep Tayyip Erdogan's party has won local elections by a wide majority - but nevertheless suffered a significant fall in support.
The Justice and Development Party (AKP) won about 39% of the vote, according to unconfirmed results - down from the 47% general election landslide of 2007.
"This is a message from the people and we will take the necessary lessons," said a sombre Mr Erdogan.
At least five people were reportedly killed in election-related violence.
The deaths came in the predominantly Kurdish east of the country, as supporters of rival candidates for a non-party position of village chief fought armed battles.
In Sunday's elections, the governing AKP lost ground to both opposition and Kurdish rivals, who had focused on growing economic difficulties and corruption allegations.
Secularist parties made inroads into AKP support in both Istanbul, Turkey's largest city, and the capital, Ankara.
Meanwhile, the AKP was well beaten in Diyarbakir, the largest city in the country's Kurdish-dominated south-east, by the pro-Kurdish Democratic Society Party, and in Izmir by the Republican People's Party (CHP).
Across the country, the CHP took 23% of the vote, while the Nationalist Action Party was in third place with 17%.
While this was a local election it felt like a national one, says the BBC's Sarah Rainsford in Istanbul, and almost every street was festooned with party flags and posters.
Party leaders - especially Mr Erdogan - had been touring the country for several weeks, staging mass political rallies.
Warning to Erdogan
The prime minister had boasted that his party would surpass the 47% share of the vote it gained in 2007, but instead suffered its first fall in support since sweeping to power in 2002, our correspondent says.
Afterwards, Mr Erdogan insisted that the AKP had "consolidated its position at the centre of politics and shown once again that it is a party that embraces all sections of society".
But the result will be widely seen as a warning to the prime minister over what has been perceived as his increasingly autocratic style, our correspondent adds.
The government had hoped that a strong result would allow it to re-focus attention on democratic reforms.
It is also expected to conclude talks with the International Monetary Fund (IMF) for a multi-billion dollar loan to help Turkey weather the economic crisis.