4.  The applicant was born in 1965 and lives in Bielsko-Biała. 5.  On 31 August 1998 the applicant was arrested on suspicion of attempted murder, causing bodily harm and possession of a firearm and ammunition without a licence. 6.  On 2 September 1998 the applicant was questioned and confronted with the victim. During the confrontation the applicant was hit on the head by the victim. He alleges that the police officers did not react to this incident. However, it appears from the record of the confrontation that an ambulance was called and the applicant was taken to hospital where he was treated. 7.  Later on the applicant was also confronted with the victim's partner, who had been in the apartment where the attempted murder had taken place. Both the victim and his partner recognised the applicant as one of the assailants. 8.  On 3 September 1998 the Cieszyn District Court remanded the applicant in custody, relying on the reasonable suspicion that he had committed the offences in question. It also considered that keeping the applicant in detention was necessary to ensure the proper conduct of the proceedings, given the risk that he might tamper with evidence or try to influence witnesses to give false testimonies. The court also stressed the severity of the anticipated sentence. 9.  On 5 September 1998 the applicant requested that the detention order be lifted and less severe preventive measures be applied. 10.  On 18 September 1998 the Bielsko-Biała Regional Court dismissed the applicant's request, stating that detention was the only preventive measure that could ensure the proper conduct of the proceedings. 11.  On 21 October 1998 the Bielsko-Biała Regional Court referred the applicant for psychiatric observation. 12.  In the course of the investigation, the applicant's detention was extended on 15 June and 18 November 1999. In all their detention decisions the authorities relied on the original grounds given for the applicant's detention, and underlined that the grounds for his pre-trial detention were still valid. 13.  On 26 January 1999 the applicant was questioned by the prosecutor. 14.  On 8 February 1999 the Cieszyn district prosecutor lodged a bill of indictment with the Bielsko-Biała Regional Court. The applicant was charged with attempted murder, causing bodily harm and possession of a firearm and ammunition without a licence. 15.  On 26 May 1999 the trial court held the first hearing, during which the applicant and the co-accused were heard. It subsequently held eight hearings in the case. 16.  During the court proceedings the authorities further extended the applicant's detention. The court repeated the grounds previously given for the applicant's continued detention. 17.  On 28 February 2000 the Regional Court held the last hearing and gave judgment (the applicant was present). The applicant was convicted as charged and sentenced to fifteen years' imprisonment and ten years' deprivation of his civil rights. 18.  On 15 July 2000 the applicant's counsel lodged an appeal with the Katowice Court of Appeal, while the applicant himself appealed on 20 July 2000. They maintained in particular that the Bielsko-Biała Regional Court had gone beyond the proper margin of discretion in the assessment of evidence and had reached wrong conclusions as to the facts. They requested that the first-instance judgment be rectified or quashed. 19.  On 11 October 2000 the Katowice Court of Appeal decided not to allow the applicant to participate in the hearing because the Bielsko-Biała Regional Court had received information that the applicant intended to escape. 20.  On 23 November 2000 an appellate hearing was held before the Katowice Court of Appeal. On the same day the court delivered a judgment. It found that there had been procedural shortcomings in the proceedings before the court of first instance, as one of the lay judges had not been present at one of the hearings and the hearing in question had not been repeated. Consequently, the Court of Appeal quashed the judgment of the first-instance court and remitted the case to the Regional Court for reconsideration. 21.  On 23 January 2001 the Bielsko-Biała Regional Court extended the applicant's detention on the grounds that the evidence gathered in the course of the proceedings indicated that the applicant had committed the offences with which he had been charged and, taking into consideration the judgment of the first-instance court, the imposition of a severe sentence remained likely. 22.  On 30 January 2001 the applicant appealed against this decision. He alleged in particular that basing the decision on the fact that he had been sentenced by the first-instance court to fifteen years' imprisonment after this judgment had been quashed constituted a breach of his right to be presumed innocent. 23.  On 14 February 2001 the Katowice Court of Appeal upheld the contested decision. The Court of Appeal in its reasoned grounds stated that the first-instance court judgment had been quashed due to procedural shortcomings and that there were no reasons to change the preventive measure. 24.  On 20 May 2002 the Bielsko-Biała Regional Court found the applicant guilty on all charges and sentenced him to fifteen years' imprisonment and ten years' deprivation of his civil rights. It counted the applicant's detention from 31 August 1998 to 20 May 2002 towards the sentence. 25.  On 18 July 2002 the applicant's lawyer lodged an appeal with the Katowice Court of Appeal. He argued that the Bielsko-Biała Regional Court had overstepped the margin of discretion in the assessment of evidence and had reached wrong conclusions. 26.  The Katowice Court of Appeal extended the applicant's detention on 11 September and 11 December 2002. The applicant's counsel appealed unsuccessfully against those decisions. 27.  On 30 January 2003 a hearing was held at the Katowice Court of Appeal, at which the applicant was present. The court gave a judgment amending the judgment of the court of first instance and sentenced the applicant to eight years and six months' imprisonment for causing grievous bodily harm to the victim. 28.  On 1 July 2003 the applicant's lawyer filed a cassation appeal against the judgment of the court of appeal with the Supreme Court. He argued that the court had disregarded the evidence submitted by the applicant and had erroneously and arbitrarily interpreted the facts. He alleged numerous procedural shortcomings and infringements of substantive law on the part of the court. He requested the court to quash the judgment and refer it to the Katowice Court of Appeal for reconsideration. 29.  On 7 November 2003 the Katowice appellate prosecutor submitted a reply to the cassation appeal of the applicant's counsel. The Prosecutor General also lodged a cassation appeal against the judgment in question, arguing that the applicant should have been convicted of attempted murder and not merely of causing grievous bodily harm. 30.  On 6 January 2004 a cassation hearing was held at the Supreme Court. The applicant did not appear at the hearing, even though he had been duly informed. The court dismissed the applicant's cassation appeal, finding it manifestly ill-founded. The court allowed the Prosecutor General's cassation appeal and quashed the judgment of the Court of Appeal in the part sentencing the applicant to eight years' and six months' imprisonment for causing grievous bodily harm to the victim. The Supreme Court agreed with the Prosecutor General that the Katowice Court of Appeal had disregarded certain facts, reached arbitrary conclusions on the basis of those facts and failed to substantiate its decision properly. The case was referred for reconsideration to the court of appeal. The court further decided to extend the applicant's detention for another three months. 31.  On 24 March 2004 the Katowice Court of Appeal extended the applicant's detention until 6 July 2004. 32.  On 22 April 2004 an appeal hearing was held, the applicant being present. The Court of Appeal upheld the judgment of the Bielsko-Biała Regional Court of 20 May 2002 and counted the applicant's detention from 31 August 1998 to 22 April 2004 towards the sentence. 33.  On 28 July 2004 the applicant's counsel lodged a cassation appeal against the judgment of 22 April 2004. 34.  On 16 February 2005 the Supreme Court dismissed the applicant's cassation appeal, finding it manifestly ill-founded.