Turkey''s ruling AK Party won 39% of the vote in local general elections, but failed to secure the sweeping victory it had hoped for in cities dominated by secularist opposition.

Turkey held local elections on Sunday against a background of a troubled economy, severely hit by the global economic crisis.

"This is a message from the people, and we will take the necessary lessons," Prime Minister Tayyip Erdogan said on national television.

The AK Party won the polls in Istanbul, Turkey''s largest city, and in the capital, Ankara, but lost in several other key cities, including Antalya, Izmir and Diyarbakir, the largest in the Kurdish southeast.

The secularist CHP opposition party won 28% of the vote, while the far-right MHP won 15%. A total of 19 parties took part in the local elections, which traditionally have major political significance in Turkey.

The elections were overshadowed by a wave of violence across the country. At least seven people were killed and about 100 injured in clashes between voters, local media reported.

The AK Party, which came to power after a crushing victory over the secularists in a 2002 election, has been accused by the opposition if harboring a hidden Islamist agenda, and criticized for its failure to respond effectively to the economic slowdown.