* Top court rules lengthy detentions infringed rights
* Lawyers hope the two MPs will be freed
* Release could boost fragile Kurdish peace process
By Seyhmus Cakan
DIYARBAKIR, Turkey, Jan 3 (Reuters) - Turkey's top court has ruled that the lengthy detention of two Kurdish lawmakers while on trial for supporting militants violated their rights, raising the chances they could be freed in what would be a boost to the peace process.
Gulser Yildirim and Ibrahim Ayhan won seats for the pro-Kurdish Peace and Democracy Party (BDP) in a 2011 election but have been held on remand for several years, accused of supporting the Kurdistan Workers Party (PKK) militant group.
Their release could see them take their parliamentary oaths, helping build confidence in peace talks between Ankara and the PKK, aimed at ending a conflict in Turkey's mainly Kurdish southeast which has killed 40,000 people over three decades.
The constitutional court, in response to personal applications by the MPs, said their imprisonment infringed their rights as elected officials, according to the rulings published in Turkey's Official Gazette on Friday.
Their lawyers said they subsequently applied for their release in the southeastern city of Diyarbakir at a court which had rejected previous applications for them to be set free.
It was not clear when that court would rule.
Another three BDP deputies have made similar applications to the constitutional court but it has not yet given a verdict.
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, which make up around 20 percent of the population but have long been denied basic political and cultural rights.
Prime Minister Tayyip Erdogan has staked considerable political capital in peace efforts, widening cultural and language rights for Kurds at the risk of infuriating large parts of his grassroots support base.
A PKK ceasefire has largely held since March, but the group - considered a terrorist organisation by Ankara, the European Union and United States - has halted the withdrawal of its fighters from Turkey to bases in northern Iraq in frustration at what it says is the slow pace of reform.
Erdogan, who is battling a wide-ranging corruption investigation swirling around his government, has accused those behind the probe of seeking to disrupt the peace process by undermining confidence in his administration.
The court rulings go some way to addressing criticism from the European Union and rights groups over Turkey's lengthy detentions for defendants on trial.
A parliamentarian from the main opposition Republican People's Party (CHP), Mustafa Balbay, pledged his oath in the assembly on Dec 10 after his release from nearly five years in prison on conspiracy charges.
He was among 275 defendants including an ex-military chief, retired officers, academics, journalists and politicians jailed in August over an alleged plot to overthrow Erdogan's Islamist-rooted government.
Balbay, sentenced to almost 35 years in prison, was freed pending appeal by an Istanbul court after the Constitutional Court made a ruling on his case similar to the ones on the Kurdish lawmakers. ($1 = 2.1713 lira) (Writing by Daren Butler; Editing by Nick Tattersall and Angus MacSwan)