* Five deputies were jailed over links to Kurdish militants
* Turkish parliamentarians have immunity from prosecution
ANKARA, Jan 7 (Reuters) - Turkey's parliament swore in five pro-Kurdish lawmakers on Tuesday after they were freed from prison during their trial on charges linking them to armed militants, lifting hopes for a shaky peace process.
Two courts ruled last week that the lengthy imprisonment of Peace and Democracy Party lawmakers Selma Irmak, Faysal Sariyildiz, Gulser Yildirim and Ibrahim Ayhan and independent MP Kemal Aktas had violated their rights as elected officials.
Parliamentarians enjoy immunity from prosecution in Turkey.
"I hope our release can contribute to the peace process, but it's really just a first step," Irmak told Reuters. "There are dozens of mayors and other elected officials still in jail, so for real progress the anti-terror law must change."
Rights groups have accused the government of overly broad use of anti-terrorism legislation to lock up its political opponents.
Irmak and the others were elected in a 2011 election after running for office from prison but were barred from taking their seats. They were first detained in 2009 and 2010 in a wide-ranging criminal investigation that has jailed thousands of Kurdish politicians and activists for alleged ties to the outlawed Kurdistan Workers Party (PKK).
The government launched talks with the PKK's jailed leader Abdullah Ocalan in late 2012. The militants subsequently declared a ceasefire and began withdrawing from Turkey to camps in northern Iraq where they are based.
But the PKK said it had halted its withdrawal in September due to frustration with the government's pace in introducing democratic reforms meant to address Kurdish grievances.
The PKK took up arms against the Turkish state in 1984 in a bid to carve out an ethnic homeland in the mainly Kurdish southeast. More than 40,000 people, mostly Kurds, died in the violence that has persisted even as the PKK scaled back its demands for greater cultural and political rights for Turkey's estimated 15 million Kurds.
A total of eight people were elected to Turkey's parliament in 2011 while in prison.
Two from the main opposition Republican People's Party were released after being convicted last year for conspiring to topple Prime Minister Tayyip Erdogan's government and are now seated in the 550-member assembly.
The eighth MP-elect is a member of the Nationalist Action Party who was convicted in 2012 in a separate coup-plot trial and remains in prison. (Reporting by Ayla Jean Yackley; Editing by Gareth Jones)