* Legal framework long sought by pro-Kurdish politicians
* Reform may boost support for Erdogan ahead of vote
* Pro-Kurdish politicians visit jailed militant leader
By Orhan Coskun
ANKARA, June 26 (Reuters) - Turkey's government sent a bill to parliament on Thursday giving its peace process with Kurdish militants a legal framework, a step that may boost support for Prime Minister Tayyip Erdogan before an August presidential election.
The bill was long sought by pro-Kurdish politicians, partly to remove the risk of those involved in the talks being prosecuted if the political climate in Turkey turned against the 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.
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 authorise 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.
Deputies from the pro-Kurdish Peoples' Democratic Party (HDP) went to visit Ocalan in his jail on the island of Imrali near Istanbul on Thursday and were expected to discuss the bill with him.
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. (Writing by Daren Butler; Editing by Andrew Heavens)