5.  The applicant was born in 1983 and is currently in detention in Rzeszów.
6.  The facts of the case, as submitted by the parties, may be summarised as follows.
7.  On 19 April 2005 the applicant was arrested and placed in detention in Chełm Prison. He was later held in several other detention facilities.
8.  On 4 August 2010 the Lublin Regional Court convicted the applicant of murder, rape, assault, robbery, fraud and handling stolen goods. On 8 February 2011 the Lublin Court of Appeal upheld the first-instance judgment.
9.  Previously, on 21 November 2008 the governor of Chełm Prison requested that the Lublin Regional Court order the applicant to take part in a rehabilitation programme for convicted drug addicts while he served his sentence.
10.  On 15 December 2008 the Lublin Regional Court granted the request.
11.  On 27 June 2010 the applicant complained to the Lublin Regional Inspectorate of the Prison Service that he had not in fact been taking part in the drug rehabilitation programme while serving his sentence.
12.  On 24 September 2010 the head of the Lublin Regional Inspectorate of the Prison Service replied that the applicant’s programme had been planned to start on 6 January 2010. However, owing to his anti-social behaviour, which might have been dangerous for other inmates, he had been classified as a dangerous detainee and had therefore not been able to participate in the programme, which, as a rule, involved group sessions and treatment.
13.  On 14 September 2009 the Chełm Prison Penitentiary Commission (“the commission”) classified the applicant as a “dangerous detainee”. The commission made its decision after a request from the governor of Chełm Prison, which stated that the applicant had beaten another prisoner at the Lublin Detention Centre in 2002 (this event was not a subject matter of the above criminal proceedings). Additionally, the applicant had apparently behaved in an aggressive and unpredictable manner by, in particular, threatening prison guards, refusing to accept meals and trying to self-harm. He was frequently punished for disciplinary breaches. He did not appeal against the commission’s decision.
14.  The decision to impose the dangerous detainee regime on the applicant was subsequently upheld, inter alia, by decisions of the Lublin Remand Centre Penitentiary Commission of 10 December 2009; of 4 March, 2 June, 2 September and 2 December 2010; of 2 March, 2 June, 1 September and 1 December 2011; and of 1 March, 30 May, 29 August and 28 November 2012. The reasoning of all these decisions was similar and read as follows:
“The Commission, having noted the proposals made by the Head of the Protection Division (Kierownik Działu Ochrony) and the Head of the Penitentiary Division (Kierownik Działu Penitencjarnego) and having heard the applicant held, in his presence, that the reasons justifying his classification as a dangerous detainee have not ceased to exist. It has been unanimously decided to extend the applicant’s classification for further three months because he still poses a danger to the security of the society and the prison.”
15.  The applicant appealed against most of the decisions issued in 2010 and 2011. The appeals were dismissed by the Lublin Regional Court on 9 April and 15 October 2010, and on 28 February and 27 April 2011.
16.  The court held that the commission’s decisions had been lawful and justified as the dangerous detainee regime had been imposed on the applicant in accordance with Article 88a § 2, sub-paragraph 2(c) of the Code of Execution of Criminal Sentences.
17.  On 27 February 2013 the Lublin Remand Centre Penitentiary Commission extended the period of the imposition of the dangerous detainee regime on the applicant. The commission based its decision on the fact that the applicant had ill-treated another prisoner. It also made reference to the request for an extension of the regime made by the director of the remand centre, according to which the applicant had destroyed some objects in the penitentiary unit and had behaved in an aggressive and unpredictable manner. On 9 July 2013 the Lublin Regional Court upheld the commission’s decision holding that the extension of the dangerous detainee regime was justified by the applicant’s unpredictable behaviour, his interference with the peaceful functioning of the penitentiary unit, acts of self-mutilation and refusal to accept meals.
18.  The dangerous detainee regime was further extended on 22 May 2013. The Lublin Remand Centre Penitentiary Commission again based its decision on the fact that the applicant had ill-treated another prisoner. It also referred to the request for an extension of the regime made by the director of the remand centre, who relied on the fact that in February 2013 the applicant had been punished for destroying some objects in the penitentiary unit and that his behavior was still unpredictable. On 2 September 2013 the Lublin Regional Court upheld the commission’s decision, holding that it had been given in accordance with the law.
19.  On 13 August and 13 November 2013 the Lublin Remand Centre Penitentiary Commission again extended the period of the dangerous detainee regime imposed on the applicant. In the decision of 13 August 2013 the commission relied on the request made by the director of the remand centre of 12 August 2013, according to which the applicant had been disciplinary punished on 4, 18 and 28 June 2013. In the decision of 13 November the commission made reference to the request of 12 November 2013 which was justified by the applicant’s “emotional instability” and “unpredictable behaviour”. The applicant appealed, but the latter decision was upheld by the Lublin Regional Court on 30 December 2013. The court found, among other things, that the applicant could not control his aggressive behaviour and was a threat and danger to order in the prison. It referred to the applicant’s aggressive behaviour on 5 June 2013 when he had tried to push out a guard from his cell and tear out shackles from him. He had also broken a support of his bed and used vulgar language. He had committed a further unspecified disciplinary offence on 21 June 2013. The decision of 13 November 2013 was upheld by the Lublin Regional Court on 30 December 2013. The court referred to the reasons relied on previously in its decision of 9 July 2013 (see paragraph 17 above).
20.  On 12 February 2014, owing to an improvement in the applicant’s behaviour and his progress in understanding the need to undergo therapy for drug addicts, the dangerous detainee regime was lifted. The applicant appealed and the challenged decision was upheld by the Lublin Regional Court on 15 April 2014.
21.  The regime was applied to the applicant for four years and almost five months.
22.  The applicant was detained in several detention facilities - Chełm Prison, Radom Remand Centre, Lublin Remand Centre and Potulice Prison.
23.  The cells, in which the applicant was kept, including the sanitary facilities, were constantly monitored via closed-circuit television.
24.  The applicant had to wear a red uniform, designated for dangerous detainees, which, as he alleged, was not warm enough in the winter. He was subjected to a strip search every time he left or entered his cell, which in practice meant that he had to strip naked in front of prison officers and bend over in order to enable the examination of his anus. The applicant had to wear handcuffs whenever he was outside his cell, including for appearances in court.
25.  The windows were covered by a plastic blind which limited access to daylight and fresh air in the cells.
26.  In Chełm and Potulice prisons the cells were equipped with a sanitary facility which was partially separated from the rest of the cell.
27.  On 28 September 2009 the applicant was transferred from Chełm to the Radom Remand Centre. According to the applicant, the cell there was equipped with a noisy ventilator and he could not sleep.
28.  On 27 November 2009 the applicant was transferred to the Lublin Remand Centre, where he was placed in solitary confinement.
29.  The applicant was detained in a single cell where the sanitary facility was not separated from the rest of the cell. He was also detained in cells in Lublin where the sanitary facility was separated.
30. In the cell he had no access to hot running water. According to the Government, there was a boiler in the cell so the applicant could heat water. The applicant submitted that he had had the boiler for six months and that it had then been taken away. He was allowed to have a shower once a week.
31.  The applicant was not allowed to go to mass in the Lublin Remand Centre. He lodged a complaint about this with the Lublin Regional Inspectorate of the Prison Service. In response, on 26 August 2010, the authorities decided that the applicant could listen to mass on the radio or have a private service with a priest. The applicant could go to the day room, which had sport facilities, a laptop, television, a computer game console and a DVD player, three times a week. He had access to press publications and could use the library. He could also participate in sports and art competitions. After the dangerous detainee regime was lifted, the applicant refused to participate in any sports and cultural activities because his cell was equipped with a television and a computer game console.
32.  On 20 March 2013 the applicant was transferred to Potulice Prison.
33.  The applicant had to wear joined shackles (kajdanki zespolone) on his hands and feet whenever he was outside the prison, including for appearances at court hearings or while on medical visits. The shackles consisted of handcuffs and fetters joined by chains. The Government submitted that outside his cell and within the prison the applicant only had to wear handcuffs. According to the applicant, he had to wear the joined shackles in the rest of the prison, including when he was going to attend visits by members of his family.
34.  On an unspecified day in April or May 2013 the applicant was transferred back to the Lublin Remand Centre.