As a teenager, Omar became entranced by jihadist ideology. He moved on to the cause of Kashmir, and was then piqued by 9/11 and the Iraq war, things that inspired and angered other Britons with Pakistani roots. But he in the end turned to attacking Britain, where he was born and raised.

Image Omar Khyam in northern Pakistan in 2003. On a previous visit, he took up the cause of Kashmir. Credit... Metropolitan Police

Asked on the witness stand his reaction to 9/11, Mr. Khyam did not disguise his delight.

“I was happy,” he recalled in his south England accent. “America was, and still is, the greatest enemy of Islam. I was happy that America had been hit because of what it represented against the Muslims, but obviously 3,000 people died, so there were mixed feelings.”

Mr. Khyam testified that his parents migrated to Britain from Pakistan in the 1970s, before his birth. He came from a family, he said, with a proud heritage of service, first in the British Army in Pakistan, then in the army of the newly independent Pakistan, and also in the intelligence services.

His parents were not particularly religious, he said, a pattern typical among Pakistani immigrants to Britain where the new generation, often turned off by what they see as the loose morals of binge drinking and broken marriages, has proven to be more devout than their elders.

At the age of 10, his father, a successful businessman with a textile factory in Karachi, left his mother and moved to Belgium, leaving behind Omar, the eldest, and two small children.

His mother’s English was poor. Quickly, Omar became the man of the household, organizing the finances, and bossing his siblings. Instead of enrolling in the local school where most of the students were South Asian, he attended a mostly white, government-run school, and led a middle-class British life.

He did relatively well in his final school exams and enrolled in college but, distracted by his larger cause, never followed through on his studies or sought steady employment.