A man drank a litre of rum before stabbing his flatmate to death and cutting his penis off, a court has been told.
Jeffrey Barry allegedly told people that he planned to kill members of the public, and victim Kamil Ahmad was "top of his list",
The 56-year-old, who suffers from schizophrenia, has pleaded not guilty to one count of murder and entered a guilty plea to manslaughter on the grounds of diminished responsibility based on his mental health.
Barry and his victim shared a multi-occupancy house for adults who need support in Bristol and the defendant had left the care of a hospital just hours previously.
Kurdish-born Ahmad was awoken by Barry in the early hours of 7 July with the defendant going inside Ahmad's room and emerging 40 minutes later covered in blood, it is alleged. Ahmad had been knifed more than 25 times and had his penis cut off, the court heard.
Six weeks previously, Barry had told support workers that he wanted to be "notorious" and kill members of the public, but specifically Ahmad, in May 2016 the court heard.
The jury heard that Barry had acted in a racist manner towards Ahmad and had told police the refugee was a fraud and a rapist.
Barry had been taken to a psychiatric ward after displaying "peculiar and highly sexualised" behaviour which included him wandering around nude and masturbating in communal areas, prosecutor Adam Vaitilingam QC told Bristol Crown Court, according to The Mirror.
On the night of the alleged murder Barry had just returned to his home from a stay in a nearby hospital and went out drinking for several hours at two bars.
Then at around 1am Barry called community psychiatric nurse Joanne Wood and said he was "clinically insane" and "could not be held responsible for his actions", the court was told.
He then returned home just before midnight and just after 1am emerged from his room and made a phone call to the nurse telling her that he "felt like punching an Asian man in his building", The Sun reported.
Wood said Barry was behaving in a very sexually disinhibited way towards her and described himself as "a very sexual person", the court was told.
A neighbour heard screaming coming from Ahmad's room and Barry called police to tell them what he had done, the court was told.
The trial continues.