An alleged Taliban bomb-maker says he was held captive in Pakistan and forced to bundle up parts of explosive devices to prove he was not a British spy.
Khalid Ali told his trial he travelled there as a tourist, but was taken to a complex where he was under armed guard.
Prosecutors say Mr Ali’s fingerprints were found on bomb parts handed to US forces in Afghanistan in 2012.
Mr Ali, 28, from north London , denies preparing a terrorist act in the UK and possessing explosives abroad.
He was arrested in Westminster in April 2017, in possession of three knives.
Giving evidence at his trial, Mr Ali, from Edmonton, said he visited Pakistan’s city of Quetta as a tourist with someone he had met on his travels, before he was taken to a complex in a remote, rural area.
There he was accused of being a British spy and beaten, he told the Old Bailey.
He told the jury he was then asked to bundle up detonators for improvised explosive devices (IEDs) and to match up transmitters and receivers – which he carried on doing under armed guard for three months.
He said he would have been shot if he had not done what he was told to do.
Earlier, Mr Ali told the court that MI5 had tried to recruit him.
He said he had met representatives from the security services for the first time at Gatwick airport in 2010, when they had asked him to “keep an eye out” on what was happening on the Road to Hope aid convoy to Gaza.
Mr Ali said he had two further meetings with people who said they were attached to “counter-terrorism” who had asked him to spy on individuals.
On one occasion he said he was paid £80-100 for his time.
He said he told them that he was not willing to help them and part of the reason that he decided to leave the country in 2011 was due to his fear that “they may come after me”.
Mr Ali arrived back in the UK from Istanbul in November 2016.
The trial continues.