A former straight-A student who told an undercover officer he would blow himself up in Britain if he could not fight for Islamic State in Syria has been jailed for six years.

Mubashir Jamil, 22, from Luton, 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.

Jamil denied preparing acts of terror, saying he was hearing voices and wanted to go to Syria to be exorcised of the "jinns" that were plaguing him.

An Old Bailey jury deliberated for a day to find him guilty following a retrial last month.

Judge Peter Rook QC considered whether to jail Jamil or hand him a hospital order as the defendant suffers from a schizo-affective disorder.

The judge told the court he had concluded Jamil's crime was only "in part" explained by his mental health disorder and he was a "dangerous" offender.

Defence barrister Naeem Mian QC said his client would prefer a jail sentence to psychiatric hospital.

Judge Rook, who asked if he had heard correctly, handed Jamil a "hybrid order".

Under the order, Jamil can continue to be treated in a secure hospital until he is well enough to be transferred to prison.

He jailed Jamil for six years with a further five years on extended licence.

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

He was snared in encrypted chat with an undercover officer, known as "Abu Hasan", and counter-terrorist officers swooped to arrest him days before his flight to Turkey.

Jamil, who suffered from periods of mental illness, made contact with the man he thought was an IS agent through the Telegram app, the court heard.

He told the officer: "If you or some brother you know can put an explosive belt on me and tell me how to press, as soon as possible for security reasons, I can do something in the UK even tomorrow after I find a good target."

The defendant, who set up a punch bag at his home to get fit for jihad, went on to say he would "prefer hijrah (migration)".

He also said: "I want them to feel another attack while they're still in mourning for Belgium."

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

In early April last year, Jamil, who had never travelled alone before, bought a return flight from Luton to Turkey.

On April 14 he allegedly asked Abu Hasan: "Will I have to buy my own guns in Sham?" The officer told him not to worry.

Days before he was due to leave, counter-terrorist police burst into Jamil's home.

At the time, he was on his laptop sending the undercover officer the message "police alert".

The former Challney High School for Boys pupil got A grades in his GCSEs and did work experience at an accountancy firm.

He worked in a local Amazon warehouse and listed his interests as reading fiction, surfing the internet and physical training.

Commander Dean Haydon, head of the Met's Counter Terrorism Command, said: "I am pleased with this result which has ensured that a man who was seemingly inspired by the terrorist atrocities in Belgium and France has been taken out of the community."