5.  The applicant was born in 1983 and lives in Stara Zagora. 6.  On 18 August 2002 the police conducted a search of the applicant’s home in Stara Zagora and discovered a certain quantity of cannabis. The applicant was arrested and placed in pre-trial detention on 30 August 2002. Criminal proceedings were brought against him. 7.  By judgment of 22 May 2003 the Stara Zagora Regional Court found the applicant guilty of the unlawful possession of 14.44 grams of cannabis and sentenced him to three-and-a-half years’ imprisonment. The court decided to deduct the time spent in pre-trial detention from the sentence. 8.  The applicant appealed. 9.  By judgment of 13 October 2003 the Plovdiv Court of Appeal set aside the aforementioned judgment and reduced the sentence to one year’s imprisonment. 10.  The applicant appealed on points of law. 11.  By decision of 6 April 2004, at the request of counsel for the applicant, the Supreme Court of Cassation replaced the pre-trial detention with a straightforward judicial supervision measure (подписка) and ordered the applicant’s release. 12.  The applicant was released on 7 April 2004, having spent one year, seven months and eight days in pre-trial detention. 13.  By judgment of 25 May 2004 the Supreme Court of Cassation upheld the judgment of the Court of Appeal. 14.  On 23 September 2004 the applicant filed with the Sofia City Court an action for damages based on section 2(6) of the Law on State Responsibility for Damages against the Stara Zagora Regional Court, the Plovdiv Court of Appeal, the Supreme Court of Cassation and the public prosecutor’s office. In his statement of claim he submitted that the period of time which he had spent in pre-trial detention during the criminal proceedings against him had exceeded the length of the sentence imposed on him by the courts. He claimed 11,500 Bulgarian Lev (BGL) in respect of the pecuniary and non-pecuniary damage which he had sustained. An initial hearing was held on 30 November 2004 before the Sofia City Court. 15.  At the hearing on 11 October 2005 the representative of the Plovdiv Court of Appeal, Judge N.D., presented a copy of the judgment delivered on 3 October 2005 by the Stara Zagora Regional Court (see paragraph 27 below), and invited the Sofia City Court to adjourn the civil case until the end of the second set of criminal proceedings against the applicant. He emphasised that the applicant’s action for damages should be dismissed on account of that fresh conviction. Pursuant to Article 182 paragraph 1 (g) of the 1952 Code of Civil Procedure (CPC), the court allowed that request on the grounds that the outcome of the second set of criminal proceedings might prove decisive for the outcome of the compensation proceedings. 16.  Following an appeal lodged by the applicant, the civil compensation proceedings resumed in January 2006. 17.  By judgment of 24 October 2006 the Sofia City Court dismissed the applicant’s claims. The applicant appealed to the Sofia Court of Appeal. 18.  On 10 July 2007 that court dismissed the applicant’s appeal. It noted that at the end of the second set of criminal proceedings against him (see paragraphs 20-32 below) the applicant had been sentenced to three years’ imprisonment and that that sentence had been combined with the prison sentence passed on him at the end of the first set of criminal proceedings. It further noted that the criminal courts had also deduced from the combined sentence the period of one year seven months which the applicant had spent in pre-trial detention during the first set of criminal proceedings, and found that therefore the length of the applicant’s detention had not exceeded the sentence imposed on him. 19.  An appeal on points of law lay against that judgment, but the applicant did not avail himself of that option. 20.  On 14 October 2004 the Stara Zagora regional prosecutor’s office drew up a formal indictment against the applicant and committed him for trial before the Stara Zagora Regional Court for narcotics trafficking during the period from 21 March 2000 to 14 March 2002. 21.  At the hearing on 18 October 2004 counsel for the applicant requested the transfer of the case to another regional court. She alleged that the judges of the Stara Zagora Regional Court were not impartial, on the grounds that their court was a respondent in the framework of the action for damages brought by the applicant (see paragraph 14 above). 22.  That request was dismissed by the trial court as ill-founded, on the following grounds: “as regards the formal indictment presented, there is information to the effect that that indictment was received in the Sofia City Court on 29 September 2004, and there is no information to suggest that civil proceedings have been formally commenced by the court of first instance”. The trial court further held that there had been no evidence of bias on the part of any of the two professional judges and the three lay judges sitting in the trial court, who had not been involved in the first set of criminal proceedings against the applicant. 23.  Nevertheless, the President of the trial court, who was also acting as Judge Rapporteur, decided to withdraw from the case on the grounds that he had sat on the trial bench which had previously convicted the applicant (see paragraphs 6-13 above). The hearing was adjourned to enable the defence to acquaint itself with the case file and the indictment. 24.  In his written observations of 21 October and 8 November 2004 in reply to the indictment, the applicant repeated his argument concerning the alleged bias on the part of all the regional court judges and requested their collective withdrawal and the assignment of the case to another court. He submitted that it had been in judges’ interest to give him a prison sentence in order to prevent a finding against their court in the framework of the compensation proceedings before the Sofia City Court. 25.  At the 10 January 2005 hearing counsel for the applicant called once again for the withdrawal of all the regional court judges and the assignment of the case to another court of the same level of jurisdiction. That request was dismissed on the following grounds: none of the lawful reasons for the withdrawal of judges set out in Article 25 of the Code of Criminal Procedure had been established in the present case; there was no evidence of bias on the part of the trial court judges, the case had been examined by a different court whose impartiality was unchallenged and the regional court had no means of influencing the outcome of the respective proceedings; and in any event, an appeal lay against the regional court’s future decision in that criminal case. 26.  The regional court examined the criminal case of drug-trafficking between 10 January and 3 October 2005. It gathered material evidence and heard a number of experts and prosecution and defence witnesses. The court refused to summon two defence witnesses and to put specific questions to the prosecution witnesses as being irrelevant to the establishment of the facts. 27.  By judgment of 3 October 2005, the regional court found the applicant guilty of the unlawful purchase, possession and sale of a certain quantity of cannabis between March 2000 and March 2002, and sentenced him to sixteen year’ imprisonment. The court decided to combine that sentence with that imposed at the end of the first set of criminal proceedings and to deduct the period spent in pre-trial detention between 2002 and 2004. 28.  On 17 October 2005 the applicant appealed to the Plovdiv Court of Appeal against the regional court’s judgment. On several subsequent occasions his lawyer filed additional observations complaining of various procedural shortcomings on the part of the regional court and the investigating authorities and contesting that court’s factual and legal findings. In her observations of 18 January 2006 counsel for the applicant complained of bias on the part of the judges of the court of first instance, inter alia on account of that court’s refusal to transmit the case file to another court for assessment. 29.  The Plovdiv Court of Appeal examined the criminal case in a public hearing held on 23 January 2005. Counsel for the applicant did not request the withdrawal of the appeal court judges. That court heard a witness and accepted new written evidence presented by the defence. In her pleadings counsel complained, in particular, of the insufficiency of the evidence to convict the applicant, called for her client’s acquittal and, in the alternative, sought the referral of the case to the lower-level court on grounds of procedural shortcomings. 30.  By judgment of 25 January 2006 the court of appeal set aside the regional court’s judgment. It excluded some evidence as being in breach of defence rights, and two statements given during the preliminary investigation which the court of first instance had taken into account. It considered, however, that the other evidence gathered had confirmed that the applicant had been involved in cannabis trafficking, and found no other breach of the applicant’s procedural rights. The court sentenced him to ten years’ imprisonment and upheld the part of the regional court’s decision relating to the combination of sentences and the deduction of the time spent in pre-trial detention. 31.  The applicant lodged an appeal on points of law. His lawyer submitted, inter alia, that the appellate court had not addressed the allegation of bias on the part of the court of first instance. 32.  By judgment of 16 November 2006 the Supreme Court of Cassation set aside the 25 January 2006 judgment of the Plovdiv Court of Appeal, reduced the applicant’s sentence to three years’ imprisonment, combined the latter with the sentence imposed during the first set of criminal proceedings and deducted the period spent in pre-trial detention during the first set of criminal proceedings. Accordingly, the applicant only had in fact to serve a seventeen-month prison sentence.