Andrew Ibrahim allegedly listened to radical preachers on the internet
A student accused of making a "suicide vest" from home-made explosives was a heroin and crack addict who sold drugs, Winchester Crown Court has been told.
Witness Jack Everson told the jury that Andrew Ibrahim, also known as Isa, sold him the heroin substitute methadone.
He also said Mr Ibrahim did not like woman wearing "promiscuous clothing".
Mr Ibrahim, 20, of Bristol, denies making explosives with intent and preparing terrorist acts in April 2008, but admits making an explosive.
Mr Everson, an A-level student, said the pair met in Bristol city centre when Mr Ibrahim was living at the St George's House hostel, and became friends.
He said Mr Ibrahim stopped wearing Muslim-style robes and began to wear Western clothes after being bullied by girls at the hostel.
Crack and heroin were Mr Ibrahim's "drugs of choice," Mr Everson said, and he told him that because the Koran did not ban the use of drugs, only alcohol, his addiction was no barrier to Islam.
The jury was told Mr Everson tried to get off drugs and did not see Mr Ibrahim for a few months, but by early 2008 he was back on them and also concerned about Mr Ibrahim.
"I was concerned about him in the sense he was addicted to heroin and crack and it was unpleasant to see a young person going through that," he said.
"I wanted to see what he was doing. When I spoke to him it would not make a lot of sense a lot of the time. I thought, maybe sometimes, it had gone to his head - the drugs."
Andrew Ibrahim experimenting at his home
Mr Ibrahim expressed opinions on how women dressed during their conversations, Mr Everson added.
"He was not particularly pleased with women who wore promiscuous clothing. Short skirts and things and, I assume, anything that exposes too much."
Yet, sometimes Mr Ibrahim would say he fancied a girl who wore those sort of clothes, the jury heard.
Mr Everson told the court Mr Ibrahim did not have enough to do with his days and that he had told him he had been forced to leave home because of his drug addiction.
The court heard he had last seen Mr Ibrahim on 12 April, 2008 when he bought two bottles of Hydrogen peroxide for him to get change so he could buy the methadone.
Under cross examination by David Spens QC, Mr Everson said Mr Ibrahim had told him he wanted the chemical for a cleaner.
He denied that Mr Ibrahim had told him he had found a recipe on the internet for explosive and bought ingredients and that he, Mr Everson, had said he wanted to go somewhere to set it off.
The trial continues.