The European Court of Human Rights has called on Turkey to release pro-Kurdish leader Selahattin Demirtas, ruling his detention since 2016 on terror charges was aimed at "stifling pluralism".
Mr Demirtas, one of two former co-leaders of the leftist pro-Kurdish Peoples' Democratic Party (HDP), was arrested in November 2016 over his alleged links to Kurdish militants.
At the time of his arrest the politician, who has been dubbed the "Kurdish Obama" for his charismatic speaking style, was a member of parliament.
The court, in the French city of Strasbourg, said it accepted that Mr Demirtas had been arrested on "reasonable suspicion" of committing a crime, but said the reasons given for keeping him behind bars were not "sufficient" and constituted "an unjustified interference with the free expression of the opinion of the people".
Mr Demirtas' right to a speedy trial was violated, said the court.
It found that the extension of his detention through a referendum on expanding President Recep Tayyip Erdogan's powers, and later a presidential election, were aimed at "stifling pluralism and limiting freedom of political debate, which was at the very core of the concept of a democratic society".
"The court therefore held, unanimously, that the respondent state was to take all necessary measures to put an end to the applicant's pre-trial detention," it added, ordering Turkey to pay Mr Demirtas €10,000 in damages and €15,000 towards his legal costs.
Read: Detentions mark 'end of democracy' in Turkey
Mr Demirtas, 45, is charged with a string of offences, including terrorist propaganda, for which he faces up to 142 years' imprisonment if convicted.
He denies all the charges and claims the case against him is politically motivated.
In June, he ran for president from prison, coming in third with 8.4% of the vote.
The ECHR hears cases of alleged violations of the European Convention on Human Rights of which Turkey is a signatory.
Its rulings are binding on member states and Turkey, like fellow member Russia, has in the past usually implemented its findings.
But President Erdogan has rejected the findings, saying that Turkey was not bound by the court's decisions.
"We will make our counter-attack and get this business over with," the president added, without elaborating.
Mr Demirtas' lawyer said that he had applied for the immediate release of his client after the ECHR ruling.
"We hope what is required by this ruling is done without delay. After this decision, every second Mr Demirtas remains jailed is a restriction on freedom," said Mahsuni Karamansaid.