5.  The applicant was born in 1981 and is currently serving a sentence of imprisonment in Nysa Prison. 6.  On 28 May 2001 the Kielce Regional Court convicted the applicant of robbery and sentenced him to ten years’ imprisonment. The sentence was amended by the Cracow Court of Appeal on 5 December 2001. The applicant has been serving this sentence since 3 September 2000, with interruptions between 13 January 2003 and 13 January 2005; 31 May 2005 and 17 August 2005; and 13 May 2008 and 30 May 2014. 7.  In August 2005 the applicant was charged with murdering an Italian citizen, a certain P.A on 9 August 2005. Allegedly, he had repeatedly hit P.A. on the head, causing brain haemorrhages, swelling of the brain, and consequently P.A.’s death. He was also charged with one count of robbery committed on 8 August 2005 and possession of 0.2327gr of MDMA (commonly known as extasy) on 17 August 2005. 8.  On 20 March 2006, after examining the applicant and analysing his medical file from 2000, psychiatrists concluded that he should undergo a psychiatric assessment, in order to determine whether he could be held criminally responsible for this offence. 9.  On 27 March 2006 the Katowice Regional Court ordered that the applicant should undergo a psychiatric assessment in a psychiatric facility. The applicant underwent this assessment in the psychiatric ward of Cracow Detention Centre between 12 April and 30 June 2006. In an opinion dated 18 July 2006 (“the 2006 opinion”), two psychiatrists and a psychologist confirmed that he had been suffering from a chronic psychotic disorder of a delusional type related to organic lesions in his central nervous system, and also from a personality disorder (przewlekłe psychotyczne zaburzenia psychiczne o obrazie zespołu urojeniowego u osoby ze zmianami organicznymi o.u.n.; zaburzenia rozwoju osobowości), at the time the offences had been committed, and that he would not have been aware of and could not have controlled his actions. They further recommended that he be placed in a psychiatric hospital, as there was a risk that he could commit similar offences again. In an additional opinion of 12 January 2007 they confirmed their previous findings. 10.  On 2 April 2007 the Katowice Regional Court decided to discontinue the proceedings against the applicant, on the basis that he could not be held criminally responsible. It further ordered that he be placed in a psychiatric hospital. 11.  On 25 May 2007 the Katowice Court of Appeal quashed that decision and remitted the case. 12. The Katowice Regional Court examined the case at two hearings on 5 and 25 September 2007. On the former date the court heard evidence from the experts who had prepared the opinions. They confirmed their previous findings. T., an expert who spoke on behalf of the team, stated in particular that the experts had excluded the possibility that the applicant was simulating a mental illness. In support of this statement, he noted that the applicant had been medicated and subjected to a psychological personality test, the MMPI (Minnesota Multiphasic Personality Inventory). The results of the test had confirmed that he could not be feigning the symptoms of a mental illness, as a healthy person would have had a very different reaction to those specific medications. The applicant’s lawyer supported the prosecutor’s application for the proceedings to be discontinued. 13.  On 25 September 2007 the Katowice Regional Court discontinued the proceedings against the applicant. On the basis of available evidence, the court established that the applicant had committed the offences with which he had been charged. However, as he had been suffering from a mental disorder at the time, he could not be held criminally responsible. The court referred to the experts’ opinions and the evidence which they had given during the trial. It also noted that the applicant had undergone psychiatric treatment since 2000. 14.  The applicant did not appeal against that decision, and it became final on 10 October 2007. 15.  On 14 March 2012 the Katowice Court of Appeal refused an application by the applicant to reopen the proceedings in the case. The court admitted that, in view of new evidence (see paragraphs 44 and 46 below), it appeared that the applicant had not murdered P.A., and that he had only participated in the robbery. However, even if the proceedings were reopened, they would have to be discontinued in any event, in view of the applicant’s insanity. 16.  On 12 December 2007 the Psychiatric Commission on Security Measures (Komisja Psychiatryczna ds. środków zabezpieczająych – “the Commission”) recommended that the applicant be placed in Branice Hospital. The applicant could not be transferred there immediately, as he was serving a sentence of 10 years’ imprisonment imposed in the first set of criminal proceedings against him (see paragraph 6 above). The Katowice Regional Court asked the penitentiary division of the court to change the order in which the sentences would be served, and to apply the security measure first. On 25 April 2008 the court decided that the applicant should first be placed in a psychiatric facility. 17.  The applicant was admitted to Branice Hospital on 13 May 2008. 18.  A hospital psychologist, in opinions of 23 June and 15 December 2008, 20 May and 5 November 2009, confirmed that the applicant should continue treatment in hospital. In her opinion of 20 April 2010 the expert noted that the applicant could be moved to a less secure hospital. 19.  Psychiatrists from Branice Hospital, in opinions of 14 June and 9 December 2008, 19 May and 9 November 2009 and 20 April 2010, also confirmed that the applicant should continue treatment in a psychiatric hospital. In particular, in the opinion of 9 November 2009 the doctors concluded that the applicant was suffering from a delusional disorder related to organic lesions in his central nervous system (zaburzenia omamowo-urojeniowe na podłożu organicznego uszkodzenia o.u.n.). There had been an improvement in his condition following the treatment, however there had been no complete recovery. Accordingly, the applicant’s detention was extended by the Katowice Regional Court on 21 July 2008, 19 January, 22 June and 7 December 2009. Neither the applicant nor his representative appealed against those decisions. 20.  On 4 May 2010 the applicant was transferred to Lubliniec Hospital, a less secure institution. 21.  On 29 October 2010 experts from Lubliniec Hospital gave an opinion following a periodic review of the applicant’s condition. They noted that the applicant should continue treatment in a more secure facility. Consequently, on 15 November 2010 the Katowice Regional Court again extended the applicant’s detention. 22.  In a joint opinion of 26 August 2011, Lubliniec Hospital psychiatrists confirmed that the applicant should continue treatment in a secure facility, as he still posed a serious threat to public order. 23.  Between 28 March and 22 May 2012 the applicant underwent a psychiatric assessment in Pruszków Hospital, pursuant to an order made in the course of the third set of criminal proceedings against him (see paragraph 45 below). The relevant experts were asked to assess his mental state when he had allegedly committed other robberies between June and August 2005 (see paragraph 44 below). 24.  On 17 June 2012 two psychiatrists and a psychologist gave a joint opinion (“the Pruszków opinion”), which disagreed with the 2006 opinion (see paragraph 9 above). They concluded that the applicant had not been suffering from any mental illness at the time when the offences had been committed (tempore criminis). In their view, the applicant did not have any organic lesions in his central nervous system. Nor did he have a learning difficulty. They agreed that he had a dissocial personality disorder. They noted that, from an early age, the applicant had disregarded the rights and feelings of others, as well as social norms. He also failed to learn from his actions and repeated dysfunctional behaviour. However, they were of the opinion that his condition had significantly improved in recent years. While the risk that he would commit a similar offence was not very high, it could not be excluded that, in difficult situations, he might suffer from reactive disorders. It was therefore recommended that any prison sentence served by the applicant should be served in therapeutic conditions. The opinion was submitted to the Katowice Regional Court on 11 September 2012. 25.  Meanwhile, on 20 July 2012 psychiatrists from Lubliniec Hospital, in an opinion following a periodic review of the applicant’s condition (“the Lubliniec opinion”), had noted that the applicant had been diagnosed with delusional disorders related to organic lesions in his central nervous system. During his stay in Lubliniec Hospital, no acute psychotic symptoms had been observed. However, in view of the initial diagnosis and his lifestyle, it was felt that the applicant should continue treatment at a psychiatric hospital, as there was still a risk that he might commit criminal offences of significant harm to the community. 26.  At hearings held on 28 August and 24 September 2012 the Katowice Regional Court examined the applicant’s application for release of 24 July 2012. The court heard evidence from Lubliniec experts who had given the opinion of 20 July 2012 (see paragraph 25 above). One of the experts clarified that, in assessing the possible risk of the applicant committing criminal offences, she had relied on the initial diagnosis and his lifestyle (his multiple convictions and the fact that he was young and single with no children). She further agreed with the Pruszków experts’ opinion (see paragraph 24 above) that the applicant suffered from a personality disorder. His personality disorder was characterised by a tendency to manipulate and dominate others, and he was self-centred. These elements constituted a risk that the applicant might commit a criminal offence. The expert was not able to answer the court’s question as to whether the applicant could have simulated a mental illness. 27.  On 24 September 2012 the Katowice Regional Court dismissed the applicant’s application to be released from hospital. With reference to the discrepancies between the two expert opinions, the court held that the Pruszków opinion concerned the applicant’s capacity tempore criminis, while the Lubliniec opinion related to his general progress in treatment and his future prognosis. Moreover, the Pruszków opinion had been given with reference to different offences. The court also noted that both sets of experts agreed that the applicant had suffered from a dissocial personality disorder. In view of the above, the court decided to base its conclusion on the Lubliniec opinion and refused to release the applicant from detention. It also held that he should continue treatment in a less secure institution. The applicant did not appeal against that decision. 28.  On 28 November 2012 the Katowice Regional Court dismissed a further application by the applicant to be released from detention. It noted that his situation had not changed since the last decision had been given. It further decided to place him in a facility with enhanced security. It referred to a letter in which he had informed the authorities that he had been considering an escape from the psychiatric facility. That decision was upheld by the Katowice Court of Appeal on 22 January 2013. 29.  On 31 January 2013 the applicant attempted to commit suicide by overdosing on his medication. 30.  On 13 February 2013, the applicant was transferred to Cracow Psychiatric Hospital (a hospital with enhanced security). 31.  On 19 May 2013 the applicant sent a letter to the Katowice Regional Court, claiming that he had been simulating mental illness. He submitted that he owned a medical book on psychiatry and had also seen the film “A Beautiful Mind”, which had helped him to act out the symptoms of mental illness. He also informed the director of Lubliniec Hospital that he had been pretending to have a mental illness. However, she told him that many patients made the same claim. 32.  Meanwhile, on 19 March 2013, in the context of periodic review proceedings, the Katowice Regional Court had decided to continue the applicant’s detention in a psychiatric facility. The court relied on an expert opinion of 15 March 2013, in which experts from Cracow Psychiatric Hospital had confirmed that the applicant suffered from a dissocial personality and had suffered from a psychotic disorder in the past. They had stressed that there was a risk that the applicant would commit a similar offence of significant harm to the community as a result of his psychiatric condition. In particular, the experts had referred to the fact that the applicant was not critical of the offences he had committed or his medical condition. That decision was upheld by the Katowice Court of Appeal on 16 April 2013. 33.  On 27 August 2013, pursuant to Article 203 of the Code of Execution of Criminal Sentences (see paragraph 55 below), psychiatrists from Cracow Psychiatric Hospital submitted an opinion concerning the applicant following a periodic review. They confirmed that he had not been suffering from a mental illness, but had a severe dissocial personality disorder. They also noted that the applicant claimed to have suffered from a brief psychotic disorder in the past. They were convinced that, between June and August 2005, the applicant had been able to recognise the significance of his actions and control his behaviour. However, the experts considered that it was still likely that he would commit similar offences of significant harm to the community again as a result of his psychiatric condition. This risk was not related to a mental illness, but to a severe personality disorder. The applicant was still in need of complex therapy for personality disorders. They experts left the decision as to whether security measures should be continued to the court’s discretion. 34.  On 12 September 2013 the experts supplemented their opinion with regard to further questions put by the court. They confirmed that, at the time when the offences had been committed, the applicant had not been suffering from any delusional disorders which could have resulted in a conclusion that he had acted in a state of insanity. They also considered that it was highly likely that he would commit similar offences again. This risk was related to the applicant’s lifestyle, his multiple convictions and his inability to learn social skills, but not to a mental illness. They stated that they could not recommend the applicant’s release. Even if he had not been insane at the time when the offences had been committed, there was still a risk that he would commit further offences in view of his dissocial personality disorder. They further concluded that it was not a medical but a legal issue as to whether the applicant’s detention should be lifted. 35.  Subsequently, on an unknown date the applicant lodged an application for release. It was examined by the Katowice Regional Court at two hearings: on 17 October and 8 November 2013. The applicant’s representative and psychiatrists were present. The court heard evidence from experts from Cracow Psychiatric Hospital. They disagreed with the 2006 opinion and confirmed that the applicant was suffering from a dissocial personality disorder. The experts stated before the court that they had not recommended the applicant’s release, as they were aware that they could have been wrong in their assessment. The experts were also not in a position to give a clear answer to the question of whether the applicant could have simulated a mental illness. They submitted a supplementary opinion in which they noted that on 18 October 2013 the applicant had attempted to commit suicide (see paragraph 39 below). In their opinion, in view of the applicant’s fragile state, it was necessary to place him in a hospital with enhanced security. 36.  On 8 November 2013 the court refused to release the applicant from detention. The court thoroughly examined diverging psychiatric opinions, in particular the 2006 opinion (see paragraph 9 above) and the opinions of 27 August and 12 September 2013 (see paragraphs 33 and 34 above). Relying on the testimonies obtained from experts, it concluded that there were no grounds to doubt the correctness of the 2006 opinion, especially after such a long lapse of time. The court also examined the question of whether the applicant could have simulated a psychotic disorder, and noted the experts’ diverging views in this respect. It referred to T.’s expert testimony on 5 September 2007 (see paragraph 12 above) and to the testimony given by the Cracow experts on 17 October 2013 (see paragraph 35 above). It also held that the applicant had been detained in several hospitals, and none of the experts who had examined him there had challenged the initial diagnosis. Lastly, it referred to the applicant’s recent suicide attempt. In conclusion, the court held that there was still a risk that the applicant might commit an offence of significant social harm. 37.  On 22 November 2013 the applicant’s lawyer lodged an appeal against that decision. He referred to the divergent expert opinions. He also stressed that the applicant had recently been indicted for offences committed in 2005, and that his sanity was not being questioned in those proceedings (see paragraph 45 below). On 25 November 2013 the applicant lodged his own appeal, submitting in particular that he had been simulating a mental illness. 38.  The Katowice Court of Appeal examined the applicant’s appeal at two hearings: on 21 January and 11 March 2014. On the latter date, relying on the evidence gathered by the Regional Court, it upheld the decision of 8 November 2013 (see paragraph 36 above). The court referred to the reasons given by the Regional Court and considered that it was still likely that the applicant would commit similar offences again. 39.  Meanwhile, on 18 October 2013, the applicant had attempted to commit suicide by injecting himself with a significant dose of insulin. He was transferred to the toxicology ward of Cracow University Hospital, where he was treated for two days. 40.  On 20 January 2014 the applicant was transferred to Toszek Psychiatric Hospital. 41.  On 30 April 2014, pursuant to Article 203 of the Code of Execution of Criminal Sentences (see paragraph 55 below), psychiatrists from Toszek Hospital submitted an opinion concerning the applicant following a periodic review. They confirmed that he only had a dissocial personality disorder and it was unlikely that he would commit similar offences of significant harm to the community again as a result of his psychiatric condition. They further recommended his release from the psychiatric facility. 42.  On 15 May 2014 the Katowice Regional Court appointed a new defence lawyer for the applicant, to replace the one who had resigned, and set a hearing date for 28 May 2014. On the latter date it heard evidence from the experts from the Toszek Hospital. The experts confirmed the findings they had made in the opinion of 30 April 2014. 43.  On 30 May 2014 the Katowice Regional Court gave a decision and ordered the applicant’s release from the psychiatric facility. The applicant was released on that date and transferred to Wojkowice Prison in order to serve the remainder of the sentence of imprisonment which had been imposed following the first set of criminal proceedings against him (see paragraph 6 above). 44.  On 8 December 2010 the Katowice District Prosecutor charged the applicant with several counts of robbery (carjacking) committed between June and August 2005 (on 23 June, 27 June, 4 July, 5 July and 17 August 2005). Allegedly, the applicant, together with a certain A.I. and one other person, had stolen five cars by using force and intimidating the cars’ drivers (by hitting, kicking and using tear gas). During his questioning, the applicant informed the prosecutor that A.I. had been involved in P.A.’s killing. 45.  On 30 January 2012 the Katowice Regional Court ordered the applicant to undergo a psychiatric medical examination at Pruszków Hospital in order to assess his mental state at the time when the alleged offences had been committed. As indicated in paragraph 24 above, the medical opinion given by experts from Pruszków Hospital on 17 June 2012 stated that the applicant had had full mental capacity in 2005. 46.  On 25 October 2013 a bill of indictment was lodged with the Katowice Regional Court. A.I. was charged with murdering P.A., and the applicant and a certain T.K. were only charged with theft and several counts of robbery committed in 2005. The trial before the Katowice Regional Court began in 2014. 47.  During a hearing on 14 January 2015 the court heard evidence from the Cracow Hospital experts who had prepared the opinion of 27 August 2013. As indicated in paragraph 33 above, they confirmed that the applicant had not been suffering from a mental illness, but had a personality disorder. They were also convinced that, between June and August 2005, the applicant had been able to recognise the significance of his actions and control his behaviour. The experts disagreed with the opinion of 2006 (see paragraph 9 above). 48.  On 22 April 2015 the court heard evidence from psychiatrists from Pruszków Hospital who had prepared the opinion of 17 June 2012 (see paragraph 24 above). They confirmed that, in their opinion, the applicant had not been suffering from a mental illness. They further agreed that it was very likely that the applicant had pretended to have symptoms of a mental illness. 49.  On 22 May 2015 the court heard evidence from the psychologist who, together with two psychiatrists, had prepared the opinion of 18 July 2006 (see paragraph 9 above). He stated that the applicant could have simulated a brief psychotic disorder (zaburzenia psychotyczne) during the psychological tests. 50.  On 20 July 2015 the Katowice Regional Court gave judgment. The court established that the applicant, together with A.I. and a certain T.K. had participated in the assault on P.A.. The criminal proceedings against the applicant were subsequently discontinued due to his insanity. The court further thoroughly examined the applicant’s mental capacity and found that the applicant had had full mental capacity in the relevant period. It convicted A.I. of P.A.’s murder, T.K. of robbery and assault on P.A. and the applicant of several counts of robbery committed on 23 June, 27 June, 4 July, 5 July and 17 August 2005. It also sentenced the applicant to three years’ imprisonment, suspended for seven years. 51.  The applicant did not lodge an appeal against that judgment.