A man who claims he became HIV positive as a result of sexual abuse by a “homosexual paedophile gang” had “violent fantasies” about causing a deadly poison attack on a bus in Surrey.

Duncan Railton, 41, of Warlingham, Surrey, had the ingredients for a viable chemical weapon at his home, Guildford Crown Court heard.

The jury was told that when police raided his home in October 2012 he was found to have 98 different chemicals, including some that could make chlorine gas.

His “violent fantasies” were revealed during sessions with psychiatrist James Ovens.

Taking the witness stand on the first day of the trial, the BBC reports that Dr Ovens recalled how Mr Railton had spoken of using VX nerve gas on a bus in Caterham, Surrey.

The defendant claimed he had carried out a chlorine attack on an assembly while at school aged 14 or 15, but it merely made a few people slightly ill from the fumes, the jury heard.

Mr Railton had been receiving mental health treatment since 2007.

The 41-year-old claimed he became HIV positive as a result of sexual abuse by a “homosexual paedophile gang” as a child.

Mr Railton also spoke of revenge attacks targeting people who abused him as a teenager and their families.

The court heard evidence of his research was later found on his computer.

Jurors were told Dr Ovens broke patient confidentiality and notified police, leading to Mr Railton’s arrest on 4 October 2012.

When interviewed by police, Mr Railton produced a prepared statement, writing that they were fantasies and he never intended to hurt anyone.

He also claimed “voices” had taken him over while he spoke to Dr Ovens, but that they “couldn’t make him do anything”.

Mr Railton had been taking anti-psychotic drugs but had stopped because they had side effects which gave him a heart condition.

Graham Smith, prosecuting, told the jury: “He was planning to kill and cause serious physical harm to numerous members of the public.

“He was planning to do this by releasing a chemical on public transport – he thought most likely a bus.

“He said [to Dr Ovens] he had a large stash of chemicals at his home address. He appeared to be excited at the idea of the death and destruction they would cause.”

Mr Railton denies two charges of possessing dangerous or noxious things and making threats to kill.

The trial continues.