(Adds protest, Dink last article, minister comment, EU)
By Paul de Bendern and Thomas Grove
ISTANBUL, Jan 19 (Reuters) - A high-profile Turkish-Armenian editor, who had been convicted of insulting Turkey’s identity, was shot dead in Istanbul on Friday in an attack bound to raise political tensions in an election year.
Hrant Dink, a frequent target of nationalist anger for his comments on the mass killings of Armenians by Ottoman Turks during World War One, was shot in the head as he left his weekly newspaper Agos around 1300 GMT in the centre of the city.
"A bullet has been fired at democracy and freedom of expression. I condemn the traitorous hands behind this disgraceful murder," Prime Minister Tayyip Erdogan said.
"This was an attack on our peace and stability."
Turkey’s main stock market index fell sharply on the news.
And the attack is likely to up the political temperature in would-be EU member Turkey, where parties have been courting the nationalist vote ahead of presidential elections in May and parliamentary polls due by November.
"Hrant was a perfect target for those who want to obstruct Turkey’s democratisation and its path towards the European Union," Agos writer Aydin Engin told Reuters.
In Dink’s last article in Agos he lamented he had not received police protection despite numerous threats.
"Are these threats genuine or not? To be honest it is impossible to know. For me ... what is really unbearable is the psychological torture I am experiencing," he said in an article published on the day he died.
Several thousand people marched in Istanbul to protest at the killing, waving peace banners and portraits of Dink, a Turkish citizen of Armenian descent.
It comes less than a year after one of Turkey’s most senior judges was shot dead by an Islamist lawyer, a killing which also raised tensions between secularists and Islamists.
Turkish political and military leaders condemned the attack, several blaming it on foreign elements. They did not elaborate.
Two people were detained but later released without charge, Turkish TV said.
"This was a well-calculated provocation. It is significant that it happened when the so-called Armenian genocide is being discussed in some countries," Justice Minister Cemil Cicek said.
Turkey denies allegations that 1.5 million Armenians were killed in a systematic genocide during World War One. It says both Christian Armenians and Muslim Turks were killed in a partisan conflict that raged on Ottoman territory.
The French National Assembly’s decision last year to criminalise the denial of an Armenian genocide has again raised raised pressure on Turkey to address its past.
Turkey, which is predominantly Muslim, shares a border with Armenia but has no formal diplomatic relations with the country.
Armenian Patriarch Mesrob Mutafyan declared 15 days of mourning for the small Armenian community in Turkey.
Last year Turkey’s appeals court upheld a six-month suspended jail sentence against Dink for an article exploring the issue of Armenian and Turkish identity. The ruling was criticised by the EU.
Germany, which holds the rotating EU presidency, said it was "shocked" by murder, but had "no doubt that Turkey will continue its road towards achieving freedom of opinion".
Dozens of writers, including Nobel Prize literature laureate Orhan Pamuk, have been charged by nationalist-minded prosecutors under article 301 of the revised penal code.
The ruling AK Party government has repeatedly promised to revise the much criticised article. Improving freedom of speech in Turkey is a priority in Ankara’s efforts to join the 27-member European Union.
Despite threats against his life, Dink, one of the most prominent Armenian voices in Turkey, refused to stay silent.
"I will not leave this country. If I go I would feel I was leaving alone the people struggling for democracy ... It would be a betrayal of them," he told Reuters last July.
Tensions have been growing ahead of presidential elections.
Turkey’s powerful secularist establishment fears the AK Party, which controls parliament and has roots in political Islam, will elect Erdogan as president.
Secularists fear Erdogan would try to erode Turkey’s strict division between state and religion if elected president.
Erdogan denies he or his party have an Islamist agenda. (Additional reporting by Ercan Ersoy, Daren Butler and Emma Ross-Thomas in Istanbul)