* Legal framework long sought by pro-Kurdish politicians
* Reform may boost support for Erdogan ahead of vote
* Pro-Kurdish politicians visit jailed militant leader (Adds comment from jailed militant leader)
By Orhan Coskun
ANKARA, June 26 (Reuters) - Turkey's government sent a bill to parliament on Thursday setting out a legal framework for peace talks with Kurdish militants, a step that may boost support for Prime Minister Tayyip Erdogan before an August presidential election.
Pro-Kurdish politicians have long sought such a bill, partly to remove the risk of those involved in the talks being prosecuted if the political climate in Turkey turns against the peace process in the future.
Ankara began peace talks with jailed Kurdish militant leader Abdullah Ocalan in 2012 in a bid to end a 30-year-old insurgency which has killed 40,000 people.
"We are nearing the stage when these problems are solved, violence ends, people put down their weapons and come down from the mountains to return to normal social life," Deputy Prime Minister Besir Atalay said after submission of the bill.
The draft law protects anyone involved in the talks from prosecution over the insurgency by Ocalan's Kurdistan Workers' Party (PKK). It also makes it the government's responsibility to rehabilitate militants who lay down their weapons.
Ocalan himself signalled his support for the draft law after meeting members of the pro-Kurdish Peoples' Democratic Party (HDP) at his jail on the island of Imrali off the Istanbul coast.
"It's a historic development for this law to come to parliament," Ocalan said, according to CNN Turk's website.
The bill was presented less than a week before the ruling AK Party announces its candidate - widely expected to be Erdogan - for Turkey's first direct presidential election, due in August.
Kurds account for around a fifth of Turkey's population, and their support would help Erdogan's bid. However opinion polls indicate he may not even need broad Kurdish support to win the necessary majority.
Two surveys on Thursday showed him gaining 55-56 percent support in the first round, even taking into account votes for the main pro-Kurdish party candidate.
Erdogan has invested significant political capital in peace efforts, boosting cultural and language rights for Kurds at the risk of alienating some of his grassroots support.
Atalay said the bill would allow the cabinet, rather than individual state institutions, to take measures related to the talks, enabling it to speed up the process.
Parliament, where Erdogan's AK Party has a large majority, is expected to pass the law before its recess on July 25.
A ceasefire called by Ocalan in March 2013 has largely held.
The PKK took up arms against Turkey in 1984 with the aim of carving out a separate state in the southeast for the country's Kurds. They subsequently moderated their demands, seeking increased political and cultural rights which were long denied. (Additional reporting by Ayla Jean Yackley; Writing by Daren Butler; Editing by Andrew Heavens and Hugh Lawson)