* Diyarbarkir court orders release of MPs
* Constitutional court had said their detentions unjust
* Release could boost fragile Kurdish peace process (Adds constitutional court ruling on three other MPs)
By Seyhmus Cakan
DIYARBAKIR, Turkey, Jan 3 (Reuters) - A Turkish court ordered the release from jail on Friday of two Kurdish lawmakers being tried for links to militants in a potential boost to a fragile 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.
A judge in the main southeastern city of Diyarbakir ruled in favour of freeing them after the constitutional court said their imprisonment infringed their rights as elected officials.
The constitutional court ruled later on Friday that three other Kurdish deputies were also being held unjustly, paving the way for them too to be freed as their trials continue.
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 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, who 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 Alison Williams)