A former grade-A student, he was caught after talking to an undercover policeman using encrypted messages on an online app.
He had told the policeman he would blow himself up in Britain if he could not fight for so-called Islamic State in Syria.
Jamil told the officer: “If you or some brother you know can set 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 accused, who has suffered bouts of mental illness, was arrested by counter-terrorism officers in April 2016, a few days before a planned flight to Turkey.
During his trial the court hear Jamil had planned his trip-up carefully, and “deliberately” changed his appearance, shaving off his beard after reading guidance online about how to be a “secret agent” in a non-Muslim country.
The defendant, who was born in Pakistan but brought up in Britain, denied one count of preparing for terrorist acts but is guilty after a retrial.
Sentencing him to six years, Judge Peter Rook QC said his crime was only “in part” explained by his mental health disorder and said he was a “dangerous” offender.
He handed Jamil a “hybrid order” meaning he will continue to be treated in a secure hospital until he is well enough to be transferred to prison.
Jamil will serve a further five years on extended licence on his release.