ISTANBUL, March 13 (Reuters) - Prime Minister Tayyip Erdogan condemned anti-government protesters on Thursday as "charlatans" bent on sowing chaos in the run-up to local elections after Turkey's worst civil unrest since mass protests last summer.

Two people died during protests on Wednesday, including a police officer in eastern Turkey who suffered a heart attack and a 22-year-old man shot in Istanbul in an apparent stand-off with a group of anti-government protesters.

Several thousand people gathered for Burakcan Karamanoglu's funeral in Istanbul's conservative Kasimpasa district, where Erdogan grew up and still commands fervent loyalty, his death becoming a rallying point for government supporters.

"Kasimpasa don't sleep! Stand up for your martyr! Break the hands of those who touch the police," they shouted as Karamanoglu's coffin, wrapped in the red-and-white Turkish flag, was carried through the streets to a nearby mosque.

Erdogan said Karamanoglu had been killed by the DHKP-C, a far-left group behind a suicide bombing at the U.S. embassy last year as well as attacks on Turkish police stations. Turkey and its Western allies consider the DHKP-C a terrorist group. The Istanbul governor's office said the assailant was unknown.

A website affiliated to the group claimed responsibility, saying one "civilian fascist" who supported Erdogan's AK Party had been killed in a firefight with "revolutionaries".

Karamanoglu's funeral provided a sharp contrast to the burial on Wednesday in an adjacent neighbourhood of a teenager wounded by a police gas canister last June.

His death after nine months in a coma ignited fresh anti-government demonstrations, with tens of thousands of people taking to the streets of Istanbul and other cities chanting slogans including "Tayyip! Killer!" Riot police later intervened with water cannon, tear gas and rubber pellets.

On Thursday, streets which bore the brunt of the unrest were quieter, although police in the capital Ankara fired bursts of water cannon to clear small pockets of protesters and detained at least 15 people, mostly students, a Reuters witness said.

Erdogan, who is campaigning around the country for municipal elections on March 30, dismissed the anti-government unrest as a plot to undermine him and said protesters had "burned and destroyed" offices of his ruling AK Party in Istanbul.

"You were supposed to be democrats, pro-freedom. These are charlatans, they have nothing to do with democracy, they do not believe in the ballot box," he said at an opening ceremony for an underground train line in Ankara.

"They are saying 'let's cause chaos and maybe we'll get a result'. But my brothers in Ankara and Turkey will give the necessary answer on March 30," he said.

POLARISED

Erdogan portrays the clashes, and also a corruption scandal dogging him and his inner circle, as part of an anti-government plot by foreign and domestic forces. He accuses Islamic cleric Fethullah Gulen, a former ally, of using influence in police and judiciary to engineer the graft inquiry to undermine him.

The U.S.-based cleric denies the claims. His supporters accuse Erdogan of increasingly authoritarian conduct they say is undermining liberal reforms passed during his 11 years in power.

The local elections will be the first real test of Erdogan's popularity since the summer riots, the unfolding of the graft scandal and the power struggle with Gulen. Opinion polls suggest the prime minister, whose AK Party dominates the electoral map, remains hugely popular, especially in the conservative Anatolian heartlands after a decade of rising prosperity.

But the death on Tuesday of 15-year-old Berkin Elvan, who got caught up in street battles in Istanbul between police and protesters last June while going to buy bread for his family, has touched a raw nerve with many Turks and highlighted the country's polarised political atmosphere.

While Erdogan attacked anti-democratic forces "setting fire to the streets", main opposition CHP leader Kemal Kilicdaroglu held him responsible for the death of Elvan, whom he described as a "martyr of democracy".

For older Turks, the street battle scenes may evoke memories of clashes between far-left and nationalist gangs in the late 1970s that claimed the lives of thousands and paved the way for a bloody military intervention in 1980.

In a written statement on Wednesday, Kilicdaroglu accused Erdogan of a "dangerous provocation", saying he was "dragging Turkey into great disorder and an atmosphere of chaos as his only path to salvation".

Kilicdaroglu told the Hurriyet Daily News he had seen evidence suggesting a fake assassination attempt might be staged against Erdogan to shore up his support.

The families of both Elvan and Karamanoglu have said they do not want their sons' deaths to be politicised.

"I have no business with right or left. We are all together the Turkish nation," Karamanoglu's father Halil told reporters.

"Everyone has children. I am burning inside. It's a crying shame for this nation, these children. A shame for all the youth. He died for nothing."

We welcome comments that advance the story through relevant opinion, anecdotes, links and data. If you see a comment that you believe is irrelevant or inappropriate, you can flag it to our editors by using the report abuse links. Views expressed in the comments do not represent those of the Thomson Reuters Foundation. For more information see our Acceptable Use Policy.