The former British army soldier who is on trial for escaping from HMP Wandsworth has said he left the prison without permission so he would get put into the High Security Unit at Belmarsh Prison.
Giving evidence for a third day in his trial at Woolwich Crown Court he told the jury that he had been trying to get himself upgraded to Double Category A High Risk.
He said he wanted to be held somewhere where he was away from sex offenders, but also not on a normal wing where he might be attacked for being a soldier.
He said that on arrival in Wandsworth prison he was put in the Vulnerable Prison Unit, where "95%" of inmates were serious sex offenders - "rapists, paedophiles, that sort of thing".
He said he got a job in the stores of the kitchen with the help of a prisoner on his wing.
"This individual was quite a prolific sex offender. A homosexual one," Mr Khalife said. "He wanted me to work with him."
He said he thought the man was trying to "do me a favour" but added: "He certainly wanted something."
He said prison officers had also warned him that he was at risk.
"They said there are terrorist offenders in this prison who want to kill you."
He said he decided the safest place for him to be would be in the High Security Unit at Belmarsh prison.
He said that on 21 August 2023 he pretended to be trying to escape by acting "very suspiciously" next to a food delivery lorry.
He expected to have his risk category upgraded, but nothing happened.
He said that on 1 September 2023 he attached a sling made of trousers and carabiners under the lorry near the tail lift.
On 6 September he climbed under the lorry and he said: "When the tail lift raised it covered me entirely."
He told the jury that when the Bidfood lorry got to the prison gate officers did their normal check with torches but did not find him.
"There was action around the lorry," he said.
He also heard a governor ask "have you searched the vehicle?"
He then described climbing out from under the lorry near Wandsworth roundabout.
"I accept that I left the prison and I didn’t have any permission to do so," he said.
The court heard Mr Khalife marked the 6 September 2023 in his diary with an asterisk after he decided he was going to escape.
Jurors were also shown an entry for the date of the fake escape on 21 August marked with an asterisk.
It also had the word "failed", which Mr Khalife told the court he added a few days later.
He also told the jury that the fake bomb that he left on the desk of his barracks when he absconded from there in January 2022 was not designed to frighten anyone.
"I knew with certainty that all my colleagues would know that this was fake," he said.
He told the jury he was trying to get his story reported in the media to increase his credibility with his Iranian intelligence handlers who he says he had given "entirely fictitious" information.
The jury has heard that Mr Khalife joined the army at 16, and had reached out to a man linked to Iranian intelligence aged 17. He then contacted MI6 saying he wanted to be a double agent.
He has told the jury all the information he gave the Iranians was "fake" or "useless".
Mr Khalife said he came up with his double agent plot after watching American television show Homeland on Netflix, in which one character fakes a defection to Iran.
"I had seen one of the characters had falsely defected to a particular country and utilised this position," he said, adding that looking back, he was "embarrassed" about his plot and had been "amoral" when he thought it up.
"If I was a real spy it wouldn’t have been difficult to defect," the former soldier said.
He denies gathering information useful to an enemy, collecting a list of Special Forces soldiers that would be useful for terrorism, perpetrating a bomb hoax and escaping from prison.
His evidence and the trial continue.