Prosecutors say Andrew Ibrahim was planning to attack a shopping centre
A student accused of terror offences has told a court he made explosives and "suicide vests" because it was "fun".
Andrew Ibrahim, also known as Isa, told Winchester Crown Court he was trying to "occupy time" while he struggled to beat an addiction to drugs.
He said he was "planning to set off an explosion but not hurt people".
Mr Ibrahim, 20, from Bristol, denies making explosives with intent and preparing terrorist acts in April 2008, but admits making an explosive.
The court heard earlier from a friend of Mr Ibrahim who said he was a heroin and crack cocaine addict who sold drugs.
Giving evidence on Thursday, Mr Ibrahim said he made three prototype suicide vests for a video he planned to post on the internet.
"I had been off drugs for a while and I was finding it harder and harder," he said.
"I thought it [making a suicide vest] would occupy my time, the same reasons I made explosives.
"I wanted it to look good because I was going to film it like I did with the explosives and put it on YouTube."
Mr Ibrahim told the court he had planned to fill the final version of the vest with ball bearings and real or artificial explosives.
When asked why he wanted to post the footage on YouTube, he said: "It would be fun, people put their own comments on it, see what they think about it.
"It would bring fun, excitement and I could show people the video."
Prosecutors say Mr Ibrahim planned to carry out a terrorist attack at the Broadmead shopping centre in Bristol.
But the defendant denied this and said he had told a female friend his real intentions.
"I told her I was planning to set off an explosion but not hurt people. I thought she might be a bit impressed by it, I guess," he said.
The court has heard that when Mr Ibrahim was arrested at his home police found a quantity of home-made high explosives and an electrical circuit capable of detonating them.
Officers also discovered a suicide vest, the jury has heard.
Andrew Ibrahim converted to Islam and changed his name to Isa
Prosecutors say the defendant became increasingly radicalised after converting to Islam, developing a "mindset of martyrdom" and changing his name to Isa.
He also researched fundamentalism on the internet and searched online for techniques to manufacture explosives from household products, they claim.
Mr Ibrahim said on Thursday: "I wanted to have more than one different kind of explosive to compare them, to do different tests on them."
He also said he wanted to experiment with rockets too, as a way to "launch" his home-made explosives.
"I looked at [rocket] kits but they were quite expensive, about £30, so I got the idea of making it myself."
The trial continues.