4.  The applicant was born in 1958 and is detained in Yuzhno‑Sakhalinsk, Sakhalin Region. 5.  The applicant was accused of three counts of aggravated sexual assault and one count of being an accessory to traffic safety violation causing death of two or more persons. During the pre-trial investigation against him he was released on an undertaking not to leave his place of residence. 6.  On 4 June 2007 the applicant did not appear at the preliminary hearing scheduled by the Yuzhno-Sakhalinskiy Town Court and the Town Court ordered the applicant’s detention instead of his undertaking not to leave the place of residence. The detention order contained no time-limits. The relevant part of the order read as follows:
“The preliminary hearing was scheduled by the court for 29 May 2007...
The accused Kashpruk V.A. duly notified of the hearing did not appear and submitted to the court a copy of a medical record certifying that he undergoes treatment in the MUZ 4 [a hospital].
In order to verify this information the hearing was adjourned until 31 May 2007. The accused was duly notified of it.
However, once again he did not appear for the hearing and on 1 June 2007 informed the court that between 29 May and 7 June 2007 he is undergoing medical treatment and ... cannot participate in the hearings.
The preliminary hearing was adjourned until 4 June 2007 and the accused was duly notified of it, however he did not appear without presenting any reasons for his absence.
According to the certificate provided by the chief physician of the MUZ 4 the accused is indeed undergoing treatment for upper respiratory tract infection [but] his health condition does not prevent his participation in the court hearings.
This information is coherent with the written statement of the a judge of the [Town Court], which indicates that Kashpruk took part in a hearing on 29 May 2007, where he acted as a defense counsel for Mr R., ... and the testimony of the justice of the peace... that on 31 May 2007 Kashpruk consulted the administrative case file against Mr L., Mr B., and Mr K.
In view of these circumstances the prosecutor submitted a motion for [detention of the applicant].
The defense counsel Mr M., appointed by the court, disagreed...
As it had been established in the court hearing Kashpruk is accused of grave offences. [He had been] previously convicted. [His] character references are mostly negative, he is characterized as inclined to violate lawful requirements imposed on him.
The impossibility to take part in the hearing is disproven by the actions of the accused, who actively takes part in court hearings representing other persons.
[The applicant was informed multiple times about an obligation to take part in court hearings and about consequences of the failure to do so]
Under these circumstances the failure of the applicant to appear for the scheduled hearings is considered by the court as wilful obstruction to proceedings in the criminal case...” 7.  On 6 June 2007 the applicant appealed against the order. 8.  On 8 June 2007 he was arrested and remanded in custody. 9.  On 15 June 2007 the applicant’s appeal was sent to the other party. 10.  On 19, 20, 21, 22 and 25 June 2007 the applicant complemented his appeal. 11.  On 20, 21, 25 and 26 June 2007 the Town Court sent the applicant’s additional pleadings to the other party. 12.  On 26 June 2007 the Town Court transmitted the case file to the Regional Court. 13.  On 28 June 2007 the Regional Court notified the parties about the date of the hearing scheduled for 18 July 2015. 14.  On 2 July 2007 the applicant lodged an application for release which was examined and rejected on 9 July 2007. The Town Court refused to examine the applicant’s arguments concerning the deficiencies of the detention order of 4 June 2007 pending the appeal of the latter. It further rejected as unsubstantiated the applicant’s argument relating to his medical condition. 15.  On 3, 10 and 12 July the applicant complemented again his appeal. 16.  On 5 and 16 July 2007 the applicant’s complementary appeals were sent to the other party. 17.  On 18 July 2007, that is one month and eleven days later, the Sakhalin Regional Court quashed the detention order on appeal and released the applicant. The Regional Court found that the first-instance court failed to comply with the procedure prescribed by Article 247 of the Code of Criminal Procedure providing that a measure of restraint cannot be modified if no such measure had previously been ordered. 18.  On 26 July 2007 the applicant was placed under an undertaking not to leave his place of residence.