5.  The applicant was born in 1975 and lived in Balakliya. 6.  On 7 October 2003 the applicant was admitted to hospital to undergo treatment for drug addiction. 7.  On 11 October 2003, in the course of a police operation, an undercover police agent bought a certain amount of cannabis from the applicant when he was in hospital. After the sale was completed it was documented in the presence of two witnesses. The applicant was further searched and some additional quantities of the drug were seized. 8.  On the same day the police officers arrested the applicant under Article 263 of the Administrative Offences Code for a violation of the drug circulation rules. Relying on the provisions of that Code, the police detained the applicant for three days pending the results of an expert examination of the seized drugs. 9.  On 14 October 2003, upon receipt of the expert report confirming that the seized drug was cannabis, the investigator of the Kharkiv Region Police Department decided to arrest the applicant and detain him further under Articles 106 and 115 of the Code of Criminal Procedure, considering that the sale of cannabis in hospital constituted a crime under Article 307 § 2 of the Criminal Code. The applicant was questioned on that day. 10.  On 15 October 2003 the police also opened criminal proceedings against the applicant under Article 309 § 2 of the Criminal Code, noting that on 11 October 2003 they had seized some additional quantities of cannabis from him which he had transported to and kept in the hospital. 11.  On 17 October 2003 the applicant was brought before the Leninskyy District Court of Kharkiv, which ordered his pre-trial detention as a preventive measure. The court noted that the charges against the applicant were serious, that he was not in employment and had committed crimes while being treated in a hospital. For these reasons the court concluded that the applicant might abscond from justice, obstruct the investigation, or reoffend. 12.  On 18 December 2003 the criminal case file arrived at the Kominternivskyy District Court of Kharkiv (“the first-instance court”) for the applicant to be tried. 13.  On 26 December 2003 the first-instance court committed the applicant for trial. It decided that the preventive measure applied in respect of the applicant, namely, custody, should remain the same. 14.  On 4 May 2004 the applicant requested the first-instance court to release him under a written obligation not to abscond. 15.  On 9 June 2004 the first-instance court rejected the applicant’s request. The court noted that there had been no grounds to consider that the reasons justifying the earlier court decision of 17 October 2003 on the applicant’s detention were no longer valid. The applicant’s reference to the illness of his mother and the death of this father was not relevant. Likewise, his acknowledgment of guilt was irrelevant and could only be taken into account for mitigation of sentence. 16.  On 23 December 2004 the first-instance court ruled that the preventive measure in respect of the applicant should remain the same, without specifying the reasons. 17.  On 10 March 2006 the local prosecutor’s office refused to open a criminal investigation in respect of the applicant’s allegations that his initial detention was unlawful. 18.  On 27 April 2006 the applicant lodged a request to have the preventive measure changed. On the same day the first-instance court rejected the request as unfounded. The court noted that there were no grounds to consider that the reasons justifying the earlier court decision of 17 October 2003 on the applicant’s detention were no longer valid; the allegations of the aggravation of the applicant’s health were not confirmed by the materials in the case file and the applicant’s contentions that he was the only source of support for his mother were not convincing. 19.  On 25 May 2006 the applicant and his mother, who had joined the proceedings as the applicant’s defence counsel, lodged a new request for release. The applicant’s mother specified that she could not work for health reasons and the applicant was her only support. On the same day the first-instance court rejected the request, noting that the reasons already given by the court for the applicant’s detention remained valid; the allegations that the applicant was providing support to his mother were not convincing, since at the time of his arrest the applicant had not been in employment, while his mother received a pension; likewise, the applicant could not be released for health reasons as there was no supporting information about his illnesses. 20.  On 25 June 2006 the applicant complained to the Kharkiv Region Court of Appeal (“the Court of Appeal”) arguing that his initial detention had not been lawful. 21.  On 7 and 11 July 2006 the applicant and his mother lodged requests for the release of the applicant with the first-instance court. The applicant’s mother specified that the applicant had been her only support and that his health was seriously deteriorating. The court dismissed the requests on the same days, repeating its earlier findings in respect of similar requests. 22.  On 11 July 2006 the applicant’s mother lodged a complaint with the first-instance court arguing that the applicant’s initial detention under Article 263 of the Code of Administrative Offences, without a court order, had been unlawful. 23.  On 19 July 2006 the Court of Appeal replied to the applicant that his complaint regarding the lawfulness of his initial detention would be considered by the first-instance court in the course of the trial in his criminal case. 24.  On 10 August 2006 the first-instance court found the applicant guilty of the crimes under Articles 307 § 2 and 309 § 2 of the Criminal Code and sentenced him to five years’ imprisonment combined with confiscation of property. The court further found that the applicant’s contentions that his initial detention had been unlawful were unsubstantiated because there had been sufficient grounds to detain the applicant under Article 263 of the Administrative Offences Code. In particular, his detention for the first three days had been justified as the police had been waiting for the expert report confirming that the seized substance was cannabis. The court also decided that the term of the applicant’s imprisonment should be calculated from 11 October 2003. 25.  The applicant appealed against that judgment. 26.  On 10 April 2007 the Court of Appeal upheld the findings of the first-instance court, having amended the reasoning as regards the characteristics of the applicant’s crime under Article 309 § 2 of the Criminal Code. The court further reduced the sentence to three and a half years’ imprisonment.