* Two dead after day of anti-government protests
* Erdogan says protests are "nothing to do with democracy"
* Opposition leader accuses PM of "dangerous provocation" (Recasts with Erdogan, opposition leader, governor's statement)
By Daren Butler
ISTANBUL, March 13 (Reuters) - Prime Minister Tayyip Erdogan accused protesters on Thursday of trying to sow chaos to influence local elections after Turkey's worst day of civil unrest since anti-government demonstrations swept the nation last summer.
Late on Wednesday, a man in Istanbul was shot dead and a police officer in eastern Turkey suffered a fatal heart attack. Erdogan said demonstrators 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," Erdogan said at an opening ceremony for an underground train line in the capital 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 (in the local polls)," he added.
Erdogan portrays the clashes, and a corruption scandal dogging his government, as part of an anti-government plot embracing 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.
Gulen denies such intrigues. The cleric's supporters accuse Erdogan of increasingly authoritarian conduct compromising liberal reforms of the first years of his 11 years in office.
Riot police clashed with demonstrators in several Turkish cities on Wednesday as mourners buried a teenager, wounded in the protests last June, whose death this week after nine months in a coma sparked a fresh wave of disturbances.
On Wednesday night, police fired water cannon, tear gas and rubber pellets on a major Istanbul avenue to stop tens of thousands of protesters reaching the central Taksim square. There were similar scenes in the centre of Ankara and in the Aegean coastal city of Izmir.
Officers in riot gear chased groups of protesters into side streets late into the night in Istanbul.
DEATHS AND INJURIES
An unidentified assailant shot dead a 22-year-old in Istanbul's Beyoglu district late on Wednesday after a verbal dispute between two groups turned into a fight, the provincial governor's office said in a statement.
It said one man suffered a gunshot wound to the hand and another a wound to the stomach during the gunfire. They were not in a critical condition.
In the eastern province of Tunceli, which also saw protests on Wednesday, a police officer died after suffering a heart attack, which the local governor's office said occurred when protesters threw stones at his vehicle.
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 fiercely popular, especially in the conservative Anatolian heartlands after a decade of rising prosperity.
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 hit a raw nerve with many Turks.
Views of Wednesday's events highlighted the polarised political atmosphere in Turkey. 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".
"I urge all our citizens, please don't respond to the provocation. We will seek our rights through the democratic path," he told reporters after visiting Elvan's family.
In a written statement on Wednesday, Kilicdaroglu had accused Erdogan of a "dangerous provocation", saying the prime minister saw "dragging Turkey into great disorder and an atmosphere of chaos as his only path to salvation".
Speaking to Hurriyet Daily News about those comments, he said he had heard rumours that a fake assassination attempt could be staged against Erdogan to shore up his support.
At Wednesday's funeral, crowds chanting "Tayyip! Killer!" held up photos of Elvan earlier in the day as his coffin, draped in red and covered in flowers, was carried through the streets of Istanbul's working class Okmeydani district for burial.
Those attending the protests said Erdogan's silence on Elvan's death, in contrast to President Abdullah Gul and other public figures who issued messages of condolence, highlighted how out of touch he was with a large segment of Turkish society.
(Reporting by Tulay Karadeniz in Ankara, Ferit Demir in Tunceli, Humeyra Pamuk; Writing by Daren Butler Nick Tattersall; Editing by Gareth Jones and Ralph Boulton)