A former straight-A student who allegedly offered to blow himself up if he could not fight for Islamic State in Syria will deny planning terrorist acts and claim he wanted to exorcise "evil spirits", a court heard.

Mubashir Jamil, 22, from Luton, allegedly offered to put on a suicide vest and "press the button on the same day", before his arrest in April last year, the Old Bailey heard.

The avid computer gamer became obsessed with "martyrdom" after surfing the web for IS propaganda, the court has heard.

But after chatting with a covert police officer in encrypted messages on the Telegram app, counter-terrorist officers swooped to arrest him days before his flight to Turkey.

Prosecutor Barnaby Jameson told jurors that Jamil's defence would say he sought to join IS as a way of exorcising the evil spirits that plagued him and he did not intend to commit acts of terrorism anywhere.

However, the lawyer said the defendant made no mention of "evil spirits" in his communication with the undercover officer.

Mr Jameson told jurors Jamil made "careful planning" of his trip, choosing how he booked an airline ticket, his destination and items he would need as well as "deliberately" changing his appearance.

He told jurors: "He said nothing following his arrest, either in the police vehicle or in interview, that mentioned the exorcism of evil spirits."

The court has heard how Jamil shaved off his beard following guidance on an e-publication on how to be a "secret agent" in a non-Muslim country.

Jamil, who was born in Pakistan but brought up in Britain, denies a charge of preparing for terrorist acts.